From bec7dd15f71f20034d0495338fc5e62fd9eb53ae Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Tue, 27 Mar 2012 14:58:24 -0400
Subject: [PATCH] * #9490: cleanup

---
 gnome/src/accountlist.c                    | 11 ++++++-----
 gnome/src/actions.c                        |  5 +----
 gnome/src/actions.h                        |  3 ++-
 gnome/src/config/accountlistconfigdialog.c |  3 +--
 gnome/src/main.c                           |  1 -
 5 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/gnome/src/accountlist.c b/gnome/src/accountlist.c
index dce63a60f4..a7aca4b4ca 100644
--- a/gnome/src/accountlist.c
+++ b/gnome/src/accountlist.c
@@ -75,8 +75,7 @@ static gint get_state_struct(gconstpointer a, gconstpointer b)
 
 void account_list_init()
 {
-    if (accountQueue)
-        account_list_free();
+    account_list_free();
     accountQueue = g_queue_new();
 }
 
@@ -200,9 +199,11 @@ void account_list_free_elm(gpointer elm, gpointer data UNUSED)
 
 void account_list_free()
 {
-    g_queue_foreach(accountQueue, account_list_free_elm, NULL);
-    g_queue_free(accountQueue);
-    accountQueue = NULL;
+    if (accountQueue) {
+        g_queue_foreach(accountQueue, account_list_free_elm, NULL);
+        g_queue_free(accountQueue);
+        accountQueue = NULL;
+    }
 }
 
 void
diff --git a/gnome/src/actions.c b/gnome/src/actions.c
index 147b16bf7e..eaa8407bd6 100644
--- a/gnome/src/actions.c
+++ b/gnome/src/actions.c
@@ -57,7 +57,6 @@
 #include "actions.h"
 #include "dbus/dbus.h"
 #include "logger.h"
-#include "config/accountlistconfigdialog.h"
 #include "contacts/calltab.h"
 #include "contacts/searchbar.h"
 #include "contacts/addrbookfactory.h"
@@ -122,13 +121,12 @@ static gboolean is_direct_call(callable_obj_t * c)
 void
 status_bar_display_account()
 {
-    gchar* msg;
-
     statusbar_pop_message(__MSG_ACCOUNT_DEFAULT);
 
     account_t *acc = account_list_get_current();
     status_tray_icon_online(acc != NULL);
 
+    gchar* msg;
     if (acc) {
         msg = g_markup_printf_escaped("%s %s (%s)" ,
                                       _("Using account"),
@@ -253,7 +251,6 @@ void sflphone_fill_account_list(void)
 
     // Set the current account message number
     current_account_set_message_number(current_account_get_message_number());
-    account_store_fill();
 }
 
 gboolean sflphone_init(GError **error)
diff --git a/gnome/src/actions.h b/gnome/src/actions.h
index 2131ebd937..4c3899836a 100644
--- a/gnome/src/actions.h
+++ b/gnome/src/actions.h
@@ -172,7 +172,8 @@ void sflphone_fill_ip2ip_profile(void);
 GHashTable *sflphone_get_ip2ip_properties(void);
 
 /**
- * Initialize the accounts data structure
+ * Get a list of accounts from the daemon and load them into account_t
+ * structures.
  */
 void sflphone_fill_account_list();
 
diff --git a/gnome/src/config/accountlistconfigdialog.c b/gnome/src/config/accountlistconfigdialog.c
index 8b42d2d779..9547dd5693 100644
--- a/gnome/src/config/accountlistconfigdialog.c
+++ b/gnome/src/config/accountlistconfigdialog.c
@@ -44,7 +44,6 @@
 
 static const int CONTEXT_ID_REGISTRATION = 0;
 
-static GtkWidget *add_button;
 static GtkWidget *edit_button;
 static GtkWidget *delete_button;
 static GtkWidget *move_down_button;
@@ -516,7 +515,7 @@ create_account_list()
     g_signal_connect(G_OBJECT(move_down_button), "clicked",
                      G_CALLBACK(move_down_cb), tree_view);
 
-    add_button = gtk_button_new_from_stock(GTK_STOCK_ADD);
+    GtkWidget *add_button = gtk_button_new_from_stock(GTK_STOCK_ADD);
     g_signal_connect_swapped(G_OBJECT(add_button), "clicked",
                              G_CALLBACK(add_account_cb), NULL);
     gtk_box_pack_start(GTK_BOX(button_box), add_button, FALSE, FALSE, 0);
diff --git a/gnome/src/main.c b/gnome/src/main.c
index 8590e276f6..c6dc14ab2e 100644
--- a/gnome/src/main.c
+++ b/gnome/src/main.c
@@ -112,7 +112,6 @@ main(int argc, char *argv[])
         set_minimized(TRUE);
     }
 
-
     status_bar_display_account();
 
     sflphone_fill_history();
-- 
GitLab