[gnome-contacts] ContactSheet: Give user feedback on URL error



commit 85f80bb9fe3b16c3fc4a82d937b31e971c28bfe7
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sat Jan 11 06:44:55 2020 +0100

    ContactSheet: Give user feedback on URL error
    
    If something goes wrong, we give no feedback to the user whatsoever
    (unless they happen to have run Contacts from the terminal, which is
    almost never the case). Show a small notification if something goes
    wrong and add the details for us to debug later.

 src/contacts-contact-sheet.vala | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/contacts-contact-sheet.vala b/src/contacts-contact-sheet.vala
index 2315a97..0f6ebe8 100644
--- a/src/contacts-contact-sheet.vala
+++ b/src/contacts-contact-sheet.vala
@@ -231,8 +231,15 @@ public class Contacts.ContactSheet : ContactForm {
           try {
             show_uri_on_window (window, fallback_to_https (url.value), Gdk.CURRENT_TIME);
           } catch (Error e) {
-            debug ("Failed to open url");
-            print ("Error");
+            var message = "Failed to open url '%s'".printf(url.value);
+
+            // Notify the user
+            var notification = new InAppNotification (message);
+            notification.show ();
+            window.add_notification (notification);
+
+            // Print details on stdout
+            debug (message + ": " + e.message);
           }
         });
         add_row_with_label (_("Website"), url.value, button);


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