[gedit] Don't use deprecated stock and image menu item API



commit 7c5a12a037eafd9819b50803eebb8ad0123cbc24
Author: Garrett Regier <garrettregier gmail com>
Date:   Sun Jun 30 08:58:02 2013 -0700

    Don't use deprecated stock and image menu item API

 gedit/gedit-close-confirmation-dialog.c         |    8 +-
 gedit/gedit-io-error-info-bar.c                 |   79 ++++++++++++-----------
 gedit/gedit-notebook-popup-menu.c               |   13 +---
 gedit/gedit-panel.c                             |   24 ++++---
 gedit/gedit-progress-info-bar.c                 |    5 ++
 gedit/gedit-statusbar.c                         |   13 ++--
 gedit/gedit-tab.c                               |    5 +-
 gedit/gedit-utils.c                             |    2 +
 plugins/filebrowser/gedit-file-browser-plugin.c |   16 +----
 plugins/filebrowser/gedit-file-browser-utils.c  |   14 ++++-
 plugins/filebrowser/gedit-file-browser-widget.c |   45 ++-----------
 11 files changed, 101 insertions(+), 123 deletions(-)
---
diff --git a/gedit/gedit-close-confirmation-dialog.c b/gedit/gedit-close-confirmation-dialog.c
index e20891b..cc10968 100644
--- a/gedit/gedit-close-confirmation-dialog.c
+++ b/gedit/gedit-close-confirmation-dialog.c
@@ -460,8 +460,8 @@ build_single_doc_dialog (GeditCloseConfirmationDialog *dlg)
        add_buttons (dlg);
 
        /* Image */
-       image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
-                                         GTK_ICON_SIZE_DIALOG);
+       image = gtk_image_new_from_icon_name ("dialog-warning",
+                                             GTK_ICON_SIZE_DIALOG);
        gtk_widget_set_halign (image, GTK_ALIGN_START);
 
        /* Primary label */
@@ -643,8 +643,8 @@ build_multiple_docs_dialog (GeditCloseConfirmationDialog *dlg)
                            hbox, TRUE, TRUE, 0);
 
        /* Image */
-       image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
-                                         GTK_ICON_SIZE_DIALOG);
+       image = gtk_image_new_from_icon_name ("dialog-warning",
+                                             GTK_ICON_SIZE_DIALOG);
        gtk_widget_set_halign (image, GTK_ALIGN_START);
        gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
 
diff --git a/gedit/gedit-io-error-info-bar.c b/gedit/gedit-io-error-info-bar.c
index 6ac7d90..89dbc0c 100644
--- a/gedit/gedit-io-error-info-bar.c
+++ b/gedit/gedit-io-error-info-bar.c
@@ -94,22 +94,22 @@ set_contents (GtkWidget *area,
 }
 
 static void
-info_bar_add_stock_button_with_text (GtkInfoBar  *info_bar,
-                                    const gchar *text,
-                                    const gchar *stock_id,
-                                    gint         response_id)
+info_bar_add_button_with_text (GtkInfoBar  *info_bar,
+                              const gchar *text,
+                              const gchar *icon_name,
+                              gint         response_id)
 {
        GtkWidget *button;
        GtkWidget *image;
 
        button = gtk_info_bar_add_button (info_bar, text, response_id);
-       image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
+       image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
        gtk_button_set_image (GTK_BUTTON (button), image);
 }
 
 static void
 set_info_bar_text_and_icon (GtkWidget   *info_bar,
-                           const gchar *icon_stock_id,
+                           const gchar *icon_name,
                            const gchar *primary_text,
                            const gchar *secondary_text)
 {
@@ -123,7 +123,7 @@ set_info_bar_text_and_icon (GtkWidget   *info_bar,
 
        hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
 
-       image = gtk_image_new_from_stock (icon_stock_id, GTK_ICON_SIZE_DIALOG);
+       image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG);
        gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
        gtk_widget_set_valign (image, GTK_ALIGN_START);
 
@@ -172,16 +172,16 @@ create_io_loading_error_info_bar (const gchar *primary_text,
                                       GTK_MESSAGE_ERROR);
 
        set_info_bar_text_and_icon (info_bar,
-                                       "gtk-dialog-error",
-                                       primary_text,
-                                       secondary_text);
+                                   "dialog-error",
+                                   primary_text,
+                                   secondary_text);
 
        if (recoverable_error)
        {
-               info_bar_add_stock_button_with_text (GTK_INFO_BAR (info_bar),
-                                                    _("_Retry"),
-                                                    GTK_STOCK_REFRESH,
-                                                    GTK_RESPONSE_OK);
+               info_bar_add_button_with_text (GTK_INFO_BAR (info_bar),
+                                              _("_Retry"),
+                                              "view-refresh",
+                                              GTK_RESPONSE_OK);
        }
 
        return info_bar;
