[gnome-contacts] avatar-selector: Properly catch warnings
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] avatar-selector: Properly catch warnings
- Date: Fri, 5 Jun 2020 08:39:08 +0000 (UTC)
commit e62759d15b6d72632ff7c036bab73594e1f2e789
Author: Niels De Graef <nielsdegraef gmail com>
Date: Fri Jun 5 10:12:00 2020 +0200
avatar-selector: Properly catch warnings
src/contacts-avatar-selector.vala | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/contacts-avatar-selector.vala b/src/contacts-avatar-selector.vala
index 51a5f3a..e2e9c1c 100644
--- a/src/contacts-avatar-selector.vala
+++ b/src/contacts-avatar-selector.vala
@@ -101,11 +101,19 @@ public class Contacts.AvatarSelector : Popover {
pixbuf.save_to_buffer (out buffer, "png", null);
var icon = new BytesIcon (new Bytes (buffer));
// Set the new avatar
- this.individual.change_avatar(icon as LoadableIcon);
+ this.individual.change_avatar.begin(icon as LoadableIcon, (obj, res) => {
+ try {
+ this.individual.change_avatar.end(res);
+ } catch (Error e) {
+ warning ("Failed to set avatar: %s", e.message);
+ Utils.show_error_dialog (_("Failed to set avatar."),
+ this.get_toplevel() as Gtk.Window);
+ }
+ });
} catch (GLib.Error e) {
warning ("Failed to set avatar: %s", e.message);
Utils.show_error_dialog (_("Failed to set avatar."),
- this.get_toplevel() as Gtk.Window);
+ this.get_toplevel() as Gtk.Window);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]