[evince/wip/gpoo/fix-deprecated-symbols: 3/4] shell: Fix GtkStock deprecated symbols



commit a57dfece46eb2a27cb8d16c0b997029b62e5c06d
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Tue Nov 6 17:46:46 2018 -0300

    shell: Fix GtkStock deprecated symbols

 shell/ev-annotation-properties-dialog.c |  4 +--
 shell/ev-sidebar-annotations.c          | 49 +++++++++++++++++++++------------
 shell/ev-sidebar-bookmarks.c            |  2 +-
 shell/ev-sidebar-links.c                |  3 +-
 shell/ev-window.c                       | 24 ++++++++--------
 5 files changed, 47 insertions(+), 35 deletions(-)
---
diff --git a/shell/ev-annotation-properties-dialog.c b/shell/ev-annotation-properties-dialog.c
index 1c0e54e0..99d19553 100644
--- a/shell/ev-annotation-properties-dialog.c
+++ b/shell/ev-annotation-properties-dialog.c
@@ -153,8 +153,8 @@ ev_annotation_properties_dialog_init (EvAnnotationPropertiesDialog *annot_dialog
        gtk_window_set_destroy_with_parent (GTK_WINDOW (annot_dialog), TRUE);
        gtk_container_set_border_width (GTK_CONTAINER (annot_dialog), 5);
        gtk_dialog_add_buttons (dialog,
-                               GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
-                               GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
+                               _("_Close"), GTK_RESPONSE_CLOSE,
+                               _("_Apply"), GTK_RESPONSE_APPLY,
                                NULL);
        gtk_dialog_set_default_response (dialog, GTK_RESPONSE_APPLY);
 
diff --git a/shell/ev-sidebar-annotations.c b/shell/ev-sidebar-annotations.c
index d0c8eb81..1e7b6efb 100644
--- a/shell/ev-sidebar-annotations.c
+++ b/shell/ev-sidebar-annotations.c
@@ -81,6 +81,8 @@ G_DEFINE_TYPE_EXTENDED (EvSidebarAnnotations,
 #define EV_SIDEBAR_ANNOTATIONS_GET_PRIVATE(object) \
        (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_SIDEBAR_ANNOTATIONS, EvSidebarAnnotationsPrivate))
 
+#define ANNOT_ICON_SIZE 16
+
 static void
 ev_sidebar_annotations_dispose (GObject *object)
 {
@@ -343,6 +345,8 @@ job_finished_callback (EvJobAnnots          *job,
        GtkTreeStore *model;
        GtkTreeSelection *selection;
        GList *l;
+       GtkIconTheme *icon_theme;
+       GdkScreen *screen;
        GdkPixbuf *text_icon = NULL;
        GdkPixbuf *attachment_icon = NULL;
         GdkPixbuf *highlight_icon = NULL;
@@ -383,6 +387,9 @@ job_finished_callback (EvJobAnnots          *job,
                                    GDK_TYPE_PIXBUF,
                                    G_TYPE_POINTER);
 
+       screen = gtk_widget_get_screen (GTK_WIDGET (sidebar_annots));
+       icon_theme = gtk_icon_theme_get_for_screen (screen);
+
        for (l = job->annots; l; l = g_list_next (l)) {
                EvMappingList *mapping_list;
                GList         *ll;
@@ -423,16 +430,18 @@ job_finished_callback (EvJobAnnots          *job,
                        if (EV_IS_ANNOTATION_TEXT (annot)) {
                                if (!text_icon) {
                                        /* FIXME: use a better icon than EDIT */
-                                       text_icon = gtk_widget_render_icon_pixbuf (priv->tree_view,
-                                                                                   GTK_STOCK_EDIT,
-                                                                                   GTK_ICON_SIZE_BUTTON);
+                                       text_icon = gtk_icon_theme_load_icon (icon_theme,
+                                                                             
"accessories-text-editor-symbolic",
+                                                                             ANNOT_ICON_SIZE,
+                                                                             0, NULL);
                                }
                                pixbuf = text_icon;
                        } else if (EV_IS_ANNOTATION_ATTACHMENT (annot)) {
                                if (!attachment_icon) {
-                                       attachment_icon = gtk_widget_render_icon_pixbuf (priv->tree_view,
-                                                                                         EV_STOCK_ATTACHMENT,
-                                                                                         
GTK_ICON_SIZE_BUTTON);
+                                       attachment_icon = gtk_icon_theme_load_icon (icon_theme,
+                                                                                   
"mail-attachment-symbolic",
+                                                                                   ANNOT_ICON_SIZE,
+                                                                                   0, NULL);
                                }
                                pixbuf = attachment_icon;
                        } else if (EV_IS_ANNOTATION_TEXT_MARKUP (annot)) {
@@ -440,34 +449,38 @@ job_finished_callback (EvJobAnnots          *job,
                                 case EV_ANNOTATION_TEXT_MARKUP_HIGHLIGHT:
                                         if (!highlight_icon) {
                                                 /* FIXME: use better icon than select all */
-                                                highlight_icon = gtk_widget_render_icon_pixbuf 
(priv->tree_view,
-                                                                                                
GTK_STOCK_SELECT_ALL,
-                                                                                                
GTK_ICON_SIZE_BUTTON);
+                                               highlight_icon = gtk_icon_theme_load_icon (icon_theme,
+                                                                                          
"format-justify-left-symbolic",
+                                                                                          ANNOT_ICON_SIZE,
+                                                                                          0, NULL);
                                         }
                                         pixbuf = highlight_icon;
 
                                         break;
                                 case EV_ANNOTATION_TEXT_MARKUP_STRIKE_OUT:
                                         if (!strike_out_icon) {
-                                                strike_out_icon = gtk_widget_render_icon_pixbuf 
(priv->tree_view,
-                                                                                                 
GTK_STOCK_STRIKETHROUGH,
-                                                                                                 
GTK_ICON_SIZE_BUTTON);
+                                               strike_out_icon = gtk_icon_theme_load_icon (icon_theme,
+                                                                                           
"format-text-strikethrough-symbolic",
+                                                                                           ANNOT_ICON_SIZE,
+                                                                                           0, NULL);
                                         }
                                         pixbuf = strike_out_icon;
                                         break;
                                 case EV_ANNOTATION_TEXT_MARKUP_UNDERLINE:
                                         if (!underline_icon) {
-                                                underline_icon = gtk_widget_render_icon_pixbuf 
(priv->tree_view,
-                                                                                                
GTK_STOCK_UNDERLINE,
-                                                                                                
GTK_ICON_SIZE_BUTTON);
+                                               underline_icon = gtk_icon_theme_load_icon (icon_theme,
+                                                                                           
"format-text-underline-symbolic",
+                                                                                           ANNOT_ICON_SIZE,
+                                                                                           0, NULL);
                                         }
                                         pixbuf = underline_icon;
                                         break;
                                 case EV_ANNOTATION_TEXT_MARKUP_SQUIGGLY:
                                         if (!squiggly_icon) {
-                                                squiggly_icon = gtk_widget_render_icon_pixbuf 
(priv->tree_view,
-                                                                                               
GTK_STOCK_UNDERLINE,
-                                                                                               
GTK_ICON_SIZE_BUTTON);
+                                               squiggly_icon = gtk_icon_theme_load_icon (icon_theme,
+                                                                                           
"tools-check-spelling-symbolic",
+                                                                                           ANNOT_ICON_SIZE,
+                                                                                           0, NULL);
                                         }
                                         pixbuf = squiggly_icon;
                                         break;
diff --git a/shell/ev-sidebar-bookmarks.c b/shell/ev-sidebar-bookmarks.c
index c8bf2ff1..7fb59afb 100644
--- a/shell/ev-sidebar-bookmarks.c
+++ b/shell/ev-sidebar-bookmarks.c
@@ -147,7 +147,7 @@ ev_bookmarks_popup_cmd_remove_bookmark (GtkAction          *action,
 }
 
 static const GtkActionEntry popup_entries[] = {
-        { "OpenBookmark", GTK_STOCK_OPEN, N_("_Open Bookmark"), NULL,
+        { "OpenBookmark", NULL, N_("_Open Bookmark"), NULL,
           NULL, G_CALLBACK (ev_bookmarks_popup_cmd_open_bookmark) },
         { "RenameBookmark", NULL, N_("_Rename Bookmark"), NULL,
           NULL, G_CALLBACK (ev_bookmarks_popup_cmd_rename_bookmark) },
diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c
index afac7653..8955d19c 100644
--- a/shell/ev-sidebar-links.c
+++ b/shell/ev-sidebar-links.c
@@ -341,8 +341,7 @@ build_popup_menu (EvSidebarLinks *sidebar)
        GtkWidget *item;
 
        menu = gtk_menu_new ();
-       item = gtk_image_menu_item_new_from_stock (GTK_STOCK_PRINT, NULL);
-       gtk_label_set_label (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), _("Print…"));
+       item = gtk_label_new_with_mnemonic(_("Print…"));
        gtk_widget_show (item);
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
        g_signal_connect (item, "activate",
diff --git a/shell/ev-window.c b/shell/ev-window.c
index b6927382..47804bb7 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -2644,9 +2644,9 @@ ev_window_cmd_file_open (GSimpleAction *action,
        chooser = gtk_file_chooser_dialog_new (_("Open Document"),
                                               GTK_WINDOW (window),
                                               GTK_FILE_CHOOSER_ACTION_OPEN,
-                                              GTK_STOCK_CANCEL,
+                                              _("_Cancel"),
                                               GTK_RESPONSE_CANCEL,
-                                              GTK_STOCK_OPEN, GTK_RESPONSE_OK,
+                                              _("_Open"), GTK_RESPONSE_OK,
                                               NULL);
 
        ev_document_factory_add_filters (chooser, NULL);
@@ -2918,8 +2918,8 @@ ev_window_save_as (EvWindow *ev_window)
        fc = gtk_file_chooser_dialog_new (
                _("Save As…"),
                GTK_WINDOW (ev_window), GTK_FILE_CHOOSER_ACTION_SAVE,
-               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-               GTK_STOCK_SAVE, GTK_RESPONSE_OK,
+               _("_Cancel"), GTK_RESPONSE_CANCEL,
+               _("_Save"), GTK_RESPONSE_OK,
                NULL);
 
        ev_document_factory_add_filters (fc, ev_window->priv->document);
@@ -3651,9 +3651,9 @@ ev_window_check_document_modified (EvWindow      *ev_window,
                                                gtk_window_get_title (GTK_WINDOW (ev_window)));
                secondary_text_command = _("If you reload the document, changes will be permanently lost.");
                gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-                                       GTK_STOCK_NO,
+                                       _("_No"),
                                        GTK_RESPONSE_NO,
-                                       _("Reload"),
+                                       _("_Reload"),
                                        GTK_RESPONSE_YES,
                                        NULL);
                g_signal_connect (dialog, "response",
@@ -3666,7 +3666,7 @@ ev_window_check_document_modified (EvWindow      *ev_window,
                gtk_dialog_add_buttons (GTK_DIALOG (dialog),
                                _("Close _without Saving"),
                                GTK_RESPONSE_NO,
-                               GTK_STOCK_CANCEL,
+                               _("C_ancel"),
                                GTK_RESPONSE_CANCEL,
                                _("Save a _Copy"),
                                GTK_RESPONSE_YES,
@@ -3774,7 +3774,7 @@ ev_window_check_print_queue (EvWindow *ev_window)
        gtk_dialog_add_buttons (GTK_DIALOG (dialog),
                                _("Cancel _print and Close"),
                                GTK_RESPONSE_NO,
-                               GTK_STOCK_CANCEL,
+                               _("_Cancel"),
                                GTK_RESPONSE_CANCEL,
                                _("Close _after Printing"),
                                GTK_RESPONSE_YES,
@@ -6593,9 +6593,9 @@ ev_window_popup_cmd_save_image_as (GSimpleAction *action,
        fc = gtk_file_chooser_dialog_new (_("Save Image"),
                                          GTK_WINDOW (window),
                                          GTK_FILE_CHOOSER_ACTION_SAVE,
-                                         GTK_STOCK_CANCEL,
+                                         _("_Cancel"),
                                          GTK_RESPONSE_CANCEL,
-                                         GTK_STOCK_SAVE, GTK_RESPONSE_OK,
+                                         _("_Save"), GTK_RESPONSE_OK,
                                          NULL);
 
        gtk_dialog_set_default_response (GTK_DIALOG (fc), GTK_RESPONSE_OK);
@@ -6814,9 +6814,9 @@ ev_window_popup_cmd_save_attachment_as (GSimpleAction *action,
                _("Save Attachment"),
                GTK_WINDOW (window),
                attachment ? GTK_FILE_CHOOSER_ACTION_SAVE : GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
-               GTK_STOCK_CANCEL,
+               _("_Cancel"),
                GTK_RESPONSE_CANCEL,
-               GTK_STOCK_SAVE, GTK_RESPONSE_OK,
+               _("_Save"), GTK_RESPONSE_OK,
                NULL);
 
        gtk_dialog_set_default_response (GTK_DIALOG (fc), GTK_RESPONSE_OK);


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