Patchwork [ui/gtk,06/13] Replace gtk_menu_append with gtk_menu_shell_append

login
register
mail settings
Submitter Daniel P. Berrange
Date Feb. 25, 2013, 3:20 p.m.
Message ID <1361805646-6425-7-git-send-email-berrange@redhat.com>
Download mbox | patch
Permalink /patch/222949/
State New
Headers show

Comments

Daniel P. Berrange - Feb. 25, 2013, 3:20 p.m.
From: "Daniel P. Berrange" <berrange@redhat.com>

The gtk_menu_append method has long been deprecated in favour
of the gtk_menu_shell_append method. The former is now entirely
gone in GTK3, so switch all code to the latter which works on
both GTK2 and GTK3

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 ui/gtk.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

Patch

diff --git a/ui/gtk.c b/ui/gtk.c
index 4211b7e..182a16c 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1066,7 +1066,7 @@  static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSL
     g_signal_connect(vc->menu_item, "activate",
                      G_CALLBACK(gd_menu_switch_vc), s);
 
-    gtk_menu_append(GTK_MENU(s->view_menu), vc->menu_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->view_menu), vc->menu_item);
 
     qemu_chr_generic_open(vc->chr);
     if (vc->chr->init) {
@@ -1148,26 +1148,26 @@  static void gd_create_menus(GtkDisplayState *s)
     s->machine_menu_item = gtk_menu_item_new_with_mnemonic(_("_Machine"));
 
     s->pause_item = gtk_check_menu_item_new_with_mnemonic(_("_Pause"));
-    gtk_menu_append(GTK_MENU(s->machine_menu), s->pause_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->machine_menu), s->pause_item);
 
     separator = gtk_separator_menu_item_new();
-    gtk_menu_append(GTK_MENU(s->machine_menu), separator);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->machine_menu), separator);
 
     s->reset_item = gtk_image_menu_item_new_with_mnemonic(_("_Reset"));
-    gtk_menu_append(GTK_MENU(s->machine_menu), s->reset_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->machine_menu), s->reset_item);
 
     s->powerdown_item = gtk_image_menu_item_new_with_mnemonic(_("Power _Down"));
-    gtk_menu_append(GTK_MENU(s->machine_menu), s->powerdown_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->machine_menu), s->powerdown_item);
 
     separator = gtk_separator_menu_item_new();
-    gtk_menu_append(GTK_MENU(s->machine_menu), separator);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->machine_menu), separator);
 
     s->quit_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL);
     gtk_stock_lookup(GTK_STOCK_QUIT, &item);
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->quit_item),
                                  "<QEMU>/Machine/Quit");
     gtk_accel_map_add_entry("<QEMU>/Machine/Quit", item.keyval, item.modifier);
-    gtk_menu_append(GTK_MENU(s->machine_menu), s->quit_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->machine_menu), s->quit_item);
 
     s->view_menu = gtk_menu_new();
     gtk_menu_set_accel_group(GTK_MENU(s->view_menu), accel_group);
@@ -1178,53 +1178,53 @@  static void gd_create_menus(GtkDisplayState *s)
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item),
                                  "<QEMU>/View/Full Screen");
     gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f, GDK_CONTROL_MASK | GDK_MOD1_MASK);
-    gtk_menu_append(GTK_MENU(s->view_menu), s->full_screen_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->view_menu), s->full_screen_item);
 
     separator = gtk_separator_menu_item_new();
-    gtk_menu_append(GTK_MENU(s->view_menu), separator);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->view_menu), separator);
 
     s->zoom_in_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_IN, NULL);
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->zoom_in_item),
                                  "<QEMU>/View/Zoom In");
     gtk_accel_map_add_entry("<QEMU>/View/Zoom In", GDK_KEY_plus, GDK_CONTROL_MASK | GDK_MOD1_MASK);
-    gtk_menu_append(GTK_MENU(s->view_menu), s->zoom_in_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->view_menu), s->zoom_in_item);
 
     s->zoom_out_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_OUT, NULL);
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->zoom_out_item),
                                  "<QEMU>/View/Zoom Out");
     gtk_accel_map_add_entry("<QEMU>/View/Zoom Out", GDK_KEY_minus, GDK_CONTROL_MASK | GDK_MOD1_MASK);
-    gtk_menu_append(GTK_MENU(s->view_menu), s->zoom_out_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->view_menu), s->zoom_out_item);
 
     s->zoom_fixed_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_100, NULL);
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->zoom_fixed_item),
                                  "<QEMU>/View/Zoom Fixed");
     gtk_accel_map_add_entry("<QEMU>/View/Zoom Fixed", GDK_KEY_0, GDK_CONTROL_MASK | GDK_MOD1_MASK);
-    gtk_menu_append(GTK_MENU(s->view_menu), s->zoom_fixed_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->view_menu), s->zoom_fixed_item);
 
     s->zoom_fit_item = gtk_check_menu_item_new_with_mnemonic(_("Zoom To _Fit"));
-    gtk_menu_append(GTK_MENU(s->view_menu), s->zoom_fit_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->view_menu), s->zoom_fit_item);
 
     separator = gtk_separator_menu_item_new();
-    gtk_menu_append(GTK_MENU(s->view_menu), separator);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->view_menu), separator);
 
     s->grab_on_hover_item = gtk_check_menu_item_new_with_mnemonic(_("Grab On _Hover"));
-    gtk_menu_append(GTK_MENU(s->view_menu), s->grab_on_hover_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->view_menu), s->grab_on_hover_item);
 
     s->grab_item = gtk_check_menu_item_new_with_mnemonic(_("_Grab Input"));
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->grab_item),
                                  "<QEMU>/View/Grab Input");
     gtk_accel_map_add_entry("<QEMU>/View/Grab Input", GDK_KEY_g, GDK_CONTROL_MASK | GDK_MOD1_MASK);
-    gtk_menu_append(GTK_MENU(s->view_menu), s->grab_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->view_menu), s->grab_item);
 
     separator = gtk_separator_menu_item_new();
-    gtk_menu_append(GTK_MENU(s->view_menu), separator);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->view_menu), separator);
 
     s->vga_item = gtk_radio_menu_item_new_with_mnemonic(group, "_VGA");
     group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(s->vga_item));
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->vga_item),
                                  "<QEMU>/View/VGA");
     gtk_accel_map_add_entry("<QEMU>/View/VGA", GDK_KEY_1, GDK_CONTROL_MASK | GDK_MOD1_MASK);
-    gtk_menu_append(GTK_MENU(s->view_menu), s->vga_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->view_menu), s->vga_item);
 
     for (i = 0; i < nb_vcs; i++) {
         VirtualConsole *vc = &s->vc[i];
@@ -1234,10 +1234,10 @@  static void gd_create_menus(GtkDisplayState *s)
     }
 
     separator = gtk_separator_menu_item_new();
-    gtk_menu_append(GTK_MENU(s->view_menu), separator);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->view_menu), separator);
 
     s->show_tabs_item = gtk_check_menu_item_new_with_mnemonic(_("Show _Tabs"));
-    gtk_menu_append(GTK_MENU(s->view_menu), s->show_tabs_item);
+    gtk_menu_shell_append(GTK_MENU_SHELL(s->view_menu), s->show_tabs_item);
 
     g_object_set_data(G_OBJECT(s->window), "accel_group", accel_group);
     gtk_window_add_accel_group(GTK_WINDOW(s->window), accel_group);