[latexila] Don't use gtk_image_new_from_stock() (deprecated)



commit 0868c6f30abbdf615aa15d035733e5f11391e962
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Dec 24 22:14:13 2014 +0100

    Don't use gtk_image_new_from_stock() (deprecated)

 src/bottom_panel.vala       |    2 +-
 src/clean_build_files.vala  |    2 +-
 src/dialogs.vala            |    2 +-
 src/document.vala           |    2 +-
 src/document_tab.vala       |    3 +--
 src/main_window.vala        |    2 +-
 src/preferences_dialog.vala |    2 +-
 src/project_dialogs.vala    |    4 ++--
 src/search.vala             |   16 ++++++++--------
 src/side_panel.vala         |    2 +-
 src/tab_info_bar.vala       |   16 ++++++++--------
 src/utils.vala              |    2 +-
 12 files changed, 27 insertions(+), 28 deletions(-)
---
diff --git a/src/bottom_panel.vala b/src/bottom_panel.vala
index c9af892..0e80ece 100644
--- a/src/bottom_panel.vala
+++ b/src/bottom_panel.vala
@@ -51,7 +51,7 @@ public class BottomPanel : Grid
         close_button.relief = ReliefStyle.NONE;
         close_button.focus_on_click = false;
         close_button.tooltip_text = _("Hide panel");
-        close_button.add (new Image.from_stock (Stock.CLOSE, IconSize.MENU));
+        close_button.add (new Image.from_icon_name ("window-close", IconSize.MENU));
         close_button.clicked.connect (() => this.hide ());
 
         return close_button;
diff --git a/src/clean_build_files.vala b/src/clean_build_files.vala
index 55f8f44..4df4a37 100644
--- a/src/clean_build_files.vala
+++ b/src/clean_build_files.vala
@@ -252,7 +252,7 @@ public class CleanBuildFiles : GLib.Object
         content_area.pack_start (grid);
 
         /* image */
-        Image image = new Image.from_stock (Stock.DIALOG_WARNING, IconSize.DIALOG);
+        Image image = new Image.from_icon_name ("dialog-warning", IconSize.DIALOG);
         image.set_valign (Align.START);
         grid.attach (image, 0, 0, 1, 3);
 
diff --git a/src/dialogs.vala b/src/dialogs.vala
index 11330ba..d935cda 100644
--- a/src/dialogs.vala
+++ b/src/dialogs.vala
@@ -51,7 +51,7 @@ namespace Dialogs
         content_area.pack_start (grid);
 
         /* image */
-        Image image = new Image.from_stock (Stock.DIALOG_WARNING, IconSize.DIALOG);
+        Image image = new Image.from_icon_name ("dialog-warning", IconSize.DIALOG);
         image.set_valign (Align.START);
         grid.attach (image, 0, 0, 1, 4);
 
diff --git a/src/document.vala b/src/document.vala
index 7d6f7d9..be77918 100644
--- a/src/document.vala
+++ b/src/document.vala
@@ -200,7 +200,7 @@ public class Document : Gtk.SourceBuffer
                     _("If you save it, all the external changes could be lost. Save it anyway?");
                 TabInfoBar infobar = tab.add_message (primary_msg, secondary_msg,
                     MessageType.WARNING);
