* Fixes NB#85344, do not leave the active focus in the "new" button when adding...
authorSergio Villar Senin <svillar@igalia.com>
Fri, 9 May 2008 10:37:21 +0000 (10:37 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Fri, 9 May 2008 10:37:21 +0000 (10:37 +0000)
pmo-trunk-r4509

src/maemo/modest-account-view-window.c
src/modest-account-mgr.c
src/widgets/modest-account-view.c

index cec187e..100ad77 100644 (file)
@@ -340,14 +340,22 @@ on_edit_button_clicked (GtkWidget *button, ModestAccountViewWindow *self)
 }
 
 static void
 }
 
 static void
-on_wizard_response (GtkDialog *dialog, gint response, gpointer user_data)
+on_wizard_response (GtkDialog *dialog, 
+                   gint response, 
+                   gpointer user_data)
 {      
        /* The response has already been handled by the wizard dialog itself,
         * creating the new account.
         */      
 {      
        /* The response has already been handled by the wizard dialog itself,
         * creating the new account.
         */      
-       /* Destroy the dialog: */
        if (dialog)
                gtk_widget_destroy (GTK_WIDGET (dialog));
        if (dialog)
                gtk_widget_destroy (GTK_WIDGET (dialog));
+
+       /* Re-focus the account list view widget */
+       if (MODEST_IS_ACCOUNT_VIEW_WINDOW (user_data)) {
+               ModestAccountViewWindowPrivate *priv;
+               priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE (user_data);
+               gtk_widget_grab_focus (GTK_WIDGET (priv->account_view));
+       }
 }
 
 static void
 }
 
 static void
@@ -355,7 +363,7 @@ on_new_button_clicked (GtkWidget *button, ModestAccountViewWindow *self)
 {
        GtkDialog *wizard;
        GtkWindow *dialog;
 {
        GtkDialog *wizard;
        GtkWindow *dialog;
-       
+
        /* Show the easy-setup wizard: */       
        dialog = modest_window_mgr_get_modal (modest_runtime_get_window_mgr());
        if (dialog && MODEST_IS_EASYSETUP_WIZARD_DIALOG(dialog)) {
        /* Show the easy-setup wizard: */       
        dialog = modest_window_mgr_get_modal (modest_runtime_get_window_mgr());
        if (dialog && MODEST_IS_EASYSETUP_WIZARD_DIALOG(dialog)) {
@@ -391,8 +399,6 @@ on_close_button_clicked (GtkWidget *button, gpointer user_data)
        gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
 }
 
        gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
 }
 
-
-
 static GtkWidget*
 button_box_new (ModestAccountViewWindow *self)
 {
 static GtkWidget*
 button_box_new (ModestAccountViewWindow *self)
 {
@@ -420,7 +426,7 @@ button_box_new (ModestAccountViewWindow *self)
        g_signal_connect (G_OBJECT(priv->close_button), "clicked",
                          G_CALLBACK(on_close_button_clicked),
                          self);
        g_signal_connect (G_OBJECT(priv->close_button), "clicked",
                          G_CALLBACK(on_close_button_clicked),
                          self);
-       
+
        gtk_box_pack_start (GTK_BOX(button_box), priv->new_button, FALSE, FALSE,2);
        gtk_box_pack_start (GTK_BOX(button_box), priv->edit_button, FALSE, FALSE,2);
        gtk_box_pack_start (GTK_BOX(button_box), priv->delete_button, FALSE, FALSE,2);
        gtk_box_pack_start (GTK_BOX(button_box), priv->new_button, FALSE, FALSE,2);
        gtk_box_pack_start (GTK_BOX(button_box), priv->edit_button, FALSE, FALSE,2);
        gtk_box_pack_start (GTK_BOX(button_box), priv->delete_button, FALSE, FALSE,2);
@@ -482,10 +488,16 @@ on_account_removed (ModestAccountMgr *acc_mgr,
                    const gchar *account,
                    gpointer user_data)
 {
                    const gchar *account,
                    gpointer user_data)
 {
+       ModestAccountViewWindowPrivate *priv;
+
        /* If there is no account left then close the window */
        if (!modest_account_mgr_has_accounts (acc_mgr, TRUE)) {
                gboolean ret_value;
                g_signal_emit_by_name (G_OBJECT (user_data), "delete-event", NULL, &ret_value);
        /* If there is no account left then close the window */
        if (!modest_account_mgr_has_accounts (acc_mgr, TRUE)) {
                gboolean ret_value;
                g_signal_emit_by_name (G_OBJECT (user_data), "delete-event", NULL, &ret_value);
+       } else {                
+               /* Re-focus the account list view widget */
+               priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE (user_data);
+               gtk_widget_grab_focus (GTK_WIDGET (priv->account_view));
        }
 }
 
        }
 }
 
index b1dd0d4..6c5f320 100644 (file)
@@ -1540,6 +1540,11 @@ modest_account_mgr_set_display_name (ModestAccountMgr *self,
                                     const gchar *account_name,
                                     const gchar *display_name)
 {
                                     const gchar *account_name,
                                     const gchar *display_name)
 {
+       gboolean notify = TRUE;
+
+       if (!modest_account_mgr_get_display_name (self, account_name))
+               notify = FALSE;
+
        modest_account_mgr_set_string (self, 
                                       account_name,
                                       MODEST_ACCOUNT_DISPLAY_NAME, 
        modest_account_mgr_set_string (self, 
                                       account_name,
                                       MODEST_ACCOUNT_DISPLAY_NAME, 
@@ -1547,5 +1552,6 @@ modest_account_mgr_set_display_name (ModestAccountMgr *self,
                                       FALSE /* not server account */);
 
        /* Notify about the change in the display name */
                                       FALSE /* not server account */);
 
        /* Notify about the change in the display name */
-       g_signal_emit (self, signals[DISPLAY_NAME_CHANGED_SIGNAL], 0, account_name);
+       if (notify)
+               g_signal_emit (self, signals[DISPLAY_NAME_CHANGED_SIGNAL], 0, account_name);
 }
 }
index be2c956..2f8a08a 100644 (file)
@@ -260,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);
        if (selected_name) {
                modest_account_view_select_account (view, selected_name);
                g_free (selected_name);
+       } else {
+               modest_account_view_select_first_account (view);
        }
 }
 
        }
 }
 
@@ -326,13 +328,18 @@ on_account_removed (TnyAccountStore *account_store,
 {
        ModestAccountView *self;
        ModestAccountViewPrivate *priv;
 {
        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);
 
        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);                
        if (selected_name == NULL) {
                /* we select the first account if none is selected */
                modest_account_view_select_first_account (self);