[gnome-todo] provider-goa: use the account id as part of the provider id



commit 9b4f84f544da489d179a825af5a52edea9b69ad1
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Oct 3 16:50:47 2016 -0300

    provider-goa: use the account id as part of the provider id
    
    Since each GOA account is a provider, we have to be able to uniquely
    identify them. Currently, we only used the GOA's account provider name,
    which is not unique.
    
    Fix that by appending the user id as part of the provider id.

 plugins/eds/gtd-provider-goa.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/plugins/eds/gtd-provider-goa.c b/plugins/eds/gtd-provider-goa.c
index 0e6ca70..27a507a 100644
--- a/plugins/eds/gtd-provider-goa.c
+++ b/plugins/eds/gtd-provider-goa.c
@@ -27,6 +27,8 @@ struct _GtdProviderGoa
 
   GoaAccount             *account;
   GIcon                  *icon;
+
+  gchar                  *id;
 };
 
 static void          gtd_provider_iface_init                     (GtdProviderInterface *iface);
@@ -56,7 +58,7 @@ gtd_provider_goa_get_id (GtdProvider *provider)
 
   self = GTD_PROVIDER_GOA (provider);
 
-  return goa_account_get_provider_type (self->account);
+  return self->id;
 }
 
 static const gchar*
@@ -208,6 +210,11 @@ gtd_provider_goa_set_account (GtdProviderGoa *provider,
       g_set_object (&provider->icon, g_themed_icon_new (icon_name));
       g_object_notify (G_OBJECT (provider), "icon");
 
+      /* Provider id */
+      provider->id = g_strdup_printf ("%s@%s",
+                                      goa_account_get_provider_type (provider->account),
+                                      goa_account_get_id (provider->account));
+
       g_free (icon_name);
     }
 }
@@ -217,6 +224,8 @@ gtd_provider_goa_finalize (GObject *object)
 {
   GtdProviderGoa *self = (GtdProviderGoa *)object;
 
+  g_clear_pointer (&self->id, g_free);
+
   g_clear_object (&self->account);
   g_clear_object (&self->icon);
 


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