#include gint delete_event_cb(GtkWidget *window, GdkEventAny *e, gpointer data) { gtk_main_quit(); return FALSE; } gint expose_event_cb(GtkWidget *w, GdkEventExpose *e) { GtkRequisition req; /* Get the size of the Map Widget */ gtk_widget_size_request (w, &req); printf("Map = %dx%d\n", req.width, req.height); printf("Expose Event\n"); return FALSE; } static GnomeUIInfo file_menu[] = { GNOMEUIINFO_MENU_EXIT_ITEM(delete_event_cb, NULL), GNOMEUIINFO_END }; static GnomeUIInfo main_menu[] = { GNOMEUIINFO_MENU_FILE_TREE(file_menu), GNOMEUIINFO_END }; int main(int argc, char **argv) { GtkWidget *app; GtkWidget *top; GtkWidget *mapFrame; GtkWidget *Map; gnome_init("navigatrix", "0.1", argc, argv); app = gnome_app_new("navigatrix", "Navigatrix"); gnome_app_create_menus(GNOME_APP(app), main_menu); gtk_signal_connect(GTK_OBJECT(app), "delete_event", GTK_SIGNAL_FUNC(delete_event_cb), NULL); /* Create the top container widget. This will have the compass and GPS data on the right and the map on the left. */ top = gtk_hbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(top), 5); gnome_app_set_contents(GNOME_APP(app), GTK_WIDGET(top)); /* Create the Map Frame */ mapFrame = gtk_frame_new("Map"); gtk_box_pack_start(GTK_BOX(top), mapFrame, TRUE, TRUE, 0); /* Create the Map drawing area. All maps get drawn here. */ Map = gtk_drawing_area_new(); gtk_container_add(GTK_CONTAINER(mapFrame), Map); gtk_signal_connect(GTK_OBJECT(Map), "expose_event", GTK_SIGNAL_FUNC(expose_event_cb), NULL); gtk_widget_show_all(app); gtk_main(); return 0; }