-                infobar.add_stock_button_with_text (_("Save Anyway"), Stock.SAVE,
+                infobar.add_button_with_text (_("Save Anyway"), "document-save",
                     ResponseType.YES);
                 infobar.add_button (_("Don't Save"), ResponseType.CANCEL);
                 infobar.response.connect ((response_id) =>
diff --git a/src/document_tab.vala b/src/document_tab.vala
index 303dbc8..cbf3324 100644
--- a/src/document_tab.vala
+++ b/src/document_tab.vala
@@ -286,8 +286,7 @@ public class DocumentTab : Grid
 
             TabInfoBar infobar = add_message (primary_msg, secondary_msg,
                 MessageType.WARNING);
-            infobar.add_stock_button_with_text (_("Reload"), Stock.REFRESH,
-                ResponseType.OK);
+            infobar.add_button_with_text (_("Reload"), "view-refresh", ResponseType.OK);
             infobar.add_button (Stock.CANCEL, ResponseType.CANCEL);
 
             infobar.response.connect ((response_id) =>
diff --git a/src/main_window.vala b/src/main_window.vala
index 013f6d9..9e47cc6 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -901,7 +901,7 @@ public class MainWindow : Window
                 confirmation.add_button (Stock.CANCEL, ResponseType.CANCEL);
 
                 Button button_replace = new Button.with_label (_("Replace"));
-                Image icon = new Image.from_stock (Stock.SAVE_AS, IconSize.BUTTON);
+                Image icon = new Image.from_icon_name ("document-save-as", IconSize.BUTTON);
                 button_replace.set_image (icon);
                 confirmation.add_action_widget (button_replace, ResponseType.YES);
                 button_replace.show ();
diff --git a/src/preferences_dialog.vala b/src/preferences_dialog.vala
index e19aa70..227b108 100644
--- a/src/preferences_dialog.vala
+++ b/src/preferences_dialog.vala
@@ -34,7 +34,7 @@ public class PreferencesDialog : Dialog
 
         // reset all button
         Button reset_button = new Button.with_label (_("Reset All"));
-        Image image = new Image.from_stock (Stock.CLEAR, IconSize.MENU);
+        Image image = new Image.from_icon_name ("edit-clear", IconSize.MENU);
         reset_button.set_image (image);
         reset_button.set_tooltip_text (_("Reset all preferences"));
         reset_button.show_all ();
diff --git a/src/project_dialogs.vala b/src/project_dialogs.vala
index eb6e0d7..0c9ce25 100644
--- a/src/project_dialogs.vala
+++ b/src/project_dialogs.vala
@@ -241,7 +241,7 @@ namespace ProjectDialogs
         Button delete_button = new Button.from_stock (Stock.DELETE);
 
         Button clear_all_button = new Button.with_label (_("Clear All"));
-        Image image = new Image.from_stock (Stock.CLEAR, IconSize.MENU);
+        Image image = new Image.from_icon_name ("edit-clear", IconSize.MENU);
         clear_all_button.set_image (image);
 
         grid.add (edit_button);
@@ -298,7 +298,7 @@ namespace ProjectDialogs
             clear_dialog.add_button (Stock.CANCEL, ResponseType.CANCEL);
 
             Button button = new Button.with_label (_("Clear All"));
-            Image img = new Image.from_stock (Stock.CLEAR, IconSize.BUTTON);
+            Image img = new Image.from_icon_name ("edit-clear", IconSize.BUTTON);
             button.set_image (img);
             button.show_all ();
             clear_dialog.add_action_widget (button, ResponseType.YES);
diff --git a/src/search.vala b/src/search.vala
index da6f534..997b1c5 100644
--- a/src/search.vala
+++ b/src/search.vala
@@ -33,7 +33,7 @@ public class GotoLine : Grid
         Button close_button = new Button ();
         add (close_button);
         close_button.set_relief (ReliefStyle.NONE);
-        Image img = new Image.from_stock (Stock.CLOSE, IconSize.MENU);
+        Image img = new Image.from_icon_name ("window-close", IconSize.MENU);
         close_button.add (img);
         close_button.clicked.connect (() => hide ());
 
@@ -148,9 +148,9 @@ public class SearchAndReplace : GLib.Object
         find_grid.add (_entry_find);
 
         /* Buttons at the right of the find entry */
-        Button button_previous = get_button (Stock.GO_UP);
-        Button button_next = get_button (Stock.GO_DOWN);
-        Button button_close = get_button (Stock.CLOSE);
+        Button button_previous = get_button ("go-up");
+        Button button_next = get_button ("go-down");
+        Button button_close = get_button ("window-close");
 
         find_grid.add (button_previous);
         find_grid.add (button_next);
@@ -178,7 +178,7 @@ public class SearchAndReplace : GLib.Object
         _replace_grid.add (_entry_replace);
 
         /* Buttons at the right of the replace entry */
-        Button button_replace = get_button (Stock.FIND_AND_REPLACE);
+        Button button_replace = get_button ("edit-find-replace");
         button_replace.set_tooltip_text (_("Replace"));
 
         // replace all: image + label
@@ -189,7 +189,7 @@ public class SearchAndReplace : GLib.Object
         replace_all_grid.set_orientation (Orientation.HORIZONTAL);
         replace_all_grid.set_column_spacing (8);
 
-        Image image = new Image.from_stock (Stock.FIND_AND_REPLACE, IconSize.MENU);
+        Image image = new Image.from_icon_name ("edit-find-replace", IconSize.MENU);
         replace_all_grid.add (image);
 
         Label label = new Label (_("All"));
@@ -341,10 +341,10 @@ public class SearchAndReplace : GLib.Object
         });
     }
 
