- 论坛徽章:
- 0
|
#include <stdlib.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
GladeXML *xml;
int main (int argc, char *argv[])
{
// GladeXML *xml;
g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, (GLogFunc) gtk_false, NULL);
gtk_init (&argc, &argv);
g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler, NULL);
xml = glade_xml_new("tutorial.glade", NULL, NULL);
glade_xml_signal_autoconnect(xml);
gtk_main ();
return 0;
}
void on_ok_button_clicked(GtkButton *ok_button,gpointer user_data)
{
GtkWidget *student;
student = glade_xml_get_widget (xml,"student_window");
// gtk_widget_show (studnet);
gtk_widget_show (student);
}
|
xml 原来为main局部变量,怎么能在其他函数使用呢!
编译:
gcc -o xxx xxx.c `pkg-config libglade-2.0 --cflags --libs` |
|