/** gnomebase.c **/ #include static void shutdown(); static void helpContents(); static void helpAbout(GtkWidget *,gpointer); gint eventDelete(GtkWidget *widget, GdkEvent *event,gpointer data); gint eventDestroy(GtkWidget *widget, GdkEvent *event,gpointer data); GnomeUIInfo fileMenu[] = { { GNOME_APP_UI_ITEM, "Exit","Close all files and exit", shutdown,NULL,NULL, GNOME_APP_PIXMAP_NONE,NULL, 0,0,NULL }, GNOMEUIINFO_END }; GnomeUIInfo helpMenu[] = { { GNOME_APP_UI_ITEM, "Contents","Display help contents", helpContents,NULL,NULL, GNOME_APP_PIXMAP_NONE,NULL, 0,0,NULL }, GNOMEUIINFO_ITEM_STOCK("About...",NULL, helpAbout,GNOME_STOCK_MENU_ABOUT), GNOMEUIINFO_END }; GnomeUIInfo mainMenu[] = { GNOMEUIINFO_SUBTREE("File",fileMenu), GNOMEUIINFO_SUBTREE("Help",helpMenu), GNOMEUIINFO_END }; int main(int argc,char *argv[]) { GtkWidget *appWindow; gnome_init("gnomebase","1.0",argc,argv); appWindow = gnome_app_new("gnomebase","Gnome Base"); gtk_widget_show(appWindow); gnome_app_create_menus(GNOME_APP(appWindow),mainMenu); gtk_signal_connect(GTK_OBJECT(appWindow), "delete_event", GTK_SIGNAL_FUNC(eventDelete), NULL); gtk_signal_connect(GTK_OBJECT(appWindow), "destroy", GTK_SIGNAL_FUNC(eventDestroy), NULL); gtk_main(); exit(0); } static void helpAbout(GtkWidget *widget,gpointer data) { GtkWidget *aboutBox; const gchar *writtenBy[] = { "Arthur Griffith", "Lance Peterson", NULL }; aboutBox = gnome_about_new("Gnome Base","0.0", "(C) 1999 the Free Software Foundation", writtenBy, "This program serves no purpose other than " "its source code can be used as a starting " "point to create a Gnome application.", NULL); gtk_widget_show(aboutBox); } void helpContents() { g_print("Show the help contents window\n"); } gint eventDelete(GtkWidget *widget, GdkEvent *event,gpointer data) { return(FALSE); } gint eventDestroy(GtkWidget *widget, GdkEvent *event,gpointer data) { shutdown(); return(0); } void shutdown() { gtk_main_quit(); }