@@ -493,10 +493,10 @@ create_conversion_error_info_bar (const gchar *primary_text,
 
        info_bar = gtk_info_bar_new ();
 
-       info_bar_add_stock_button_with_text (GTK_INFO_BAR (info_bar),
-                                            _("_Retry"),
-                                            GTK_STOCK_REDO,
-                                            GTK_RESPONSE_OK);
+       info_bar_add_button_with_text (GTK_INFO_BAR (info_bar),
+                                      _("_Retry"),
+                                      "edit-redo",
+                                      GTK_RESPONSE_OK);
 
        if (edit_anyway)
        {
@@ -520,7 +520,8 @@ create_conversion_error_info_bar (const gchar *primary_text,
 
        hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
 
-       image = gtk_image_new_from_stock ("gtk-dialog-error", GTK_ICON_SIZE_DIALOG);
+       image = gtk_image_new_from_icon_name ("dialog-error",
+                                             GTK_ICON_SIZE_DIALOG);
        gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
        gtk_widget_set_valign (image, GTK_ALIGN_START);
 
@@ -793,7 +794,8 @@ gedit_file_already_open_warning_info_bar_new (GFile *location)
 
        hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
 
-       image = gtk_image_new_from_stock ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG);
+       image = gtk_image_new_from_icon_name ("dialog-warning",
+                                             GTK_ICON_SIZE_DIALOG);
        gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
        gtk_widget_set_halign (image, GTK_ALIGN_START);
 
@@ -871,9 +873,9 @@ gedit_externally_modified_saving_error_info_bar_new (GFile        *location,
 
        info_bar = gtk_info_bar_new ();
 
-       info_bar_add_stock_button_with_text (GTK_INFO_BAR (info_bar),
+       info_bar_add_button_with_text (GTK_INFO_BAR (info_bar),
                                             _("S_ave Anyway"),
-                                            GTK_STOCK_SAVE,
+                                            _("_Save"),
                                             GTK_RESPONSE_YES);
        gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),
                                 _("D_on't Save"),
@@ -883,7 +885,8 @@ gedit_externally_modified_saving_error_info_bar_new (GFile        *location,
 
        hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
 
-       image = gtk_image_new_from_stock ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG);
+       image = gtk_image_new_from_icon_name ("dialog-warning",
+                                             GTK_ICON_SIZE_DIALOG);
        gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
        gtk_widget_set_valign (image, GTK_ALIGN_START);
 
@@ -969,10 +972,10 @@ gedit_no_backup_saving_error_info_bar_new (GFile        *location,
 
        info_bar = gtk_info_bar_new ();
 
-       info_bar_add_stock_button_with_text (GTK_INFO_BAR (info_bar),
-                                            _("S_ave Anyway"),
-                                            GTK_STOCK_SAVE,
-                                            GTK_RESPONSE_YES);
+       info_bar_add_button_with_text (GTK_INFO_BAR (info_bar),
+                                      _("S_ave Anyway"),
+                                      _("_Save"),
+                                      GTK_RESPONSE_YES);
        gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),
                                 _("D_on't Save"),
                                 GTK_RESPONSE_CANCEL);
@@ -981,7 +984,8 @@ gedit_no_backup_saving_error_info_bar_new (GFile        *location,
 
        hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
 
-       image = gtk_image_new_from_stock ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG);
+       image = gtk_image_new_from_icon_name ("dialog-warning",
+                                             GTK_ICON_SIZE_DIALOG);
        gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
        gtk_widget_set_valign (image, GTK_ALIGN_START);
 
@@ -1204,10 +1208,10 @@ gedit_externally_modified_info_bar_new (GFile    *location,
 
        info_bar = gtk_info_bar_new ();
 
-       info_bar_add_stock_button_with_text (GTK_INFO_BAR (info_bar),
-                                            _("_Reload"),
-                                            GTK_STOCK_REFRESH,
-                                            GTK_RESPONSE_OK);
+       info_bar_add_button_with_text (GTK_INFO_BAR (info_bar),
+                                      _("_Reload"),
+                                      "view-refresh",
+                                      GTK_RESPONSE_OK);
        gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),
                                 GTK_STOCK_CANCEL,
                                 GTK_RESPONSE_CANCEL);
@@ -1258,10 +1262,10 @@ gedit_invalid_character_info_bar_new (GFile *location)
 
        info_bar = gtk_info_bar_new ();
 
-       info_bar_add_stock_button_with_text (GTK_INFO_BAR (info_bar),
-                                            _("S_ave Anyway"),
-                                            GTK_STOCK_SAVE,
-                                            GTK_RESPONSE_YES);
+       info_bar_add_button_with_text (GTK_INFO_BAR (info_bar),
+                                      _("S_ave Anyway"),
+                                      _("_Save"),
+                                      GTK_RESPONSE_YES);
        gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),
                                 _("D_on't Save"),
                                 GTK_RESPONSE_CANCEL);
