[simple-scan/gnome-3-38] Revert "Add redetect button next to device list"



commit dfe18f9f081abcc8d9c3c2e423e69af6fde9bfd7
Author: Bartosz <gang65 poczta onet pl>
Date:   Wed Nov 25 18:56:03 2020 +0000

    Revert "Add redetect button next to device list"
    
    This reverts commit 07138a0cc12f4e3ce753b5185d21c8497db8bad6

 src/app-window.ui   | 41 +++--------------------------------------
 src/app-window.vala | 21 +++++++--------------
 2 files changed, 10 insertions(+), 52 deletions(-)
---
diff --git a/src/app-window.ui b/src/app-window.ui
index 0f7ba27d..6f42a516 100644
--- a/src/app-window.ui
+++ b/src/app-window.ui
@@ -794,45 +794,10 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkBox" id="device_combo_box">
+                      <object class="GtkComboBox" id="device_combo">
                         <property name="visible">False</property>
-                        <property name="can_focus">False</property>
-                        <property name="orientation">horizontal</property>
-                        <property name="spacing">10</property>
-                        <child>
-                          <object class="GtkComboBox" id="device_combo">
-                            <property name="visible">True</property>
-                            <property name="model">device_model</property>
-                            <signal name="changed" handler="device_combo_changed_cb" swapped="no"/>
-                          </object>
-                          <packing>
-                            <property name="fill">False</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkButton" id="refresh_devices">
-                            <property name="height_request">40</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="tooltip_text" translatable="yes" comments="Tooltip for stop 
button">Refresh device list</property>
-                            <signal name="clicked" handler="redetect_button_clicked_cb" swapped="no"/>
-                            <child>
-                              <object class="GtkImage">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="icon_name">view-refresh-symbolic</property>
-                                <property name="icon_size">1</property>
-                              </object>
-                            </child>
-                            <style>
-                              <class name="image-button"/>
-                            </style>
-                          </object>
-                          <packing>
-                            <property name="fill">False</property>
-                          </packing>
-                        </child>
+                        <property name="model">device_model</property>
+                        <signal name="changed" handler="device_combo_changed_cb" swapped="no"/>
                       </object>
                     </child>
                   </object>
diff --git a/src/app-window.vala b/src/app-window.vala
index 6d025b5b..67f10a8b 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -58,8 +58,6 @@ public class AppWindow : Gtk.ApplicationWindow
     [GtkChild]
     private Gtk.ListStore device_model;
     [GtkChild]
-    private Gtk.Box device_combo_box;
-    [GtkChild]
     private Gtk.ComboBox device_combo;
     [GtkChild]
     private Gtk.Label status_secondary_label;
@@ -254,7 +252,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_combo.visible = false;
         }
         else if (get_selected_device () != null)
         {
@@ -263,7 +261,7 @@ 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_combo.visible = true;
             device_combo.sensitive = true;
         }
         else if (this.missing_driver != null)
@@ -273,7 +271,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_combo.visible = false;
         }
         else
         {
@@ -282,7 +280,7 @@ 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_combo.visible = false;
         }
     }
 
@@ -798,6 +796,9 @@ public class AppWindow : Gtk.ApplicationWindow
             if (scanning)
                 stop_scan ();
 
+            have_devices = false;
+            /* Refresh list of devices to detect network scanners, and fix issues with disconnected scanners 
*/
+            redetect ();
             clear_document ();
         });
     }
@@ -819,14 +820,6 @@ public class AppWindow : Gtk.ApplicationWindow
         new_document ();
     }
 
-    [GtkCallback]
-    private void redetect_button_clicked_cb (Gtk.Button button)
-    {
-        have_devices = false;
-        update_scan_status ();
-        redetect ();
-    }
-
     private void scan (ScanOptions options)
     {
         status_primary_label.set_text (/* Label shown when scan started */


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