[gnome-contacts] Report errors when editing fails



commit a0b2cbabdb2e8e045bba7049115aa4971cc92cff
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Feb 1 12:16:21 2012 +0100

    Report errors when editing fails

 src/contacts-app.vala          |   14 ++++++++++++++
 src/contacts-contact-pane.vala |   15 +++++++++------
 2 files changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index e4f5ac6..e58b780 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -363,6 +363,20 @@ public class Contacts.App : Gtk.Application {
     }
   }
 
+  public void show_message (string message) {
+    var notification = new Gtk.Notification ();
+
+    var g = new Grid ();
+    g.set_column_spacing (8);
+    var l = new Label (message);
+    l.set_line_wrap (true);
+    l.set_line_wrap_mode (Pango.WrapMode.WORD_CHAR);
+    notification.add (l);
+
+    notification.show_all ();
+    overlay.add_overlay (notification);
+  }
+
   private void delete_contact (Contact contact) {
     var notification = new Gtk.Notification ();
 
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 31f399a..2f480d9 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -409,11 +409,8 @@ public abstract class Contacts.FieldSet : Grid {
 	    var contact = obj as Contact;
 	    contact.set_persona_property.end (result);
 	    saving = false;
-	  } catch (PropertyError e1) {
-	    warning ("Unable to edit property '%s': %s", property_name, e1.message);
-	    refresh_from_persona ();
 	  } catch (Error e2) {
-	    warning ("Unable to create writeable persona: %s", e2.message);
+	    App.app.show_message (e2.message);
 	    refresh_from_persona ();
 	  }
 						     });
@@ -1498,7 +1495,13 @@ public class Contacts.ContactPane : ScrolledWindow {
 	Value v = Value (icon.get_type ());
 	v.set_object (icon);
 	set_individual_property.begin (contact,
-				       "avatar", v, () => {
+				       "avatar", v,
+					 (obj, result) => {
+					   try {
+					     var p = set_individual_property.end (result);
+					   } catch (Error e) {
+					     App.app.show_message (e.message);
+					   }
 				       });
       });
 
@@ -1586,7 +1589,7 @@ public class Contacts.ContactPane : ScrolledWindow {
 					   try {
 					     var p = set_individual_property.end (result);
 					   } catch (Error e) {
-					     warning ("Unable to create writeable persona: %s", e.message);
+					     App.app.show_message (e.message);
 					   }
 					 });
 	}



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