[gnome-photos] source: Add an error handler for GIcon instance



commit 59b151c7ceb844951b4b492765c8622357b17cb2
Author: Yi-Soo An <yisooan gmail com>
Date:   Mon Jul 2 14:42:35 2018 +0900

    source: Add an error handler for GIcon instance
    
    This handler provides a piece of information about an error
    in further detail.
    
    https://gitlab.gnome.org/GNOME/gnome-photos/merge_requests/41

 src/photos-source.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-source.c b/src/photos-source.c
index 4888e562..d134b664 100644
--- a/src/photos-source.c
+++ b/src/photos-source.c
@@ -324,6 +324,7 @@ photos_source_set_property (GObject *object, guint prop_id, const GValue *value,
         GoaAccount *account;
         const gchar *provider_icon;
         const gchar *provider_name;
+        const gchar *id;
 
         self->object = GOA_OBJECT (g_value_dup_object (value));
         if (self->object == NULL)
@@ -333,10 +334,19 @@ photos_source_set_property (GObject *object, guint prop_id, const GValue *value,
         g_return_if_fail (self->name == NULL);
 
         account = goa_object_peek_account (self->object);
-        self->id = g_strdup_printf ("gd:goa-account:%s", goa_account_get_id (account));
+
+        id = goa_account_get_id (account);
+        self->id = g_strdup_printf ("gd:goa-account:%s", id);
 
         provider_icon = goa_account_get_provider_icon (account);
-        self->icon = g_icon_new_for_string (provider_icon, NULL); /* TODO: use a GError */
+
+          {
+            g_autoptr (GError) error = NULL;
+
+            self->icon = g_icon_new_for_string (provider_icon, &error);
+            if (error != NULL)
+              g_critical ("Unable to generate a GIcon for %s: %s", id, error->message);
+          }
 
         provider_name = goa_account_get_provider_name (account);
         self->name = g_strdup (provider_name);


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