[simple-scan] Add spinner in stop button, remove throbber and add icon to scan button.



commit 110e3393ac12a54bba903352fe0975a1a444b576
Author: Bartosz Kosiorek <gang65 poczta onet pl>
Date:   Sat Nov 30 23:18:58 2019 +0100

    Add spinner in stop button, remove throbber and add icon to scan button.
    
    All changes are made according to design, taken from:
    
https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/document-scanner/document-scanner.png

 src/app-window.ui   | 77 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 src/app-window.vala |  4 +++
 src/page-view.vala  | 33 -----------------------
 3 files changed, 74 insertions(+), 40 deletions(-)
---
diff --git a/src/app-window.ui b/src/app-window.ui
index d1c208a..a41216b 100644
--- a/src/app-window.ui
+++ b/src/app-window.ui
@@ -382,7 +382,7 @@
                   <object class="GtkImage">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="icon_name">text-x-generic-symbolic</property>
+                    <property name="icon_name">x-office-document-symbolic</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -503,12 +503,43 @@
             <property name="valign">center</property>
             <child>
               <object class="GtkButton" id="stop_button">
-                <property name="label" translatable="yes">Stop</property>
                 <property name="can_focus">False</property>
                 <property name="receives_default">False</property>
                 <property name="tooltip_text" translatable="yes" comments="Tooltip for stop button">Stop the 
current scan</property>
                 <property name="use_underline">True</property>
                 <signal name="clicked" handler="stop_scan_button_clicked_cb" swapped="no"/>
+                <child>
+                  <object class="GtkBox">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkSpinner" id="stop_button_spinner">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="active">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">S_top</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
                 <style>
                   <class name="text-button"/>
                   <class name="destructive-action"/>
@@ -522,13 +553,45 @@
             </child>
             <child>
               <object class="GtkButton" id="scan_button">
-                <property name="label" translatable="yes" comments="Label on scan toolbar 
item">Scan</property>
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="receives_default">False</property>
                 <property name="tooltip_text" translatable="yes" comments="Tooltip for scan toolbar 
button">Scan a single page from the scanner</property>
                 <property name="use_underline">True</property>
                 <signal name="clicked" handler="scan_button_clicked_cb" swapped="no"/>
+                <child>
+                  <object class="GtkBox">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkImage" id="scan_options_image">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="icon_name">scanner-symbolic</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="margin_right">1</property>
+                        <property name="label" translatable="yes">_Scan</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
                 <style>
                   <class name="text-button"/>
                   <class name="suggested-action"/>
@@ -552,10 +615,10 @@
                     <property name="can_focus">False</property>
                     <property name="spacing">6</property>
                     <child>
-                      <object class="GtkImage">
+                      <object class="GtkImage" id="scan_hint_image">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="icon_name">pan-down-symbolic</property>
+                        <property name="icon_name">x-office-document-symbolic</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -564,10 +627,10 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkImage" id="scan_options_image">
+                      <object class="GtkImage">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="icon_name">scanner-symbolic</property>
+                        <property name="icon_name">pan-down-symbolic</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
diff --git a/src/app-window.vala b/src/app-window.vala
index 0729026..12caf9a 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -92,6 +92,8 @@ public class AppWindow : Gtk.ApplicationWindow
     [GtkChild]
     private Gtk.Image scan_options_image;
     [GtkChild]
+    private Gtk.Image scan_hint_image;
+    [GtkChild]
     private Gtk.RadioButton scan_single_radio;
     [GtkChild]
     private Gtk.RadioButton scan_adf_radio;
@@ -698,10 +700,12 @@ public class AppWindow : Gtk.ApplicationWindow
         if (document_hint == "text")
         {
             text_radio.active = true;
+            scan_hint_image.icon_name = "x-office-document-symbolic";
         }
         else if (document_hint == "photo")
         {
             photo_radio.active = true;
+            scan_hint_image.icon_name = "image-x-generic-symbolic";
         }
 
         if (save)
diff --git a/src/page-view.vala b/src/page-view.vala
index 68657cd..91a2c82 100644
--- a/src/page-view.vala
+++ b/src/page-view.vala
@@ -845,39 +845,6 @@ public class PageView : Object
         Gdk.cairo_set_source_pixbuf (context, image, 0, 0);
         context.paint ();
 
-        /* Draw throbber */
-        if (page.is_scanning && !page.has_data)
-        {
-            double outer_radius;
-            if (w > h)
-                outer_radius = 0.15 * w;
-            else
-                outer_radius = 0.15 * h;
-            var arc = Math.PI / animate_n_segments;
-
-            /* Space circles */
-            var x = outer_radius * Math.sin (arc);
-            var y = outer_radius * (Math.cos (arc) - 1.0);
-            var inner_radius = 0.6 * Math.sqrt (x*x + y*y);
-
-            double offset = 0.0;
-            for (var i = 0; i < animate_n_segments; i++, offset += arc * 2)
-            {
-                x = w / 2 + outer_radius * Math.sin (offset);
-                y = h / 2 - outer_radius * Math.cos (offset);
-                context.arc (x, y, inner_radius, 0, 2 * Math.PI);
-
-                if (i == animate_segment)
-                {
-                    context.set_source_rgb (0.75, 0.75, 0.75);
-                    context.fill_preserve ();
-                }
-
-                context.set_source_rgb (0.5, 0.5, 0.5);
-                context.stroke ();
-            }
-        }
-
         /* Draw scan line */
         if (page.is_scanning && page.scan_line > 0)
         {


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