[gnome-todo] todoist: add provider for inital todoist-accounts
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] todoist: add provider for inital todoist-accounts
- Date: Tue, 4 Jul 2017 13:16:12 +0000 (UTC)
commit 398a85d7d59f96a4fc82ecbebcfce022b18c25f4
Author: Rohit Kaushik <kaushikrohit325 gmail com>
Date: Wed Jun 28 17:26:46 2017 +0530
todoist: add provider for inital todoist-accounts
This patch calls gtd_plugin_todoist_account_added on
the accounts that were already present, once goa_client
is finished loading. After calling account_added,
every account is associated with a provider and
todoist provider is initalised.
This is done to make sure to load those accounts which were
already added before the goa_client was loaded.
https://bugzilla.gnome.org/show_bug.cgi?id=772278
plugins/todoist/gtd-plugin-todoist.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/plugins/todoist/gtd-plugin-todoist.c b/plugins/todoist/gtd-plugin-todoist.c
index 7f90a4d..eb487cf 100644
--- a/plugins/todoist/gtd-plugin-todoist.c
+++ b/plugins/todoist/gtd-plugin-todoist.c
@@ -174,8 +174,29 @@ goa_client_ready (GObject *source,
GtdPluginTodoist *self)
{
GoaClient *client;
+ GList *accounts;
+ GList *l;
client = goa_client_new_finish (res, NULL);
+ accounts = goa_client_get_accounts (client);
+
+ for (l = accounts; l != NULL; l = l->next)
+ {
+ GoaAccount *account;
+ const gchar *provider_type;
+
+ account = goa_object_get_account (l->data);
+ provider_type = goa_account_get_provider_type (account);
+
+ if (g_strcmp0 (provider_type, "todoist") == 0)
+ {
+ gtd_plugin_todoist_account_added (GTD_TODOIST_PREFERENCES_PANEL (self->preferences),
+ l->data,
+ self);
+ }
+
+ g_object_unref (account);
+ }
/* Connect signals */
g_signal_connect (client, "account-added", G_CALLBACK (gtd_plugin_todoist_account_added), self);
@@ -183,6 +204,8 @@ goa_client_ready (GObject *source,
g_signal_connect (client, "account-changed", G_CALLBACK (gtd_plugin_todoist_account_changed), self);
gtd_todoist_preferences_panel_set_client (GTD_TODOIST_PREFERENCES_PANEL (self->preferences), client);
+
+ g_list_free_full (accounts, g_object_unref);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]