[simple-scan] Redetect scanner devices after pressing Start Again...
- From: Bartosz <bkosiorek src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [simple-scan] Redetect scanner devices after pressing Start Again...
- Date: Fri, 10 Apr 2020 21:58:44 +0000 (UTC)
commit 412c52c8b6cc14e48a8bd3f11b4e2df5419a78bf
Author: Bartosz Kosiorek <gang65 poczta onet pl>
Date: Thu Apr 9 20:49:49 2020 +0200
Redetect scanner devices after pressing Start Again...
In current implementation if some devices were connected/disconnected into/from USB ports,
the redetection will be automatically triggered.
Unfortunately it is not working if new network printer will be enabled.
To resolve this the redetection will be always triggered after pressing
Start Again... button.
As a result during scanner selection the list of available devices
will be up to date.
I will also partially fix the issue: #29
src/app-window.vala | 3 +++
src/simple-scan.vala | 7 +++++++
2 files changed, 10 insertions(+)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index 91758bc..1befc73 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -188,6 +188,7 @@ public class AppWindow : Gtk.ApplicationWindow
public signal void start_scan (string? device, ScanOptions options);
public signal void stop_scan ();
+ public signal void redetect ();
public AppWindow ()
{
@@ -793,6 +794,8 @@ public class AppWindow : Gtk.ApplicationWindow
stop_scan ();
clear_document ();
+ /* Refresh list of devices to detect network scanners */
+ redetect ();
});
}
diff --git a/src/simple-scan.vala b/src/simple-scan.vala
index b1e35c7..bcc720b 100644
--- a/src/simple-scan.vala
+++ b/src/simple-scan.vala
@@ -54,6 +54,7 @@ public class SimpleScan : Gtk.Application
book = app.book;
app.start_scan.connect (scan_cb);
app.stop_scan.connect (cancel_cb);
+ app.redetect.connect (redetect_cb);
scanner = Scanner.get_instance ();
scanner.update_devices.connect (update_scan_devices_cb);
@@ -1614,6 +1615,12 @@ public class SimpleScan : Gtk.Application
scanner.cancel ();
}
+ private void redetect_cb (AppWindow ui)
+ {
+ scanner.redetect ();
+ }
+
+
private static void log_cb (string? log_domain, LogLevelFlags log_level, string message)
{
string prefix;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]