[evince/wip/gpoo/visual-cue-for-unsupported-find] toolbar: Provide a visual cue when find is unsupported



commit 436b6202bab620420902c44b5084dbd4e3f64487
Author: Germán Poo-Caamaño <gpoo gnome org>
Date:   Sun Nov 11 17:44:55 2018 -0300

    toolbar: Provide a visual cue when find is unsupported
    
    When document type does not support 'find', Evince disables the
    find feature. Previously, we added a tooltip explaining the reason.
    However, a straightforward visual cue is more desirable, especially
    for touchpad users.
    
    Aside the tooltip, we now also provide an icon that mimic other
    icons in GNOME when a service is unavailable, that is, an 'x' on
    the icon for mute or wifi.
    
    Fixes #105

 data/icons/meson.build                  |  1 +
 data/icons/scalable/actions/Makefile.am |  1 +
 libview/ev-stock-icons.c                |  1 +
 libview/ev-stock-icons.h                |  1 +
 shell/ev-toolbar.c                      | 13 +++++++++++--
 5 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/data/icons/meson.build b/data/icons/meson.build
index 16c02b65..f50c7e64 100644
--- a/data/icons/meson.build
+++ b/data/icons/meson.build
@@ -60,6 +60,7 @@ icons += [['48x48', actions, [], [ev_namespace + '.png']]]
 icons += [['256x256', [], [], [ev_namespace + '.png']]]
 
 actions = [
+  'find-unsupported-symbolic.svg',
   'object-rotate-left.svg',
   'object-rotate-right.svg',
   'outline-symbolic.svg',
diff --git a/data/icons/scalable/actions/Makefile.am b/data/icons/scalable/actions/Makefile.am
index 19bba52b..338832e4 100644
--- a/data/icons/scalable/actions/Makefile.am
+++ b/data/icons/scalable/actions/Makefile.am
@@ -5,6 +5,7 @@ context = actions
 iconsdir = $(themedir)/$(size)/$(context)
 
 icons_DATA = \
+       find-unsupported-symbolic.svg   \
        object-rotate-left.svg  \
        object-rotate-right.svg \
        outline-symbolic.svg \
diff --git a/libview/ev-stock-icons.c b/libview/ev-stock-icons.c
index 2e4203f8..fa53acf4 100644
--- a/libview/ev-stock-icons.c
+++ b/libview/ev-stock-icons.c
@@ -34,6 +34,7 @@ typedef struct {
 
 /* Evince stock icons */
 static const EvStockIcon stock_icons [] = {
+       { EV_STOCK_FIND_UNSUPPORTED, "find-unsupported-symbolic" },
        { EV_STOCK_ZOOM,             "zoom" },
        { EV_STOCK_ZOOM_PAGE,        "zoom-fit-height" },
        { EV_STOCK_ZOOM_WIDTH,       "zoom-fit-width" },
diff --git a/libview/ev-stock-icons.h b/libview/ev-stock-icons.h
index 4edc7839..15f706a9 100644
--- a/libview/ev-stock-icons.h
+++ b/libview/ev-stock-icons.h
@@ -33,6 +33,7 @@
 G_BEGIN_DECLS
 
 /* Evince stock icons */
+#define EV_STOCK_FIND_UNSUPPORTED       "find-unsupported-symbolic"
 #define EV_STOCK_ZOOM                  "zoom"
 #define EV_STOCK_ZOOM_PAGE              "zoom-fit-height"
 #define EV_STOCK_ZOOM_WIDTH             "zoom-fit-width"
diff --git a/shell/ev-toolbar.c b/shell/ev-toolbar.c
index 3cfaad75..e0ffc509 100644
--- a/shell/ev-toolbar.c
+++ b/shell/ev-toolbar.c
@@ -160,12 +160,21 @@ ev_toolbar_find_button_sensitive_changed (GtkWidget  *find_button,
                                          GParamSpec *pspec,
                                          EvToolbar *ev_toolbar)
 {
-        if (gtk_widget_is_sensitive (find_button))
+        GtkWidget *image;
+
+        if (gtk_widget_is_sensitive (find_button)) {
                 gtk_widget_set_tooltip_text (find_button,
                                              _("Find a word or phrase in the document"));
-        else
+               image = gtk_image_new_from_icon_name ("edit-find-symbolic",
+                                                     GTK_ICON_SIZE_MENU);
+               gtk_button_set_image (GTK_BUTTON (find_button), image);
+       } else {
                 gtk_widget_set_tooltip_text (find_button,
                                              _("Search not available for this document"));
+               image = gtk_image_new_from_icon_name (EV_STOCK_FIND_UNSUPPORTED,
+                                                     GTK_ICON_SIZE_MENU);
+               gtk_button_set_image (GTK_BUTTON (find_button), image);
+       }
 }
 
 static void


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