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



commit bacd06ce923ef1b0ab96c9ff2566a0c72ac1542f
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 +
 .../scalable/actions/find-unsupported-symbolic.svg | 118 +++++++++++++++++++++
 libview/ev-stock-icons.c                           |   1 +
 libview/ev-stock-icons.h                           |   1 +
 shell/ev-toolbar.c                                 |  13 ++-
 6 files changed, 133 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/data/icons/scalable/actions/find-unsupported-symbolic.svg 
b/data/icons/scalable/actions/find-unsupported-symbolic.svg
new file mode 100644
index 00000000..147e44b1
--- /dev/null
+++ b/data/icons/scalable/actions/find-unsupported-symbolic.svg
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   width="16"
+   height="16"
+   version="1.1"
+   id="svg8"
+   sodipodi:docname="find-unsupported-symbolic.svg"
+   inkscape:version="0.92.3 (2405546, 2018-03-11)">
+  <metadata
+     id="metadata14">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs12" />
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1920"
+     inkscape:window-height="1016"
+     id="namedview10"
+     showgrid="false"
+     showguides="true"
+     inkscape:guide-bbox="true"
+     inkscape:zoom="55.879524"
+     inkscape:cx="5.4683307"
+     inkscape:cy="6.7834428"
+     inkscape:window-x="0"
+     inkscape:window-y="27"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="svg8">
+    <sodipodi:guide
+       position="-6.3050847,14.983051"
+       orientation="0,1"
+       id="guide4550"
+       inkscape:locked="false" />
+    <sodipodi:guide
+       position="15.050847,27.661017"
+       orientation="1,0"
+       id="guide4552"
+       inkscape:locked="false" />
+    <sodipodi:guide
+       position="3.0508475,1.0169492"
+       orientation="0,1"
+       id="guide4554"
+       inkscape:locked="false" />
+    <sodipodi:guide
+       position="1.0169492,12.474576"
+       orientation="1,0"
+       id="guide4556"
+       inkscape:locked="false" />
+    <sodipodi:guide
+       position="9.0847458,6.5084746"
+       orientation="0,1"
+       id="guide4558"
+       inkscape:locked="false" />
+    <sodipodi:guide
+       position="9.8983051,2.7118644"
+       orientation="1,0"
+       id="guide4560"
+       inkscape:locked="false" />
+    <sodipodi:guide
+       position="-0.93640564,6.023366"
+       orientation="0,1"
+       id="guide4620"
+       inkscape:locked="false" />
+    <sodipodi:guide
+       position="5.9980578,7.6684029"
+       orientation="1,0"
+       id="guide4622"
+       inkscape:locked="false" />
+    <sodipodi:guide
+       position="6.4789147,16.399753"
+       orientation="1,0"
+       id="guide4624"
+       inkscape:locked="false" />
+  </sodipodi:namedview>
+  <g
+     id="g5249">
+    <path
+       id="path2"
+       d="M 6.5078125 1 C 3.4798125 1 1.0019531 3.474 1.0019531 6.5 C 1.0019531 7.5987879 1.3314234 8.623174 
1.8925781 9.484375 L 4.6738281 9.484375 A 3.488 3.488 0 0 1 3.0019531 6.5 C 3.0019531 4.556 4.5588125 3 
6.5078125 3 A 3.488 3.488 0 0 1 10.013672 6.5 C 10.013672 8.444 8.4558125 10 6.5078125 10 A 3.488 3.488 0 0 1 
6.4609375 9.9980469 L 6.4609375 11.998047 C 6.4767243 11.998182 6.4919955 12 6.5078125 12 C 9.5358125 12 
12.013672 9.526 12.013672 6.5 C 12.013672 3.474 9.5358125 1 6.5078125 1 z "
+       
style="font-weight:400;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;white-space:normal;shape-padding:0;overflow:visible;isolation:auto;mix-blend-mode:normal;fill:#474747;fill-opacity:1"
 />
+    <path
+       d="m 10,8.99 a 1,1 0 0 0 -0.696,1.717 l 4.004,4 a 1,1 0 1 0 1.414,-1.414 l -4.003,-4 A 1,1 0 0 0 
9.999,8.99 Z"
+       overflow="visible"
+       
style="font-weight:400;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-transform:none;text-orientation:mixed;white-space:normal;shape-padding:0;overflow:visible;isolation:auto;mix-blend-mode:normal;fill:#474747;fill-opacity:1"
+       id="path4"
+       inkscape:connector-curvature="0" />
+    <path
+       sodipodi:nodetypes="ccccccccccccccccc"
+       d="M 0.99805783,9.976634 H 2.3730578 l 1.125,1.093999 1.094,-1.093999 h 1.406 v 1.468999 l 
-1.094,1.062 1.094,1.063 v 1.406 h -1.438 l -1.062,-1.063 -1.063,1.063 H 0.99805783 v -1.406 l 
1.06199997,-1.063 -1.06199997,-1.061 z"
+       overflow="visible"
+       id="path2-3"
+       inkscape:connector-curvature="0"
+       style="color:#bebebe;display:inline;overflow:visible;fill:#474747" />
+  </g>
+</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]