* modest-account-view:
[modest] / src / widgets / modest-account-view.c
index e236c69..4efea80 100644 (file)
 
 #include <glib/gi18n.h>
 #include "modest-account-view.h"
-/* include other impl specific header files */
+#include <gtk/gtkcellrenderertoggle.h>
+#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtktreeselection.h>
+#include <gtk/gtkliststore.h>
 
 /* 'private'/'protected' functions */
 static void modest_account_view_class_init    (ModestAccountViewClass *klass);
@@ -102,13 +105,6 @@ modest_account_view_class_init (ModestAccountViewClass *klass)
        gobject_class->finalize = modest_account_view_finalize;
 
        g_type_class_add_private (gobject_class, sizeof(ModestAccountViewPrivate));
-
-       /* signal definitions go here, e.g.: */
-/*     signals[MY_SIGNAL_1] = */
-/*             g_signal_new ("my_signal_1",....); */
-/*     signals[MY_SIGNAL_2] = */
-/*             g_signal_new ("my_signal_2",....); */
-/*     etc. */
 }
 
 static void
@@ -157,32 +153,38 @@ update_account_view (ModestAccountMgr *account_mgr, ModestAccountView *view)
 
        while (cursor) {
                gchar    *proto = NULL;
-               gchar    *store, *account_name;
+               gchar    *store, *account_name, *display_name;
                gboolean enabled;
 
                account_name = (gchar*)cursor->data;
                
-               store        = modest_account_mgr_get_string (account_mgr,
+               display_name = modest_account_mgr_get_string (account_mgr,
                                                              account_name,
-                                                             MODEST_ACCOUNT_STORE_ACCOUNT,
+                                                             MODEST_ACCOUNT_DISPLAY_NAME,
                                                              FALSE, NULL);
+               /* don't display accounts without stores */
                if (store) {
-
-                       proto = modest_account_mgr_get_string (account_mgr,
-                                                              store,
-                                                              MODEST_ACCOUNT_PROTO,
-                                                              TRUE, NULL);
-                       g_free(store);
-               }
-               
-               enabled = modest_account_mgr_account_get_enabled (account_mgr, account_name);
-               gtk_list_store_insert_with_values (
-                       model, NULL, 0,
-                       ENABLED_COLUMN, enabled,
-                       NAME_COLUMN,  account_name,
-                       PROTO_COLUMN, proto,
-                       -1);
+                       store = modest_account_mgr_get_string (account_mgr,
+                                                              account_name,
+                                                              MODEST_ACCOUNT_STORE_ACCOUNT,
+                                                              FALSE, NULL);
+                       if (store) {
+                               proto = modest_account_mgr_get_string (account_mgr,
+                                                                      store,
+                                                                      MODEST_ACCOUNT_PROTO,
+                                                                      TRUE, NULL);
+                               g_free(store);
+                       }
                
+                       enabled = modest_account_mgr_account_get_enabled (account_mgr, account_name);
+                       gtk_list_store_insert_with_values (
+                               model, NULL, 0,
+                               ENABLED_COLUMN, enabled,
+                               NAME_COLUMN,  display_name,
+                               PROTO_COLUMN, proto,
+                               -1);
+               }
+               g_free (display_name);
                g_free (account_name);
                g_free (proto);
                
@@ -239,12 +241,10 @@ on_account_enable_toggled (GtkCellRendererToggle *cell_renderer, gchar *path,
        g_free (account_name);
 }
 
-
 static void
 init_view (ModestAccountView *self)
 {
        ModestAccountViewPrivate *priv;
-       GtkTreeSelection *sel;
        GtkCellRenderer *renderer;
        GtkListStore *model;
        
@@ -279,8 +279,6 @@ init_view (ModestAccountView *self)
                                             gtk_cell_renderer_text_new (),
                                             "text", PROTO_COLUMN, NULL));
 
-       sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
-       
        priv->sig1 = g_signal_connect (G_OBJECT(priv->account_mgr),
                                       "account_removed",
                                       G_CALLBACK(on_account_removed), self);