@@ -1270,7 +1274,8 @@ gedit_invalid_character_info_bar_new (GFile *location)
 
        hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
 
-       image = gtk_image_new_from_stock ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG);
+       image = gtk_image_new_from_icon_name ("dialog-warning",
+                                             GTK_ICON_SIZE_DIALOG);
        gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
        gtk_widget_set_valign (image, GTK_ALIGN_START);
 
diff --git a/gedit/gedit-notebook-popup-menu.c b/gedit/gedit-notebook-popup-menu.c
index bfe65ce..0e351c2 100644
--- a/gedit/gedit-notebook-popup-menu.c
+++ b/gedit/gedit-notebook-popup-menu.c
@@ -162,7 +162,6 @@ static void
 gedit_notebook_popup_menu_init (GeditNotebookPopupMenu *menu)
 {
        GtkWidget *menu_item;
-       GtkWidget *image;
 
        menu->priv = G_TYPE_INSTANCE_GET_PRIVATE (menu,
                                                  GEDIT_TYPE_NOTEBOOK_POPUP_MENU,
@@ -180,16 +179,14 @@ gedit_notebook_popup_menu_init (GeditNotebookPopupMenu *menu)
        gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
        gtk_widget_show (menu_item);
 
-       menu_item = gtk_image_menu_item_new_from_stock (GTK_STOCK_SAVE, NULL);
+       menu_item = gtk_menu_item_new_with_mnemonic (_("_Save"));
        g_signal_connect (menu_item, "activate",
                          G_CALLBACK (on_file_save_menuitem_activate),
                          menu);
        gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
        gtk_widget_show (menu_item);
 
-       menu_item = gtk_image_menu_item_new_with_mnemonic (_("Save _As..."));
-       image = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_MENU);
-       gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
+       menu_item = gtk_menu_item_new_with_mnemonic (_("Save _As..."));
        g_signal_connect (menu_item, "activate",
                          G_CALLBACK (on_file_save_as_menuitem_activate),
                          menu);
@@ -200,9 +197,7 @@ gedit_notebook_popup_menu_init (GeditNotebookPopupMenu *menu)
        gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
        gtk_widget_show (menu_item);
 
-       menu_item = gtk_image_menu_item_new_with_mnemonic (_("_Print..."));
-       image = gtk_image_new_from_stock (GTK_STOCK_PRINT, GTK_ICON_SIZE_MENU);
-       gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item), image);
+       menu_item = gtk_menu_item_new_with_mnemonic (_("_Print..."));
        g_signal_connect (menu_item, "activate",
                          G_CALLBACK (on_file_print_menuitem_activate),
                          menu);
