Commit 398a85d7 authored by Rohit Kaushik's avatar Rohit Kaushik Committed by Georges Basile Stavracas Neto
Browse files

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.
parent 4311730d
......@@ -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),
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment