[connections/notify-connection-errors] connection, vnc: Propagate connection errors to notifications




commit aab7654c9b6c54dc1a5fb3151701f2aa7cc63c2f
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Jul 28 13:30:06 2021 +0200

    connection, vnc: Propagate connection errors to notifications
    
    This way users can have a clue of what went wrong when a connection
    fails. Notice that we already handle specific errors for some
    connection types, such as authentication errors.
    
    Fixes #57

 src/connection.vala     | 4 ++++
 src/vnc-connection.vala | 1 +
 2 files changed, 5 insertions(+)
---
diff --git a/src/connection.vala b/src/connection.vala
index 113e67b..7a6ef12 100644
--- a/src/connection.vala
+++ b/src/connection.vala
@@ -133,6 +133,10 @@ namespace Connections {
                                                                                         need_username);
         }
 
+        protected void on_connection_error_cb (string reason) {
+            Application.application.main_window.notifications_bar.display_for_error (message);
+        }
+
         protected void auth_failed (string reason) {
             disconnect_it ();
 
diff --git a/src/vnc-connection.vala b/src/vnc-connection.vala
index bce8975..ae92ed1 100644
--- a/src/vnc-connection.vala
+++ b/src/vnc-connection.vala
@@ -94,6 +94,7 @@ namespace Connections {
 
             clipboard = Gtk.Clipboard.get_default (Application.application.main_window.get_display ());
 
+            display.vnc_error.connect (on_connection_error_cb);
             display.vnc_initialized.connect (() => { show (); });
             display.vnc_auth_credential.connect (on_vnc_auth_credential_cb);
             display.vnc_auth_failure.connect (on_vnc_auth_failure_cb);


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