From 4ab9c2ca92c8af295dcb18bd48651b2864924864 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Tue, 9 Oct 2007 13:43:07 +0300 Subject: [PATCH] Store notebook page id numbers in a struct --- src/ui-common.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/ui-common.c b/src/ui-common.c index 5ac89e5..d9a9d52 100644 --- a/src/ui-common.c +++ b/src/ui-common.c @@ -50,6 +50,14 @@ static GtkActionGroup *actions; static GtkActionGroup *map_repos_action_group; static GtkUIManager *ui; +struct ui_notebook_struct { + GtkWidget *notebook; + gint map; + gint gps; + gint heading; +}; +struct ui_notebook_struct ui_notebook; + /* A GPS icon would be nice.. anyone ? */ #ifndef GTK_STOCK_INFO @@ -737,7 +745,7 @@ gtk_widget_hide(GTK_WIDGET(_progress_item)); mapvbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(mapvbox), hbox, TRUE, TRUE, 0); -gtk_notebook_append_page(notebook, mapvbox, label); +ui_notebook.map=gtk_notebook_append_page(notebook, mapvbox, label); gtk_widget_show_all(GTK_WIDGET(mapvbox)); /* GPS Tab */ @@ -745,7 +753,7 @@ gpsvbox = gtk_vbox_new(FALSE, 0); label = gtk_label_new("Gps"); _gps_sat_view = gtk_gps_new(GTK_GPS_MODE_SKY, &_gps); gtk_box_pack_start(GTK_BOX(gpsvbox), _gps_sat_view, TRUE, TRUE, 0); -gtk_notebook_append_page(notebook, gpsvbox, label); +ui_notebook.gps=gtk_notebook_append_page(notebook, gpsvbox, label); gtk_widget_show_all(GTK_WIDGET(gpsvbox)); /* Heading */ @@ -753,7 +761,7 @@ headingvbox = gtk_vbox_new(FALSE, 0); label = gtk_label_new("Heading"); _tab_compass = gtk_compass_new(&_gps); gtk_box_pack_start(GTK_BOX(headingvbox), _tab_compass, TRUE, TRUE, 0); -gtk_notebook_append_page(notebook, headingvbox, label); +ui_notebook.heading=gtk_notebook_append_page(notebook, headingvbox, label); gtk_widget_show_all(GTK_WIDGET(headingvbox)); _gps_widget = gps_info_panel(); @@ -764,8 +772,8 @@ _map_widget = gtk_drawing_area_new(); gtk_paned_add2(GTK_PANED(hbox), _map_widget); gps_show_info(); -map_poi_init(_map_widget); gtk_widget_realize(_map_widget); +map_poi_init(_map_widget); menu_maps_add_repos(); @@ -811,7 +819,7 @@ gdk_gc_set_rgb_fg_color(_speed_limit_gc2, &color); _speed_limit_context = gtk_widget_get_pango_context(_map_widget); _speed_limit_layout = pango_layout_new(_speed_limit_context); _speed_limit_fontdesc = pango_font_description_new(); -pango_font_description_set_size(_speed_limit_fontdesc,64 * PANGO_SCALE); +pango_font_description_set_size(_speed_limit_fontdesc, 64 * PANGO_SCALE); pango_layout_set_font_description(_speed_limit_layout, _speed_limit_fontdesc); pango_layout_set_alignment(_speed_limit_layout, PANGO_ALIGN_CENTER); -- 2.39.5