[gnome-panel] don't use deprecated GtkStock



commit cd7a97d5deab25a59e26a20f6b43f19f5a057281
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Jul 10 17:29:50 2014 +0300

    don't use deprecated GtkStock

 gnome-panel/menu.c               |   27 ++++------------------
 gnome-panel/menu.h               |    1 -
 gnome-panel/panel-applet-frame.c |    6 ++--
 gnome-panel/panel-context-menu.c |    8 +++---
 gnome-panel/panel-menu-items.c   |   22 +++++++++---------
 gnome-panel/panel-recent.c       |    9 +++----
 gnome-panel/panel-run-dialog.c   |    4 +-
 gnome-panel/panel-stock-icons.c  |   46 --------------------------------------
 gnome-panel/panel-stock-icons.h  |    8 ------
 9 files changed, 29 insertions(+), 102 deletions(-)
---
diff --git a/gnome-panel/menu.c b/gnome-panel/menu.c
index 96cc738..38afaa2 100644
--- a/gnome-panel/menu.c
+++ b/gnome-panel/menu.c
@@ -45,7 +45,6 @@
 
 typedef struct {
        GtkWidget    *pixmap;
-       const char   *stock_id;
        GIcon        *gicon;
        char         *image;
        char         *fallback_image;
@@ -55,7 +54,6 @@ typedef struct {
 
 typedef struct {
        GtkWidget   *image;
-       const char  *stock_id;
        GIcon       *gicon;
        GdkPixbuf   *pixbuf;
        GtkIconSize  icon_size;
@@ -73,7 +71,6 @@ static GtkWidget *populate_menu_from_directory (GtkWidget          *menu,
 
 static void panel_load_menu_image_deferred (GtkWidget   *image_menu_item,
                                            GtkIconSize  icon_size,
-                                           const char  *stock_id,
                                            GIcon       *gicon,
                                            const char  *image_filename,
                                            const char  *fallback_image_filename);
@@ -268,7 +265,6 @@ icon_to_load_copy (IconToLoad *icon)
                retval->gicon  = NULL;
        retval->image          = g_strdup (icon->image);
        retval->fallback_image = g_strdup (icon->fallback_image);
-       retval->stock_id       = icon->stock_id;
        retval->icon_size      = icon->icon_size;
 
        return retval;
@@ -444,12 +440,7 @@ do_icons_to_add (void)
 
                icons_to_add = g_list_delete_link (icons_to_add, icons_to_add);
 
-               if (icon_to_add->stock_id) {
-                       gtk_image_set_from_stock (
-                               GTK_IMAGE (icon_to_add->image),
-                               icon_to_add->stock_id,
-                               icon_to_add->icon_size);
-               } else if (icon_to_add->gicon) {
+               if (icon_to_add->gicon) {
                        gtk_image_set_from_gicon (
                                GTK_IMAGE (icon_to_add->image),
                                icon_to_add->gicon,
@@ -503,12 +494,11 @@ load_icons_handler_again:
                goto load_icons_handler_again;
        }
 
-       if (icon->stock_id || icon->gicon) {
+       if (icon->gicon) {
                IconToAdd *icon_to_add;
 
                icon_to_add            = g_new (IconToAdd, 1);
                icon_to_add->image     = g_object_ref (icon->pixmap);
-               icon_to_add->stock_id  = icon->stock_id;
                icon_to_add->pixbuf    = NULL;
                icon_to_add->icon_size = icon->icon_size;
                if (icon->gicon)
@@ -543,7 +533,6 @@ load_icons_handler_again:
 
                icon_to_add            = g_new (IconToAdd, 1);
                icon_to_add->image     = g_object_ref (icon->pixmap);
-               icon_to_add->stock_id  = NULL;
                icon_to_add->gicon     = NULL;
                icon_to_add->pixbuf    = pb;
                icon_to_add->icon_size = icon->icon_size;
@@ -1006,7 +995,6 @@ create_submenu_entry (GtkWidget          *menu,
 
        panel_load_menu_image_deferred (menuitem,
                                        panel_menu_icon_get_size (),
-                                       NULL,
                                        gmenu_tree_directory_get_icon (directory),
                                        NULL,
                                        PANEL_ICON_FOLDER);
@@ -1076,14 +1064,13 @@ create_menuitem (GtkWidget          *menu,
        if (alias_directory)
                panel_load_menu_image_deferred (menuitem,
                                                panel_menu_icon_get_size (),
-                                               NULL,
                                                gmenu_tree_directory_get_icon (alias_directory),
                                                NULL,
                                                NULL);
        else
                panel_load_menu_image_deferred (menuitem,
                                                panel_menu_icon_get_size (),
-                                               NULL, g_app_info_get_icon (G_APP_INFO 
(gmenu_tree_entry_get_app_info (entry))),
+                                               g_app_info_get_icon (G_APP_INFO 
(gmenu_tree_entry_get_app_info (entry))),
                                                NULL, NULL);
 
        setup_menuitem (menuitem,
@@ -1346,14 +1333,12 @@ void
 setup_menu_item_with_icon (GtkWidget   *item,
                           GtkIconSize  icon_size,
                           const char  *icon_name,
-                          const char  *stock_id,
                           GIcon       *gicon,
                           const char  *title)
 {
-       if (icon_name || gicon || stock_id)
+       if (icon_name || gicon)
                panel_load_menu_image_deferred (item, icon_size,
-                                               stock_id, gicon,
-                                               icon_name, NULL);
+                                               gicon, icon_name, NULL);
 
        setup_menuitem (item, icon_size, NULL, title);
 }
@@ -1456,7 +1441,6 @@ image_menu_destroy (GtkWidget *image, gpointer data)
 static void
 panel_load_menu_image_deferred (GtkWidget   *image_menu_item,
                                GtkIconSize  icon_size,
-                               const char  *stock_id,
                                GIcon       *gicon,
                                const char  *image_filename,
                                const char  *fallback_image_filename)
@@ -1475,7 +1459,6 @@ panel_load_menu_image_deferred (GtkWidget   *image_menu_item,
        /* this takes over the floating ref */
        icon->pixmap = g_object_ref_sink (G_OBJECT (image));
 
-       icon->stock_id       = stock_id;
        if (gicon)
                icon->gicon  = g_object_ref (gicon);
        else
diff --git a/gnome-panel/menu.h b/gnome-panel/menu.h
index 133855f..529e07e 100644
--- a/gnome-panel/menu.h
+++ b/gnome-panel/menu.h
@@ -35,7 +35,6 @@ void          setup_menuitem            (GtkWidget        *menuitem,
 void            setup_menu_item_with_icon (GtkWidget        *item,
                                           GtkIconSize       icon_size,
                                           const char       *icon_name,
-                                          const char       *stock_id,
                                           GIcon            *gicon,
                                           const char       *title);
 
diff --git a/gnome-panel/panel-applet-frame.c b/gnome-panel/panel-applet-frame.c
index bd6436b..3abeac9 100644
--- a/gnome-panel/panel-applet-frame.c
+++ b/gnome-panel/panel-applet-frame.c
@@ -930,15 +930,15 @@ panel_applet_frame_loading_failed (const char  *iid,
 
        if (locked_down) {
                gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-                                       GTK_STOCK_OK, LOADING_FAILED_RESPONSE_DONT_DELETE,
+                                       _("OK"), LOADING_FAILED_RESPONSE_DONT_DELETE,
                                        NULL);
        } else {
                gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
                                        _("Do you want to delete the applet "
                                          "from your configuration?"));
                gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-                                       PANEL_STOCK_DONT_DELETE, LOADING_FAILED_RESPONSE_DONT_DELETE,
-                                       GTK_STOCK_DELETE, LOADING_FAILED_RESPONSE_DELETE,
+                                       _("D_on't Delete"), LOADING_FAILED_RESPONSE_DONT_DELETE,
+                                       _("_Delete"), LOADING_FAILED_RESPONSE_DELETE,
                                        NULL);
        }
 
diff --git a/gnome-panel/panel-context-menu.c b/gnome-panel/panel-context-menu.c
index 4f62f5a..df03025 100644
--- a/gnome-panel/panel-context-menu.c
+++ b/gnome-panel/panel-context-menu.c
@@ -118,7 +118,7 @@ panel_context_menu_build_edition (PanelWidget *panel_widget,
        GtkWidget *image;
 
        menuitem = gtk_image_menu_item_new_with_mnemonic (_("_Add to Panel..."));
-       image = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
+       image = gtk_image_new_from_icon_name ("list-add", GTK_ICON_SIZE_MENU);
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
        gtk_widget_show (menuitem);
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
@@ -129,7 +129,7 @@ panel_context_menu_build_edition (PanelWidget *panel_widget,
                gtk_widget_set_sensitive (menuitem, FALSE);
 
        menuitem = gtk_image_menu_item_new_with_mnemonic (_("_Properties"));
-       image = gtk_image_new_from_stock (GTK_STOCK_PROPERTIES,
+       image = gtk_image_new_from_icon_name ("document-properties",
                                          GTK_ICON_SIZE_MENU);
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
        gtk_widget_show (menuitem);
@@ -139,7 +139,7 @@ panel_context_menu_build_edition (PanelWidget *panel_widget,
                                  panel_widget->toplevel);
 
        menuitem = gtk_image_menu_item_new_with_mnemonic (_("_Delete This Panel"));
-       image = gtk_image_new_from_stock (GTK_STOCK_DELETE,
+       image = gtk_image_new_from_icon_name ("gtk-delete",
                                          GTK_ICON_SIZE_MENU);
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
        gtk_widget_show (menuitem);
@@ -154,7 +154,7 @@ panel_context_menu_build_edition (PanelWidget *panel_widget,
        add_menu_separator (menu);
 
        menuitem = gtk_image_menu_item_new_with_mnemonic (_("_New Panel"));
-       image = gtk_image_new_from_stock (GTK_STOCK_NEW, GTK_ICON_SIZE_MENU);
+       image = gtk_image_new_from_icon_name ("document-new", GTK_ICON_SIZE_MENU);
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
        gtk_widget_show (menuitem);
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
diff --git a/gnome-panel/panel-menu-items.c b/gnome-panel/panel-menu-items.c
index 1fcf4b1..e52af1c 100644
--- a/gnome-panel/panel-menu-items.c
+++ b/gnome-panel/panel-menu-items.c
@@ -330,7 +330,7 @@ panel_menu_item_desktop_new (char      *path,
        }
 
        setup_menu_item_with_icon (item, panel_menu_icon_get_size (),
-                                  icon, NULL, NULL, name);
+                                  icon, NULL, name);
 
        panel_util_set_tooltip_text (item, comment);
 
@@ -377,7 +377,7 @@ panel_menu_item_uri_new (const char *uri,
        item = panel_image_menu_item_new ();
        setup_menu_item_with_icon (item,
                                   panel_menu_icon_get_size (),
-                                  icon_name, NULL, gicon,
+                                  icon_name, gicon,
                                   title);
 
        panel_util_set_tooltip_text (item, tooltip);
@@ -409,7 +409,7 @@ panel_menu_items_create_action_item_full (PanelActionButtonType  action_type,
         setup_menu_item_with_icon (item,
                                   panel_menu_icon_get_size (),
                                   panel_action_get_icon_name (action_type),
-                                  NULL, NULL,
+                                  NULL,
                                   label ? label : panel_action_get_text (action_type));
 
        panel_util_set_tooltip_text (item,
@@ -481,7 +481,7 @@ panel_menu_items_create_switch_user (gboolean use_icon)
        }
 
        setup_menu_item_with_icon (item, panel_menu_icon_get_size (),
-                                  NULL, NULL, NULL, _("Switch User"));
+                                  NULL, NULL, _("Switch User"));
 
        g_signal_connect (item, "activate",
                          G_CALLBACK (panel_menu_item_activate_switch_user),
@@ -610,7 +610,7 @@ panel_place_menu_item_append_gtk_bookmarks (GtkWidget *menu)
 
                item = gtk_image_menu_item_new ();
                setup_menu_item_with_icon (item, panel_menu_icon_get_size (),
-                                          PANEL_ICON_BOOKMARKS, NULL, NULL,
+                                          PANEL_ICON_BOOKMARKS, NULL,
                                           _("Bookmarks"));
 
                gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
@@ -744,7 +744,7 @@ panel_menu_item_drive_new (GDrive *drive)
        item = panel_image_menu_item_new ();
        setup_menu_item_with_icon (item,
                                   panel_menu_icon_get_size (),
-                                  NULL, NULL, icon,
+                                  NULL, icon,
                                   title);
        g_object_unref (icon);
 
@@ -843,7 +843,7 @@ panel_menu_item_volume_new (GVolume *volume)
        item = panel_image_menu_item_new ();
        setup_menu_item_with_icon (item,
                                   panel_menu_icon_get_size (),
-                                  NULL, NULL, icon,
+                                  NULL, icon,
                                   title);
        g_object_unref (icon);
 
@@ -1054,7 +1054,7 @@ panel_place_menu_item_append_local_gio (PanelPlaceMenuItem *place_item,
                item = gtk_image_menu_item_new ();
                setup_menu_item_with_icon (item, panel_menu_icon_get_size (),
                                           PANEL_ICON_REMOVABLE_MEDIA,
-                                          NULL, NULL,
+                                          NULL,
                                           _("Removable Media"));
 
                gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
@@ -1145,7 +1145,7 @@ panel_place_menu_item_append_remote_gio (PanelPlaceMenuItem *place_item,
                item = panel_image_menu_item_new ();
                setup_menu_item_with_icon (item, panel_menu_icon_get_size (),
                                           PANEL_ICON_NETWORK_SERVER,
-                                          NULL, NULL,
+                                          NULL,
                                           _("Network Places"));
 
                gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
@@ -1589,7 +1589,7 @@ panel_place_menu_item_new (gboolean use_image,
                if (use_image)
                        setup_menu_item_with_icon (GTK_WIDGET (menuitem),
                                                   panel_menu_icon_get_size (),
-                                                  icon_name, NULL, NULL,
+                                                  icon_name, NULL,
                                                   name);
                else
                        setup_menuitem (GTK_WIDGET (menuitem),
@@ -1696,7 +1696,7 @@ panel_desktop_menu_item_new (gboolean use_image,
                if (use_image)
                        setup_menu_item_with_icon (GTK_WIDGET (menuitem),
                                                   menuitem->priv->icon_size,
-                                                  icon_name, NULL, NULL,
+                                                  icon_name, NULL,
                                                   name);
                else
                        setup_menuitem (GTK_WIDGET (menuitem),
diff --git a/gnome-panel/panel-recent.c b/gnome-panel/panel-recent.c
index 035924b..c7163ba 100644
--- a/gnome-panel/panel-recent.c
+++ b/gnome-panel/panel-recent.c
@@ -149,8 +149,8 @@ recent_documents_clear_cb (GtkMenuItem      *menuitem,
                                                    "\342\200\242 All items from the recent documents list in 
all applications."));
 
        gtk_dialog_add_buttons (GTK_DIALOG (clear_recent_dialog),
-                               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                               PANEL_STOCK_CLEAR, GTK_RESPONSE_ACCEPT,
+                               _("_Cancel"), GTK_RESPONSE_CANCEL,
+                               _("C_lear"), GTK_RESPONSE_ACCEPT,
                                NULL);
 
        gtk_container_set_border_width (GTK_CONTAINER (clear_recent_dialog), 6);
@@ -190,7 +190,7 @@ panel_recent_append_documents_menu (GtkWidget        *top_menu,
        setup_menu_item_with_icon (menu_item,
                                   panel_menu_icon_get_size (),
                                   PANEL_ICON_RECENT,
-                                  NULL, NULL,
+                                  NULL,
                                   _("Recent Documents"));
        recent_menu = gtk_recent_chooser_menu_new_for_manager (manager);
        gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), recent_menu);
@@ -228,8 +228,7 @@ panel_recent_append_documents_menu (GtkWidget        *top_menu,
        menu_item = gtk_image_menu_item_new ();
        setup_menu_item_with_icon (menu_item,
                                   panel_menu_icon_get_size (),
-                                  NULL,
-                                  GTK_STOCK_CLEAR, NULL,
+                                  "edit-clear", NULL,
                                   _("Clear Recent Documents..."));
        panel_util_set_tooltip_text (menu_item,
                                     _("Clear all items from the recent documents list"));
diff --git a/gnome-panel/panel-run-dialog.c b/gnome-panel/panel-run-dialog.c
index 3d4ef3f..8beb907 100644
--- a/gnome-panel/panel-run-dialog.c
+++ b/gnome-panel/panel-run-dialog.c
@@ -1293,8 +1293,8 @@ file_button_clicked (GtkButton      *button,
        chooser = gtk_file_chooser_dialog_new (_("Choose a file to append to the command..."),
                                               GTK_WINDOW (dialog->run_dialog),
                                               GTK_FILE_CHOOSER_ACTION_OPEN,
-                                              GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                              GTK_STOCK_OK, GTK_RESPONSE_OK,
+                                              _("_Cancel"), GTK_RESPONSE_CANCEL,
+                                              _("_OK"), GTK_RESPONSE_OK,
                                               NULL);
        
        gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser),
diff --git a/gnome-panel/panel-stock-icons.c b/gnome-panel/panel-stock-icons.c
index 8262672..d93b8b7 100644
--- a/gnome-panel/panel-stock-icons.c
+++ b/gnome-panel/panel-stock-icons.c
@@ -37,56 +37,10 @@ panel_menu_icon_get_size (void)
        return panel_menu_icon_size;
 }
 
-typedef struct {
-       char *stock_id;
-       char *stock_icon_id;
-       char *label;
-} PanelStockItem;
-
-static PanelStockItem stock_items [] = {
-       { PANEL_STOCK_EXECUTE,     GTK_STOCK_EXECUTE,       N_("_Run") },
-       { PANEL_STOCK_CLEAR,       GTK_STOCK_CLEAR,         N_("C_lear") },
-       { PANEL_STOCK_DONT_DELETE, GTK_STOCK_CANCEL,        N_("D_on't Delete") }
-};
-
-static void
-panel_init_stock_items (GtkIconFactory *factory)
-{
-       GtkStockItem *items;
-       int           i;
-
-       items = g_new (GtkStockItem, G_N_ELEMENTS (stock_items));
-
-       for (i = 0; i < G_N_ELEMENTS (stock_items); i++) {
-               GtkIconSet *icon_set;
-
-               items [i].stock_id           = g_strdup (stock_items [i].stock_id);
-               items [i].label              = g_strdup (stock_items [i].label);
-               items [i].modifier           = 0;
-               items [i].keyval             = 0;
-               items [i].translation_domain = g_strdup (GETTEXT_PACKAGE);
-
-               /* FIXME: does this take into account the theme? */
-               icon_set = gtk_icon_factory_lookup_default (stock_items [i].stock_icon_id);
-               gtk_icon_factory_add (factory, stock_items [i].stock_id, icon_set);
-       }
-
-       gtk_stock_add_static (items, G_N_ELEMENTS (stock_items));
-}
-
 void
 panel_init_stock_icons_and_items (void)
 {
-       GtkIconFactory *factory;
-
        panel_menu_icon_size = gtk_icon_size_register ("panel-menu",
                                                       PANEL_DEFAULT_MENU_ICON_SIZE,
                                                       PANEL_DEFAULT_MENU_ICON_SIZE);
-
-       factory = gtk_icon_factory_new ();
-       gtk_icon_factory_add_default (factory);
-
-       panel_init_stock_items (factory);
-
-       g_object_unref (factory);
 }
diff --git a/gnome-panel/panel-stock-icons.h b/gnome-panel/panel-stock-icons.h
index 499bd22..a1a0040 100644
--- a/gnome-panel/panel-stock-icons.h
+++ b/gnome-panel/panel-stock-icons.h
@@ -31,14 +31,6 @@ G_BEGIN_DECLS
 /* themeable size - "panel-menu" -- This is used for the icons in the menus */
 #define PANEL_DEFAULT_MENU_ICON_SIZE           24
 
-/* stock items  - no point in theme the icons one these,
- * they use stock gtk icons and just modify the text
- * for the stock item.
- */
-#define PANEL_STOCK_EXECUTE             "panel-execute"
-#define PANEL_STOCK_CLEAR               "panel-clear"
-#define PANEL_STOCK_DONT_DELETE         "panel-dont-delete"
-
 void        panel_init_stock_icons_and_items (void);
 GtkIconSize panel_menu_icon_get_size         (void);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]