1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
/* the config.h file generated by the autotools */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
/* this will hold the path to the glade file after the "make install" */
#define GLADE_FILE PACKAGE_DATA_DIR"/gnome3/gnome3.glade"
#include <gnome.h>
#include <glade/glade.h>
/* callback function prototypes */
static gint delete_event_cb(GtkWidget* w, GdkEventAny* e, gpointer data);
static gint destroy_cb(GtkWidget* w, GdkEventAny* e, gpointer data);
int main (int argc, char *argv[])
{
GtkWidget *app_window; /* main application window widget */
GladeXML *gxml; /* glade xml file */
/* initialize libgnome */
gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE,
argc, argv,
NULL);
/* create GladeXML object and connect signals */
gxml = glade_xml_new (GLADE_FILE, NULL, NULL);
glade_xml_signal_autoconnect (gxml);
/* get the app_window from the glade XML file */
app_window = glade_xml_get_widget (gxml, "app_window");
/* Connect signals for termination of application */
g_signal_connect(G_OBJECT(app_window), "delete_event",
G_CALLBACK(delete_event_cb), NULL);
g_signal_connect(G_OBJECT(app_window), "destroy",
G_CALLBACK(destroy_cb), NULL);
/* show the main window */
gtk_widget_show (app_window);
/* begin main GTK loop */
gtk_main ();
return 0;
}
static gint delete_event_cb(GtkWidget* w, GdkEventAny* e, gpointer data)
{
/* callback for "delete" signal */
g_print("main.c:delete_event_cb()\n");
return 0;
}
static gint destroy_cb(GtkWidget* w, GdkEventAny* e, gpointer data)
{
/* callback for "destroy" signal */
g_print("main.c:destroy_cb()\n");
/* quit application */
gtk_main_quit();
return 0;
}
void
on_toolbutton_new_clicked(GtkWidget *w, GdkEventKey *e)
{
/* the 'New' toolbar was clicked */
g_print("main.c:on_toolbutton_new_clicked()");
}
|