-    private Button get_button (string stock_id)
+    private Button get_button (string icon_name)
     {
         Button button = new Button ();
-        Image image = new Image.from_stock (stock_id, IconSize.MENU);
+        Image image = new Image.from_icon_name (icon_name, IconSize.MENU);
         button.add (image);
         button.set_relief (ReliefStyle.NONE);
         return button;
diff --git a/src/side_panel.vala b/src/side_panel.vala
index 3696c89..78b2429 100644
--- a/src/side_panel.vala
+++ b/src/side_panel.vala
@@ -83,7 +83,7 @@ public class SidePanel : Grid
         close_button.relief = ReliefStyle.NONE;
         close_button.focus_on_click = false;
         close_button.tooltip_text = _("Hide panel");
-        close_button.add (new Image.from_stock (Stock.CLOSE, IconSize.MENU));
+        close_button.add (new Image.from_icon_name ("window-close", IconSize.MENU));
 
         close_button.clicked.connect (() => this.hide ());
 
diff --git a/src/tab_info_bar.vala b/src/tab_info_bar.vala
index fd7deaa..48f8689 100644
--- a/src/tab_info_bar.vala
+++ b/src/tab_info_bar.vala
@@ -26,25 +26,25 @@ public class TabInfoBar : InfoBar
         Box content_area = get_content_area () as Box;
 
         // icon
-        string stock_id;
+        string icon_name;
         switch (msg_type)
         {
             case MessageType.ERROR:
-                stock_id = Stock.DIALOG_ERROR;
+                icon_name = "dialog-error";
                 break;
             case MessageType.QUESTION:
-                stock_id = Stock.DIALOG_QUESTION;
+                icon_name = "dialog-question";
                 break;
             case MessageType.WARNING:
-                stock_id = Stock.DIALOG_WARNING;
+                icon_name = "dialog-warning";
                 break;
             case MessageType.INFO:
             default:
-                stock_id = Stock.DIALOG_INFO;
+                icon_name = "dialog-information";
                 break;
         }
 
-        Image image = new Image.from_stock (stock_id, IconSize.DIALOG);
+        Image image = new Image.from_icon_name (icon_name, IconSize.DIALOG);
         image.set_valign (Align.START);
         content_area.pack_start (image, false, false, 0);
 
@@ -82,10 +82,10 @@ public class TabInfoBar : InfoBar
         });
     }
 
-    public void add_stock_button_with_text (string text, string stock_id, int response_id)
+    public void add_button_with_text (string text, string icon_name, int response_id)
     {
         Button button = add_button (text, response_id) as Button;
-        Image image = new Image.from_stock (stock_id, IconSize.BUTTON);
+        Image image = new Image.from_icon_name (icon_name, IconSize.BUTTON);
         button.set_image (image);
     }
 }
diff --git a/src/utils.vala b/src/utils.vala
index b010389..7c92a3b 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -327,7 +327,7 @@ namespace Utils
         dialog.add_button (Stock.CANCEL, ResponseType.CANCEL);
 
         Button button = new Button.with_label (_("Reset All"));
-        Image image = new Image.from_stock (Stock.CLEAR, IconSize.BUTTON);
+        Image image = new Image.from_icon_name ("edit-clear", IconSize.BUTTON);
         button.set_image (image);
         button.show_all ();
         dialog.add_action_widget (button, ResponseType.YES);


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