From f24915199725f03ce96d96ca47157e41b57b642c Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Wed, 12 Sep 2007 09:47:53 +0300 Subject: [PATCH] Add Help menu item. Reorder some code. --- src/ui-common.c | 93 +++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/src/ui-common.c b/src/ui-common.c index 0c7cafc..7565504 100644 --- a/src/ui-common.c +++ b/src/ui-common.c @@ -62,8 +62,6 @@ static const gchar *mapper_ui = " " " " " " -" " -" " " " " " " " @@ -145,6 +143,10 @@ static const gchar *mapper_ui = " " " " " " +" " +" " +" " +" " " " " " " " @@ -170,48 +172,50 @@ static const gchar *mapper_ui = static GtkActionEntry ui_entries[] = { {"file", NULL, N_("_File"), NULL, NULL, NULL }, {"file_settings", GTK_STOCK_PREFERENCES, N_("_Settings..."), NULL, NULL, G_CALLBACK(menu_cb_settings) }, - {"file_help", GTK_STOCK_HELP, N_("_Help"), NULL, NULL, G_CALLBACK(menu_cb_help) }, - {"file_about", GTK_STOCK_ABOUT, N_("_About"), "A", NULL, G_CALLBACK(menu_cb_about) }, {"file_quit", GTK_STOCK_QUIT, N_("_Quit"), "Q", NULL, G_CALLBACK(gtk_main_quit) }, + {"help", NULL, N_("_Help"), NULL, NULL, NULL }, + {"help_help", GTK_STOCK_HELP, N_("_Help"), NULL, NULL, G_CALLBACK(menu_cb_help) }, + {"help_about", GTK_STOCK_ABOUT, N_("_About"), "A", NULL, G_CALLBACK(menu_cb_about) }, + {"track", NULL, N_("_Track"), NULL, NULL, NULL }, {"track_open", GTK_STOCK_OPEN, N_("_Open..."), NULL, NULL, G_CALLBACK(menu_cb_track_open) }, {"track_save", GTK_STOCK_SAVE, N_("_Save..."), NULL, NULL, G_CALLBACK(menu_cb_track_save) }, {"track_clear", GTK_STOCK_CLEAR, N_("_Clear"), NULL, NULL, G_CALLBACK(menu_cb_track_clear) }, - {"track_insert_break", NULL, N_("Insert Break"), NULL, NULL, G_CALLBACK(menu_cb_track_insert_break) }, - {"track_insert_mark", NULL, N_("Insert Mark..."), NULL, NULL, G_CALLBACK(menu_cb_track_insert_mark) }, - {"track_dist_last_mark", NULL, N_("Distance to last mark"), NULL, NULL, G_CALLBACK(menu_cb_track_distlast) }, - {"track_dist_first", NULL, N_("Distance from first"), NULL, NULL, G_CALLBACK(menu_cb_track_distfirst) }, + {"track_insert_break", NULL, N_("Insert _Break"), NULL, NULL, G_CALLBACK(menu_cb_track_insert_break) }, + {"track_insert_mark", NULL, N_("Insert _Mark..."), NULL, NULL, G_CALLBACK(menu_cb_track_insert_mark) }, + {"track_dist_last_mark", NULL, N_("Distance to _last mark"), NULL, NULL, G_CALLBACK(menu_cb_track_distlast) }, + {"track_dist_first", NULL, N_("Distance from _first"), NULL, NULL, G_CALLBACK(menu_cb_track_distfirst) }, {"track_filter", NULL, N_("_Filter..."), NULL, NULL, G_CALLBACK(menu_cb_track_filter) }, {"route", NULL, N_("_Route"), NULL, NULL, NULL }, - {"route_open", GTK_STOCK_OPEN, N_("Open..."), NULL, NULL, G_CALLBACK(menu_cb_route_open) }, - {"route_save", GTK_STOCK_SAVE, N_("Save..."), NULL, NULL, G_CALLBACK(menu_cb_route_save) }, + {"route_open", GTK_STOCK_OPEN, N_("_Open..."), NULL, NULL, G_CALLBACK(menu_cb_route_open) }, + {"route_save", GTK_STOCK_SAVE, N_("_Save..."), NULL, NULL, G_CALLBACK(menu_cb_route_save) }, {"route_download", NULL, N_("Do_wnload..."), NULL, NULL, G_CALLBACK(menu_cb_route_download)}, {"route_reset", NULL, N_("Reset"), NULL, NULL, G_CALLBACK(menu_cb_route_reset) }, - {"route_clear", GTK_STOCK_CLEAR, N_("Clear"), NULL, NULL, G_CALLBACK(menu_cb_route_clear) }, - {"route_dist_next", NULL, N_("Show Distance to Next Waypoint"), NULL, NULL, G_CALLBACK(menu_cb_route_distnext) }, - {"route_dist_last", NULL, N_("Show Distance to End of Route"), NULL, NULL, G_CALLBACK(menu_cb_route_distlast) }, + {"route_clear", GTK_STOCK_CLEAR, N_("_Clear"), NULL, NULL, G_CALLBACK(menu_cb_route_clear) }, + {"route_dist_next", NULL, N_("Show Distance to _Next Waypoint"), NULL, NULL, G_CALLBACK(menu_cb_route_distnext) }, + {"route_dist_last", NULL, N_("Show Distance to _End of Route"), NULL, NULL, G_CALLBACK(menu_cb_route_distlast) }, {"poi", NULL, N_("_Poi"), NULL, NULL, NULL }, {"poi_categories", GTK_STOCK_INDEX, N_("_Categories"), NULL, NULL, G_CALLBACK(menu_cb_category) }, {"poi_settings", GTK_STOCK_PREFERENCES, N_("_Settings..."), NULL, NULL, NULL }, - {"poi_add", GTK_STOCK_ADD, N_("Add"), NULL, NULL, G_CALLBACK(cb_add_poi) }, - {"poi_quick_add", GTK_STOCK_ABOUT, N_("Quick Add"), NULL, NULL, G_CALLBACK(cb_add_poi) }, - {"poi_search", GTK_STOCK_FIND, N_("Search"), NULL, NULL, NULL }, + {"poi_add", GTK_STOCK_ADD, N_("_Add"), NULL, NULL, G_CALLBACK(cb_add_poi) }, + {"poi_quick_add", GTK_STOCK_ABOUT, N_("_Quick Add"), NULL, NULL, G_CALLBACK(cb_add_poi) }, + {"poi_search", GTK_STOCK_FIND, N_("_Search"), NULL, NULL, NULL }, {"map", NULL, N_("_Map"), NULL, NULL, NULL }, {"map_maps", NULL, N_("_Maps"), NULL, NULL, NULL }, {"map_manager", NULL, N_("Manager..."), NULL, NULL, G_CALLBACK(menu_cb_mapman) }, - {"map_repositories", NULL, N_("Repositories..."), NULL, NULL, G_CALLBACK(menu_cb_maps_repoman) }, - {"autocenter", NULL, N_("Autocenter"), NULL, NULL, NULL }, + {"map_repositories", NULL, N_("_Repositories..."), NULL, NULL, G_CALLBACK(menu_cb_maps_repoman) }, + {"autocenter", NULL, N_("_Autocenter"), NULL, NULL, NULL }, {"view", NULL, N_("_View"), NULL, NULL, NULL }, - {"view_zoom_in", GTK_STOCK_ZOOM_IN, N_("Zoom in"), NULL, NULL, G_CALLBACK(cb_zoomin) }, - {"view_zoom_out", GTK_STOCK_ZOOM_OUT, N_("Zoom out"), NULL, NULL, G_CALLBACK(cb_zoomout) }, - {"view_zoom_normal", GTK_STOCK_ZOOM_100, N_("Zoom normal"), NULL, NULL, G_CALLBACK(cb_zoom_base) }, + {"view_zoom_in", GTK_STOCK_ZOOM_IN, N_("Zoom _in"), NULL, NULL, G_CALLBACK(cb_zoomin) }, + {"view_zoom_out", GTK_STOCK_ZOOM_OUT, N_("Zoom _out"), NULL, NULL, G_CALLBACK(cb_zoomout) }, + {"view_zoom_normal", GTK_STOCK_ZOOM_100, N_("Zoom _normal"), NULL, NULL, G_CALLBACK(cb_zoom_base) }, - {"view_items", NULL, N_("Features"), NULL, NULL, NULL }, + {"view_items", NULL, N_("_Features"), NULL, NULL, NULL }, {"goto", NULL, N_("_Go"), NULL, NULL, NULL }, {"goto_home", GTK_STOCK_HOME, N_("_Home"), NULL, NULL, G_CALLBACK(menu_cb_goto_home) }, @@ -222,9 +226,9 @@ static GtkActionEntry ui_entries[] = { {"goto_nextway", NULL, N_("Next Waypoint"), NULL, NULL, G_CALLBACK(menu_cb_goto_nextway) }, {"goto_nearpoi", NULL, N_("Near POI"), NULL, NULL, G_CALLBACK(menu_cb_goto_nearpoi) }, - {"gps", NULL, N_("_GPS"), NULL, NULL, NULL }, + {"gps", NULL, N_("Gp_s"), NULL, NULL, NULL }, {"gps_details", GTK_STOCK_INFO, N_("_Details..."), NULL, NULL, G_CALLBACK(menu_cb_gps_details) }, - {"gps_settings", NULL, N_("Settings..."), NULL, NULL, NULL }, + {"gps_settings", NULL, N_("_Settings..."), NULL, NULL, NULL }, }; static guint n_ui_entries = G_N_ELEMENTS (ui_entries); @@ -664,28 +668,14 @@ if (!gtk_ui_manager_add_ui_from_string (ui, mapper_ui, -1, &error)) { g_error_free (error); } -notebook = gtk_notebook_new(); -gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), TRUE); -label = gtk_label_new("Map"); - -hbox = gtk_hpaned_new(); - -info_banner.container=gtk_hbox_new(FALSE, 0); -info_banner.location=gtk_label_new(""); -info_banner.speed=gtk_label_new(""); -info_banner.distance=gtk_label_new(""); -gtk_label_set_max_width_chars(GTK_LABEL(info_banner.speed), 10); -gtk_label_set_width_chars(GTK_LABEL(info_banner.speed), 14); -gtk_box_pack_start(GTK_BOX(info_banner.container), info_banner.speed, FALSE, FALSE, 0); -gtk_box_pack_start(GTK_BOX(info_banner.container), info_banner.location, TRUE, TRUE, 0); -gtk_box_pack_start(GTK_BOX(info_banner.container), info_banner.distance, FALSE, FALSE, 0); - -mapvbox = gtk_vbox_new(FALSE, 0); - +/* Menu and Toolbar */ +menu_bar = gtk_ui_manager_get_widget (ui, "/MenuBar"); toolbar = gtk_ui_manager_get_widget (ui, "/ToolBar"); toolbar_progress_init(); -menu_bar = gtk_ui_manager_get_widget (ui, "/MenuBar"); +/* Notebook with different views */ +notebook = gtk_notebook_new(); +gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), TRUE); #ifdef WITH_HILDON /* Create and add widgets and supporting data. */ @@ -707,8 +697,22 @@ gtk_box_pack_start(GTK_BOX(vbox_main), _status_bar, FALSE, FALSE, 0); gtk_widget_show_all(vbox_main); #endif +label = gtk_label_new("Map"); +hbox = gtk_hpaned_new(); + +info_banner.container=gtk_hbox_new(FALSE, 0); +info_banner.location=gtk_label_new(""); +info_banner.speed=gtk_label_new(""); +info_banner.distance=gtk_label_new(""); +gtk_label_set_max_width_chars(GTK_LABEL(info_banner.speed), 10); +gtk_label_set_width_chars(GTK_LABEL(info_banner.speed), 14); +gtk_box_pack_start(GTK_BOX(info_banner.container), info_banner.speed, FALSE, FALSE, 0); +gtk_box_pack_start(GTK_BOX(info_banner.container), info_banner.location, TRUE, TRUE, 0); +gtk_box_pack_start(GTK_BOX(info_banner.container), info_banner.distance, FALSE, FALSE, 0); + gtk_widget_hide(_progress_item); +mapvbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(mapvbox), info_banner.container, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(mapvbox), hbox, TRUE, TRUE, 0); gtk_notebook_append_page(GTK_WIDGET(notebook), mapvbox, label); @@ -792,7 +796,7 @@ pango_font_description_set_size(_sat_info_fontdesc, 8 * PANGO_SCALE); pango_layout_set_font_description(_sat_info_layout, _sat_info_fontdesc); pango_layout_set_alignment(_sat_info_layout, PANGO_ALIGN_CENTER); - /* sat_panel_expose() */ +/* sat_panel_expose() */ _sat_panel_context = gtk_widget_get_pango_context(_map_widget); _sat_panel_layout = pango_layout_new(_sat_panel_context); _sat_panel_fontdesc = pango_font_description_new(); @@ -810,7 +814,6 @@ pango_font_description_set_family(_heading_panel_fontdesc, "Sans Serif"); _sat_details_context = gtk_widget_get_pango_context(_map_widget); _sat_details_layout = pango_layout_new(_sat_details_context); _sat_details_fontdesc = pango_font_description_new(); - pango_font_description_set_family(_sat_details_fontdesc, "Sans Serif"); pango_font_description_set_size(_sat_details_fontdesc, 10 * PANGO_SCALE); pango_layout_set_font_description(_sat_details_layout, _sat_details_fontdesc); -- 2.39.5