[simple-scan] Improve layout and behaviour of device buttons.



commit e11e8864cb6aca71876868da41c6b60d31bbed58
Author: Bartosz Kosiorek <gang65 poczta onet pl>
Date:   Sun Nov 8 13:11:34 2020 +0100

    Improve layout and behaviour of device buttons.

 src/app-window.ui   |  5 ++++-
 src/app-window.vala | 16 ++++++++++------
 2 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/src/app-window.ui b/src/app-window.ui
index 0f7ba27d..170bfbd5 100644
--- a/src/app-window.ui
+++ b/src/app-window.ui
@@ -564,6 +564,7 @@
             <child>
               <object class="GtkButton" id="scan_button">
                 <property name="visible">True</property>
+                <property name="sensitive">False</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>
@@ -794,13 +795,15 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkBox" id="device_combo_box">
+                      <object class="GtkBox" id="device_buttons_box">
                         <property name="visible">False</property>
                         <property name="can_focus">False</property>
                         <property name="orientation">horizontal</property>
+                        <property name="halign">center</property>
                         <property name="spacing">10</property>
                         <child>
                           <object class="GtkComboBox" id="device_combo">
+                            <property name="width_request">200</property>
                             <property name="visible">True</property>
                             <property name="model">device_model</property>
                             <signal name="changed" handler="device_combo_changed_cb" swapped="no"/>
diff --git a/src/app-window.vala b/src/app-window.vala
index 26373885..f651e715 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -58,7 +58,7 @@ public class AppWindow : Gtk.ApplicationWindow
     [GtkChild]
     private Gtk.ListStore device_model;
     [GtkChild]
-    private Gtk.Box device_combo_box;
+    private Gtk.Box device_buttons_box;
     [GtkChild]
     private Gtk.ComboBox device_combo;
     [GtkChild]
@@ -254,7 +254,7 @@ public class AppWindow : Gtk.ApplicationWindow
             status_primary_label.set_text (/* Label shown when searching for scanners */
                                            _("Searching for Scanners…"));
             status_secondary_label.visible = false;
-            device_combo_box.visible = false;
+            device_buttons_box.visible = false;
         }
         else if (get_selected_device () != null)
         {
@@ -263,7 +263,8 @@ public class AppWindow : Gtk.ApplicationWindow
                                            _("Ready to Scan"));
             status_secondary_label.set_text (get_selected_device_label ());
             status_secondary_label.visible = false;
-            device_combo_box.visible = true;
+            device_buttons_box.visible = true;
+            device_buttons_box.sensitive = true;
             device_combo.sensitive = true;
         }
         else if (this.missing_driver != null)
@@ -273,7 +274,7 @@ public class AppWindow : Gtk.ApplicationWindow
             /* Instructions to install driver software */
             status_secondary_label.set_markup (_("You need to <a href=\"install-firmware\">install driver 
software</a> for your scanner."));
             status_secondary_label.visible = true;
-            device_combo_box.visible = false;
+            device_buttons_box.visible = false;
         }
         else
         {
@@ -282,7 +283,9 @@ public class AppWindow : Gtk.ApplicationWindow
             /* Hint to user on why there are no scanners detected */
             status_secondary_label.set_text (_("Please check your scanner is connected and powered on"));
             status_secondary_label.visible = true;
-            device_combo_box.visible = false;
+            device_buttons_box.visible = true;
+            device_buttons_box.sensitive = true;
+            device_combo.sensitive = false; // We would like to be refresh button to be active
         }
     }
 
@@ -831,7 +834,8 @@ public class AppWindow : Gtk.ApplicationWindow
     {
         status_primary_label.set_text (/* Label shown when scan started */
                                        _("Contacting scanner…"));
-        device_combo.sensitive = false;
+        device_buttons_box.visible = true;
+        device_buttons_box.sensitive = false;
         start_scan (get_selected_device (), options);
     }
 


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