[gnome-todo] todoist: fix some issues in preference panel



commit ba8970063ab9eef229c6676a5602b59a5b496fdb
Author: Rohit Kaushik <kaushikrohit325 gmail com>
Date:   Tue Jun 20 22:42:55 2017 +0530

    todoist: fix some issues in preference panel
    
    This patch fixes:
    
    1) wrongly used key while getting goa-object associated
    to accounts_listbox row.
    
    2) load inital goa-accounts after goa-client is created.
    That is call on_account_added on every account after
    calling goa_client_get_accounts for first time.
    
    3) free the accounts list returned from goa_client_get_
    accounts which earlier was leaking.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772278

 plugins/todoist/gtd-todoist-preferences-panel.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/plugins/todoist/gtd-todoist-preferences-panel.c b/plugins/todoist/gtd-todoist-preferences-panel.c
index 756da54..f1d2641 100644
--- a/plugins/todoist/gtd-todoist-preferences-panel.c
+++ b/plugins/todoist/gtd-todoist-preferences-panel.c
@@ -180,7 +180,7 @@ on_goa_account_removed (GoaClient                   *client,
     {
       GoaObject *row_account;
 
-      row_account = GOA_OBJECT (g_object_get_data (G_OBJECT (l->data), "account"));
+      row_account = GOA_OBJECT (g_object_get_data (G_OBJECT (l->data), "goa-object"));
 
       if (row_account == object)
         {
@@ -195,8 +195,19 @@ void
 gtd_todoist_preferences_panel_set_client (GtdTodoistPreferencesPanel *self,
                                           GoaClient                  *client)
 {
+  GList *accounts;
+  GList *l;
+
+  accounts = NULL;
+  l = NULL;
+
   self->client = client;
 
+  accounts = goa_client_get_accounts (self->client);
+
+  for (l = accounts; l != NULL; l = l->next)
+    on_goa_account_added (self->client, l->data, self);
+
   g_signal_connect (self->client,
                     "account-added",
                     G_CALLBACK (on_goa_account_added),
@@ -206,6 +217,8 @@ gtd_todoist_preferences_panel_set_client (GtdTodoistPreferencesPanel *self,
                     "account-removed",
                     G_CALLBACK (on_goa_account_removed),
                     self);
+
+  g_list_free_full (accounts,  g_object_unref);
 }
 
 static void


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