[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 5/8] gtk: Remove use of deprecated stock items
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 5/8] gtk: Remove use of deprecated stock items |
Date: |
Tue, 29 Apr 2014 11:46:11 +0200 |
From: Cole Robinson <address@hidden>
Stock items are deprecated. As are ImageMenuItems. Convert everything to
text only MenuItems, with the same text content as mentioned in the
conversion guide:
https://docs.google.com/spreadsheet/pub?key=0AsPAM3pPwxagdGF4THNMMUpjUW5xMXZfdUNzMXhEa2c&output=html
gtk2 users lose their menu icons as well, but I don't think that's enough
of a problem to warrant keeping around back compat code.
Example error:
ui/gtk.c:1328:5: error: ‘GtkStock’ is deprecated
[-Werror=deprecated-declarations]
ui/gtk.c:1335:5: error: ‘gtk_image_menu_item_new_from_stock’ is deprecated
(declared at /usr/include/gtk-3.0/gtk/deprecated/gtkimagemenuitem.h:78): Use
'gtk_menu_item_new' instead [-Werror=deprecated-declarations]
s->zoom_out_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_OUT,
NULL);
Signed-off-by: Cole Robinson <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
ui/gtk.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index 5cdc044..7e87e35 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1355,7 +1355,6 @@ static GtkWidget *gd_create_menu_machine(GtkDisplayState
*s, GtkAccelGroup *acce
{
GtkWidget *machine_menu;
GtkWidget *separator;
- GtkStockItem item;
machine_menu = gtk_menu_new();
gtk_menu_set_accel_group(GTK_MENU(machine_menu), accel_group);
@@ -1375,11 +1374,11 @@ static GtkWidget
*gd_create_menu_machine(GtkDisplayState *s, GtkAccelGroup *acce
separator = gtk_separator_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(machine_menu), separator);
- s->quit_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL);
- gtk_stock_lookup(GTK_STOCK_QUIT, &item);
+ s->quit_item = gtk_menu_item_new_with_mnemonic(_("_Quit"));
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_accel_map_add_entry("<QEMU>/Machine/Quit",
+ GDK_KEY_q, GDK_CONTROL_MASK);
gtk_menu_shell_append(GTK_MENU_SHELL(machine_menu), s->quit_item);
return machine_menu;
@@ -1395,8 +1394,7 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s,
GtkAccelGroup *accel_g
view_menu = gtk_menu_new();
gtk_menu_set_accel_group(GTK_MENU(view_menu), accel_group);
- s->full_screen_item =
- gtk_image_menu_item_new_from_stock(GTK_STOCK_FULLSCREEN, NULL);
+ s->full_screen_item = gtk_menu_item_new_with_mnemonic(_("_Fullscreen"));
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,
@@ -1406,21 +1404,21 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState
*s, GtkAccelGroup *accel_g
separator = gtk_separator_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), separator);
- s->zoom_in_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_IN,
NULL);
+ s->zoom_in_item = gtk_menu_item_new_with_mnemonic(_("Zoom _In"));
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,
HOTKEY_MODIFIERS);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->zoom_in_item);
- s->zoom_out_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_OUT,
NULL);
+ s->zoom_out_item = gtk_menu_item_new_with_mnemonic(_("Zoom _Out"));
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,
HOTKEY_MODIFIERS);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->zoom_out_item);
- s->zoom_fixed_item =
gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_100, NULL);
+ s->zoom_fixed_item = gtk_menu_item_new_with_mnemonic(_("Best _Fit"));
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,
--
1.8.3.1
- [Qemu-devel] [PULL 0/8] gtk patch queue, Gerd Hoffmann, 2014/04/29
- [Qemu-devel] [PULL 2/8] configure: Re-run make if gtkabi/sdlabi is changed, Gerd Hoffmann, 2014/04/29
- [Qemu-devel] [PULL 5/8] gtk: Remove use of deprecated stock items,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 1/8] configure: Document --with-gtkabi, Gerd Hoffmann, 2014/04/29
- [Qemu-devel] [PULL 6/8] gtk: Use ctrl+alt+q for quit accelerator, Gerd Hoffmann, 2014/04/29
- [Qemu-devel] [PULL 3/8] gtk: Don't use deprecated gtk_image_menu_item_new_with_mnemonic, Gerd Hoffmann, 2014/04/29
- [Qemu-devel] [PULL 4/8] gtk: Don't use deprecated vte_terminal_get_adjustment, Gerd Hoffmann, 2014/04/29
- [Qemu-devel] [PULL 8/8] gtk: Fix accelerators being triggered twice with gtk3, Gerd Hoffmann, 2014/04/29
- [Qemu-devel] [PULL 7/8] gtk: Fix -serial vc, Gerd Hoffmann, 2014/04/29