* Fixes NB#85502, show an error when the mail applications reports error sendings...
[modest] / src / widgets / modest-account-view.c
index a634895..2f8a08a 100644 (file)
@@ -174,7 +174,6 @@ get_last_updated_string(ModestAccountMgr* account_mgr, ModestAccountSettings *se
                else
                        last_updated_string = _("mcen_va_never");
        } else  {
-               /* FIXME: There should be a logical name in the UI specs */
                last_updated_string = _("mcen_va_refreshing");
        }
        
@@ -261,6 +260,8 @@ update_account_view (ModestAccountMgr *account_mgr, ModestAccountView *view)
        if (selected_name) {
                modest_account_view_select_account (view, selected_name);
                g_free (selected_name);
+       } else {
+               modest_account_view_select_first_account (view);
        }
 }
 
@@ -327,13 +328,18 @@ on_account_removed (TnyAccountStore *account_store,
 {
        ModestAccountView *self;
        ModestAccountViewPrivate *priv;
+       gchar *selected_name;
 
        g_return_if_fail (MODEST_IS_ACCOUNT_VIEW (user_data));
 
        self = MODEST_ACCOUNT_VIEW (user_data);
        priv = MODEST_ACCOUNT_VIEW_GET_PRIVATE (self);
+
+       /* Do not refresh the view with transport accounts */
+       if (!TNY_IS_STORE_ACCOUNT (account))
+               return;
        
-       gchar *selected_name = modest_account_view_get_selected_account (self);
+       selected_name = modest_account_view_get_selected_account (self);
        if (selected_name == NULL) {
                /* we select the first account if none is selected */
                modest_account_view_select_first_account (self);                
@@ -346,25 +352,6 @@ on_account_removed (TnyAccountStore *account_store,
 
 
 static void
-on_account_changed (TnyAccountStore *account_store, 
-                   TnyAccount *account,
-                   gpointer user_data)
-{
-       ModestAccountView *self = NULL;
-       ModestAccountViewPrivate *priv = NULL;
-
-       g_return_if_fail (MODEST_IS_ACCOUNT_VIEW (user_data));
-       g_return_if_fail (account);
-       g_return_if_fail (TNY_IS_ACCOUNT (account));
-
-       self = MODEST_ACCOUNT_VIEW (user_data);
-       priv = MODEST_ACCOUNT_VIEW_GET_PRIVATE (self);
-       
-       /* Update account view */
-/*     update_account_view (priv->account_mgr, self); */
-}
-
-static void
 on_account_default_toggled (GtkCellRendererToggle *cell_renderer, 
                            gchar *path,
                            ModestAccountView *self)
@@ -492,6 +479,7 @@ init_view (ModestAccountView *self)
        column =  gtk_tree_view_column_new_with_attributes (_("mcen_ti_lastupdated"), text_renderer,"text",
                                                            MODEST_ACCOUNT_VIEW_LAST_UPDATED_COLUMN, NULL);
        gtk_tree_view_append_column (GTK_TREE_VIEW(self),column);
+       gtk_tree_view_column_set_expand (column, TRUE);
        gtk_tree_view_column_set_cell_data_func(column, text_renderer, bold_if_default_cell_data,
                                                NULL, NULL);
                        
@@ -514,12 +502,6 @@ init_view (ModestAccountView *self)
                                           self);
        priv->sig_handlers = 
                modest_signal_mgr_connect (priv->sig_handlers, 
-                                          G_OBJECT (modest_runtime_get_account_store ()),
-                                          "account_changed",
-                                          G_CALLBACK(on_account_changed), 
-                                          self);
-       priv->sig_handlers = 
-               modest_signal_mgr_connect (priv->sig_handlers, 
                                           G_OBJECT(priv->account_mgr),
                                           "account_busy_changed",
                                           G_CALLBACK(on_account_busy_changed), 
@@ -637,16 +619,14 @@ modest_account_view_select_account (ModestAccountView *account_view,
 static void
 modest_account_view_select_first_account (ModestAccountView *account_view)
 {
-       GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (account_view));
-       g_return_if_fail (model != NULL);
-
        GtkTreeIter iter;
-       gtk_tree_model_get_iter_first (model, &iter);
-
-       GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (account_view));
-       g_return_if_fail (selection != NULL);
+       GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (account_view));
 
-       gtk_tree_selection_select_iter (selection, &iter);
+       if (gtk_tree_model_get_iter_first (model, &iter)) {
+               GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (account_view));
+       
+               gtk_tree_selection_select_iter (selection, &iter);
+       }
 }
 
 static void