]> err.no Git - mapper/commitdiff
Split the menu to separate items for !HILDON case
authorKaj-Michael Lang <milang@onion.tal.org>
Thu, 2 Aug 2007 10:06:40 +0000 (13:06 +0300)
committerKaj-Michael Lang <milang@onion.tal.org>
Thu, 2 Aug 2007 10:06:40 +0000 (13:06 +0300)
src/ui-common.c

index 85cb30b63c5b56675be0399fa26d6eee11853de5..a27335492d26427ca69a681899a75510d6bfb07e 100644 (file)
@@ -281,6 +281,8 @@ static void menu_init()
 {
        /* Create needed handles. */
        GtkMenu *menu;
+       GtkWidget *submenu_routes;
+       GtkWidget *submenu_track;
        GtkWidget *submenu;
        GtkWidget *menu_item;
        printf("%s()\n", __PRETTY_FUNCTION__);
@@ -288,65 +290,63 @@ static void menu_init()
        /* Get the menu of our view. */
        menu = GTK_MENU(gtk_menu_new());
 
+#ifdef WITH_HILDON
+       hildon_window_set_menu(HILDON_WINDOW(_window), menu);
+#else
+       GtkWidget *file_item;
+
+       file_item = gtk_menu_item_new_with_label("File");
+       gtk_menu_item_set_submenu(GTK_MENU_ITEM(file_item), GTK_WIDGET(menu));
+       gtk_menu_bar_append(GTK_MENU_BAR(_menu_bar), GTK_WIDGET(file_item));
+#endif
+
        /* Create the menu items. */
 
        /* The "Routes" submenu. */
-       gtk_menu_append(menu, menu_item
-                       = gtk_menu_item_new_with_label(_("Route")));
-       gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item),
-                                 submenu = gtk_menu_new());
-       gtk_menu_append(submenu, _menu_route_open_item
-                       = gtk_menu_item_new_with_label(_("Open...")));
-       gtk_menu_append(submenu, _menu_route_download_item
-                       = gtk_menu_item_new_with_label(_("Download...")));
-       gtk_menu_append(submenu, _menu_route_save_item
-                       = gtk_menu_item_new_with_label(_("Save...")));
-       gtk_menu_append(submenu, _menu_route_distnext_item
-                       = gtk_menu_item_new_with_label(_("Show Distance to Next Waypoint")));
-       gtk_menu_append(submenu, _menu_route_distlast_item =
-                       gtk_menu_item_new_with_label(_("Show Distance to End of Route")));
-       gtk_menu_append(submenu, _menu_route_reset_item =
-                       gtk_menu_item_new_with_label(_("Reset")));
-       gtk_menu_append(submenu, _menu_route_clear_item =
-                       gtk_menu_item_new_with_label(_("Clear")));
+       menu_item = gtk_menu_item_new_with_label(_("Route"));
+#ifdef WITH_HILDON
+       gtk_menu_append(menu, menu_item);
+#else
+       gtk_menu_bar_append(GTK_MENU_BAR(_menu_bar), GTK_WIDGET(menu_item));
+#endif
+       gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item),  submenu = gtk_menu_new());
+       gtk_menu_append(submenu, _menu_route_open_item = gtk_menu_item_new_with_label(_("Open...")));
+       gtk_menu_append(submenu, _menu_route_download_item = gtk_menu_item_new_with_label(_("Download...")));
+       gtk_menu_append(submenu, _menu_route_save_item = gtk_menu_item_new_with_label(_("Save...")));
+       gtk_menu_append(submenu, _menu_route_distnext_item = gtk_menu_item_new_with_label(_("Show Distance to Next Waypoint")));
+       gtk_menu_append(submenu, _menu_route_distlast_item = gtk_menu_item_new_with_label(_("Show Distance to End of Route")));
+       gtk_menu_append(submenu, _menu_route_reset_item = gtk_menu_item_new_with_label(_("Reset")));
+       gtk_menu_append(submenu, _menu_route_clear_item = gtk_menu_item_new_with_label(_("Clear")));
 
        /* The "Track" submenu. */