@@ -213,7 +208,7 @@ gedit_notebook_popup_menu_init (GeditNotebookPopupMenu *menu)
        gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
        gtk_widget_show (menu_item);
 
-       menu_item = gtk_image_menu_item_new_from_stock (GTK_STOCK_CLOSE, NULL);
+       menu_item = gtk_menu_item_new_with_mnemonic (_("_Close"));
        g_signal_connect (menu_item, "activate",
                          G_CALLBACK (on_file_close_menuitem_activate),
                          menu);
diff --git a/gedit/gedit-panel.c b/gedit/gedit-panel.c
index ad26c6c..5800f09 100644
--- a/gedit/gedit-panel.c
+++ b/gedit/gedit-panel.c
@@ -346,6 +346,7 @@ set_gtk_image_from_gtk_image (GtkImage *image,
                                gtk_image_set_from_pixbuf (image, pb);
                        }
                        break;
+               G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
                case GTK_IMAGE_STOCK:
                        {
                                gchar *s_id;
@@ -364,6 +365,7 @@ set_gtk_image_from_gtk_image (GtkImage *image,
                                gtk_image_set_from_icon_set (image, is, s);
                        }
                        break;
+               G_GNUC_END_IGNORE_DEPRECATIONS;
                case GTK_IMAGE_ANIMATION:
                        {
                                GdkPixbufAnimation *a;
@@ -382,9 +384,9 @@ set_gtk_image_from_gtk_image (GtkImage *image,
                        }
                        break;
                default:
-                       gtk_image_set_from_stock (image,
-                                                 GTK_STOCK_FILE,
-                                                 GTK_ICON_SIZE_MENU);
+                       gtk_image_set_from_icon_name (image,
+                                                     "text-x-generic",
+                                                     GTK_ICON_SIZE_MENU);
        }
 }
 
@@ -408,9 +410,9 @@ sync_title (GeditPanel     *panel,
                gtk_label_set_text (GTK_LABEL (panel->priv->title_label),
                                    _("Empty"));
 
-               gtk_image_set_from_stock (GTK_IMAGE (panel->priv->title_image),
-                                         GTK_STOCK_FILE,
-                                         GTK_ICON_SIZE_MENU);
+               gtk_image_set_from_icon_name (GTK_IMAGE (panel->priv->title_image),
+                                             "text-x-generic",
+                                             GTK_ICON_SIZE_MENU);
        }
 }
 
@@ -571,8 +573,8 @@ build_vertical_panel (GeditPanel *panel)
                            TRUE,
                            0);
 