-       gtk_menu_append(menu, menu_item
-                       = gtk_menu_item_new_with_label(_("Track")));
-       gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item),
-                                 submenu = gtk_menu_new());
-       gtk_menu_append(submenu, _menu_track_open_item
-                       = gtk_menu_item_new_with_label(_("Open...")));
-       gtk_menu_append(submenu, _menu_track_save_item
-                       = gtk_menu_item_new_with_label(_("Save...")));
-       gtk_menu_append(submenu, _menu_track_insert_break_item
-                       = gtk_menu_item_new_with_label(_("Insert Break")));
-       gtk_menu_append(submenu, _menu_track_insert_mark_item
-                       = gtk_menu_item_new_with_label(_("Insert Mark...")));
-       gtk_menu_append(submenu, _menu_track_distlast_item
-                       = gtk_menu_item_new_with_label(_("Show Distance from Last Mark")));
-       gtk_menu_append(submenu, _menu_track_distfirst_item =
-                       gtk_menu_item_new_with_label(_("Show Distance from Beginning")));
-       gtk_menu_append(submenu, _menu_track_clear_item =
-                       gtk_menu_item_new_with_label(_("Clear")));
+       menu_item = gtk_menu_item_new_with_label(_("Track"));
+#ifdef WITH_HILDON
+       gtk_menu_append(menu, menu_item);
+#else
+       gtk_menu_bar_append(GTK_MENU_BAR(_menu_bar), GTK_WIDGET(menu_item));
+#endif
+       gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), submenu = gtk_menu_new());
+       gtk_menu_append(submenu, _menu_track_open_item = gtk_menu_item_new_with_label(_("Open...")));
+       gtk_menu_append(submenu, _menu_track_save_item = gtk_menu_item_new_with_label(_("Save...")));
+       gtk_menu_append(submenu, _menu_track_insert_break_item = gtk_menu_item_new_with_label(_("Insert Break")));
+       gtk_menu_append(submenu, _menu_track_insert_mark_item = gtk_menu_item_new_with_label(_("Insert Mark...")));
+       gtk_menu_append(submenu, _menu_track_distlast_item = gtk_menu_item_new_with_label(_("Show Distance from Last Mark")));
+       gtk_menu_append(submenu, _menu_track_distfirst_item = gtk_menu_item_new_with_label(_("Show Distance from Beginning")));
+       gtk_menu_append(submenu, _menu_track_clear_item = gtk_menu_item_new_with_label(_("Clear")));
 
        /* The "Maps" submenu. */
-       gtk_menu_append(menu, menu_item
-                       = gtk_menu_item_new_with_label(_("Maps")));
-       gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item),
-                                 _menu_maps_submenu = gtk_menu_new());
+       menu_item = gtk_menu_item_new_with_label(_("Maps"));
+#ifdef WITH_HILDON
+       gtk_menu_append(menu, menu_item);
+#else
+       gtk_menu_bar_append(GTK_MENU_BAR(_menu_bar), GTK_WIDGET(menu_item));
+#endif
+       gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), _menu_maps_submenu = gtk_menu_new());
        gtk_menu_append(_menu_maps_submenu, gtk_separator_menu_item_new());
-       gtk_menu_append(_menu_maps_submenu, _menu_maps_mapman_item
-                       = gtk_menu_item_new_with_label(_("Manage Maps...")));
-       gtk_menu_append(_menu_maps_submenu, _menu_maps_repoman_item
-                       =
-                       gtk_menu_item_new_with_label(_
-                                                    ("Manage Repositories...")));
-       gtk_menu_append(_menu_maps_submenu, _menu_auto_download_item =
-                       gtk_check_menu_item_new_with_label(_("Auto-Download")));
-       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM
-                                      (_menu_auto_download_item),
-                                      _auto_download);
+       gtk_menu_append(_menu_maps_submenu, _menu_maps_mapman_item = gtk_menu_item_new_with_label(_("Manage Maps...")));
+       gtk_menu_append(_menu_maps_submenu, _menu_maps_repoman_item     = gtk_menu_item_new_with_label(_("Manage Repositories...")));
+       gtk_menu_append(_menu_maps_submenu, _menu_auto_download_item = gtk_check_menu_item_new_with_label(_("Auto-Download")));
+       gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(_menu_auto_download_item), _auto_download);
        menu_maps_add_repos(_curr_repo);
 
        gtk_menu_append(menu, gtk_separator_menu_item_new());
@@ -428,16 +428,7 @@ static void menu_init()
 
        /* We need to show menu items. */
        gtk_widget_show_all(GTK_WIDGET(menu));
-
-#ifdef WITH_HILDON
-       hildon_window_set_menu(HILDON_WINDOW(_window), menu);
-#else
-       GtkWidget *file_item;
-
-       file_item = gtk_menu_item_new_with_label("File");
-       gtk_menu_item_set_submenu(GTK_MENU_ITEM(file_item), GTK_WIDGET(menu));
-       gtk_menu_bar_append(GTK_MENU_BAR(_menu_bar), GTK_WIDGET(file_item));
-
+#ifndef WITH_HILDON
        gtk_widget_show_all(GTK_WIDGET(_menu_bar));
 #endif
 
@@ -919,7 +910,6 @@ void mapper_init(gint argc, gchar ** argv)
        _menu_bar = gtk_menu_bar_new();
        gtk_box_pack_start(GTK_BOX(vbox_main), _menu_bar, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox_main), _toolbar, FALSE, FALSE, 0);
-
        gtk_box_pack_start(GTK_BOX(vbox_main), notebook, TRUE, TRUE, 0);
 
        _status_bar = gtk_statusbar_new();