-       panel->priv->title_image = gtk_image_new_from_stock (GTK_STOCK_FILE,
-                                                            GTK_ICON_SIZE_MENU);
+       panel->priv->title_image = gtk_image_new_from_icon_name ("text-x-generic",
+                                                                GTK_ICON_SIZE_MENU);
        gtk_box_pack_start (GTK_BOX (icon_name_hbox),
                            panel->priv->title_image,
                            FALSE,
@@ -778,8 +780,8 @@ gedit_panel_add_item (GeditPanel  *panel,
        if (image == NULL)
        {
                /* default to empty */
-               data->icon = gtk_image_new_from_stock (GTK_STOCK_FILE,
-                                                      GTK_ICON_SIZE_MENU);
+               data->icon = gtk_image_new_from_icon_name ("text-x-generic",
+                                                          GTK_ICON_SIZE_MENU);
        }
        else
        {
@@ -836,8 +838,10 @@ gedit_panel_add_item_with_stock_icon (GeditPanel  *panel,
 
        if (stock_id != NULL)
        {
+               G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
                icon = gtk_image_new_from_stock (stock_id,
                                                 GTK_ICON_SIZE_MENU);
+               G_GNUC_END_IGNORE_DEPRECATIONS;
        }
 
        return gedit_panel_add_item (panel, item, id, display_name, icon);
diff --git a/gedit/gedit-progress-info-bar.c b/gedit/gedit-progress-info-bar.c
index b9f1b46..20091f9 100644
--- a/gedit/gedit-progress-info-bar.c
+++ b/gedit/gedit-progress-info-bar.c
@@ -131,7 +131,10 @@ gedit_progress_info_bar_new (const gchar *stock_id,
                                                     "has-cancel-button", has_cancel,
                                                     NULL));
 
+       G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
        gedit_progress_info_bar_set_stock_image (bar, stock_id);
+       G_GNUC_END_IGNORE_DEPRECATIONS;
+
        gedit_progress_info_bar_set_markup (bar, markup);
 
        return GTK_WIDGET (bar);
@@ -144,9 +147,11 @@ gedit_progress_info_bar_set_stock_image (GeditProgressInfoBar *bar,
        g_return_if_fail (GEDIT_IS_PROGRESS_INFO_BAR (bar));
        g_return_if_fail (stock_id != NULL);
 
+       G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
        gtk_image_set_from_stock (GTK_IMAGE (bar->priv->image),
                                  stock_id,
                                  GTK_ICON_SIZE_SMALL_TOOLBAR);
+       G_GNUC_END_IGNORE_DEPRECATIONS;
 }
 
 void
diff --git a/gedit/gedit-statusbar.c b/gedit/gedit-statusbar.c
index 494b332..3f1af50 100644
--- a/gedit/gedit-statusbar.c
+++ b/gedit/gedit-statusbar.c
@@ -133,9 +133,12 @@ gedit_statusbar_init (GeditStatusbar *statusbar)
        hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
        gtk_container_add (GTK_CONTAINER (statusbar->priv->state_frame), hbox);
 
-       statusbar->priv->load_image = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
-       statusbar->priv->save_image = gtk_image_new_from_stock (GTK_STOCK_SAVE, GTK_ICON_SIZE_MENU);
-       statusbar->priv->print_image = gtk_image_new_from_stock (GTK_STOCK_PRINT, GTK_ICON_SIZE_MENU);
+       statusbar->priv->load_image = gtk_image_new_from_icon_name ("document-open",
+                                                                   GTK_ICON_SIZE_MENU);
+       statusbar->priv->save_image = gtk_image_new_from_icon_name ("document-save",
+                                                                   GTK_ICON_SIZE_MENU);
+       statusbar->priv->print_image = gtk_image_new_from_icon_name ("document-print",
+                                                                    GTK_ICON_SIZE_MENU);
 
        gtk_widget_show (hbox);
 
@@ -157,8 +160,8 @@ gedit_statusbar_init (GeditStatusbar *statusbar)
        gtk_frame_set_shadow_type (GTK_FRAME (statusbar->priv->error_frame),
                                   GTK_SHADOW_IN);
 
-       error_image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR,
-                                               GTK_ICON_SIZE_MENU);
+       error_image = gtk_image_new_from_icon_name ("dialog-error",
+                                                   GTK_ICON_SIZE_MENU);
        gtk_misc_set_padding (GTK_MISC (error_image), 4, 0);
        gtk_widget_show (error_image);
 
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index e146f29..53da2b0 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -2083,10 +2083,7 @@ _gedit_tab_get_icon (GeditTab *tab)
        theme = gtk_icon_theme_get_for_screen (screen);
        g_return_val_if_fail (theme != NULL, NULL);
 
-       gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (GTK_WIDGET (tab)),
-                                          GTK_ICON_SIZE_MENU,
-                                          NULL,
-                                          &icon_size);
+       gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, NULL, &icon_size);
 
        switch (tab->priv->state)
        {
diff --git a/gedit/gedit-utils.c b/gedit/gedit-utils.c
index 0054da5..135878f 100644
--- a/gedit/gedit-utils.c
+++ b/gedit/gedit-utils.c
@@ -172,10 +172,12 @@ gedit_gtk_button_new_with_stock_icon (const gchar *label,
 {
        GtkWidget *button;
 
+       G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
        button = gtk_button_new_with_mnemonic (label);
        gtk_button_set_image (GTK_BUTTON (button),
                              gtk_image_new_from_stock (stock_id,
                                                        GTK_ICON_SIZE_BUTTON));
+       G_GNUC_END_IGNORE_DEPRECATIONS;
 
        return button;
 }
diff --git a/plugins/filebrowser/gedit-file-browser-plugin.c b/plugins/filebrowser/gedit-file-browser-plugin.c
index 8220c26..8c018bd 100644
--- a/plugins/filebrowser/gedit-file-browser-plugin.c
+++ b/plugins/filebrowser/gedit-file-browser-plugin.c
@@ -489,7 +489,6 @@ gedit_file_browser_plugin_activate (GeditWindowActivatable *activatable)
        GeditFileBrowserPluginPrivate *priv;
        GeditPanel *panel;
        GtkWidget *image;
-       GdkPixbuf *pixbuf;
        GeditFileBrowserStore *store;
 
        priv = plugin->priv;
@@ -530,25 +529,16 @@ gedit_file_browser_plugin_activate (GeditWindowActivatable *activatable)
                         G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
 
        panel = gedit_window_get_side_panel (priv->window);
-       pixbuf = gedit_file_browser_utils_pixbuf_from_theme ("system-file-manager",
-                                                            GTK_ICON_SIZE_MENU);
-
-       if (pixbuf)
-       {
-               image = gtk_image_new_from_pixbuf (pixbuf);
-               g_object_unref(pixbuf);
-       }
-       else
-       {
-               image = gtk_image_new_from_stock (GTK_STOCK_INDEX, GTK_ICON_SIZE_MENU);
-       }
 
+       image = gtk_image_new_from_icon_name ("system-file-mangager",
+                                             GTK_ICON_SIZE_MENU);
        gtk_widget_show (image);
        gedit_panel_add_item (panel,
                              GTK_WIDGET (priv->tree_widget),
                              "GeditFileBrowserPanel",
                              _("File Browser"),
                              image);
+
        gtk_widget_show (GTK_WIDGET (priv->tree_widget));
 
        /* Install nautilus preferences */
diff --git a/plugins/filebrowser/gedit-file-browser-utils.c b/plugins/filebrowser/gedit-file-browser-utils.c
index 9a143a1..59a862f 100644
--- a/plugins/filebrowser/gedit-file-browser-utils.c
+++ b/plugins/filebrowser/gedit-file-browser-utils.c
@@ -19,9 +19,15 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#include "gedit-file-browser-utils.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
 #include <gedit/gedit-utils.h>
 
+#include "gedit-file-browser-utils.h"
+
 static GdkPixbuf *
 process_icon_pixbuf (GdkPixbuf   *pixbuf,
                     gchar const *name,
@@ -164,7 +170,7 @@ gedit_file_browser_utils_confirmation_dialog (GeditWindow    *window,
        }
 
        /* Add a cancel button */
-       button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
+       button = gtk_button_new_with_mnemonic (_("_Cancel"));
        gtk_widget_show (button);
 
        gtk_widget_set_can_default (button, TRUE);
@@ -173,11 +179,15 @@ gedit_file_browser_utils_confirmation_dialog (GeditWindow    *window,
                                      GTK_RESPONSE_CANCEL);
 
        /* Add custom button */
+       G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
        button = gtk_button_new_from_stock (button_stock);
+       G_GNUC_END_IGNORE_DEPRECATIONS;
 
        if (button_label)
        {
+               G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
                gtk_button_set_use_stock (GTK_BUTTON (button), FALSE);
+               G_GNUC_END_IGNORE_DEPRECATIONS;
                gtk_button_set_label (GTK_BUTTON (button), button_label);
        }
 
diff --git a/plugins/filebrowser/gedit-file-browser-widget.c b/plugins/filebrowser/gedit-file-browser-widget.c
index b66d6d5..06a5d3f 100644
--- a/plugins/filebrowser/gedit-file-browser-widget.c
+++ b/plugins/filebrowser/gedit-file-browser-widget.c
@@ -616,11 +616,10 @@ get_from_bookmark_file (GeditFileBrowserWidget  *obj,
        item = (NameIcon *)data;
 
        *name = g_strdup (item->name);
-       *icon = item->icon;
 
-       if (item->icon != NULL)
+       if (icon != NULL && item->icon != NULL)
        {
-               g_object_ref (item->icon);
+               *icon = g_object_ref (item->icon);
        }
 
        return TRUE;
@@ -1387,40 +1386,20 @@ get_topmost_file (GFile *file)
 
 static GtkWidget *
 create_goto_menu_item (GeditFileBrowserWidget *obj,
-                      GList                  *item,
-                      GdkPixbuf              *icon)
+                      GList                  *item)
 {
        GtkWidget *result;
-       GtkWidget *image;
        gchar *unescape;
-       GdkPixbuf *pixbuf = NULL;
        Location *loc;
 
        loc = (Location *) (item->data);
 
-       if (!get_from_bookmark_file (obj, loc->virtual_root, &unescape, &pixbuf))
+       if (!get_from_bookmark_file (obj, loc->virtual_root, &unescape, NULL))
        {
                unescape = gedit_file_browser_utils_file_basename (loc->virtual_root);
-
-               if (icon)
-                       pixbuf = g_object_ref (icon);
        }
 
-       if (pixbuf)
-       {
-               image = gtk_image_new_from_pixbuf (pixbuf);
-               g_object_unref (pixbuf);
-
-               gtk_widget_show (image);
-
-               result = gtk_image_menu_item_new_with_label (unescape);
-               gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (result),
-                                              image);
-       }
-       else
-       {
-               result = gtk_menu_item_new_with_label (unescape);
-       }
+       result = gtk_menu_item_new_with_label (unescape);
 
        g_object_set_data (G_OBJECT (result), LOCATION_DATA_KEY, item);
        g_signal_connect (result, "activate",
@@ -2433,7 +2412,6 @@ on_virtual_root_changed (GeditFileBrowserStore  *model,
                        if (!obj->priv->changing_location)
                        {
                                Location *loc;
-                               GdkPixbuf *pixbuf;
 
                                /* Remove all items from obj->priv->current_location on */
                                if (obj->priv->current_location)
@@ -2457,24 +2435,13 @@ on_virtual_root_changed (GeditFileBrowserStore  *model,
                                    g_list_prepend (obj->priv->locations,
                                                    loc);
 
-                               gtk_tree_model_get (GTK_TREE_MODEL (model),
-                                                   &iter,
-                                                   GEDIT_FILE_BROWSER_STORE_COLUMN_ICON,
-                                                   &pixbuf, -1);
-
                                obj->priv->current_location =
                                    obj->priv->locations;
                                obj->priv->current_location_menu_item =
                                    create_goto_menu_item (obj,
-                                                          obj->priv->current_location,
-                                                          pixbuf);
+                                                          obj->priv->current_location);
 
                                g_object_ref_sink (obj->priv->current_location_menu_item);
-
-                               if (pixbuf)
-                               {
-                                       g_object_unref (pixbuf);
-                               }
                        }
 
                        action = g_simple_action_group_lookup (obj->priv->action_group,


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