* Account settings dialog pannable has initial hint now.
[modest] / src / hildon2 / modest-default-account-settings-dialog.c
index 24b854f..857d8f6 100644 (file)
@@ -105,7 +105,6 @@ struct _ModestDefaultAccountSettingsDialogPrivate
        GtkWidget *entry_account_title;
        GtkWidget *retrieve_picker;
        GtkWidget *limit_retrieve_picker;
-       GtkWidget *caption_leave_messages;
        GtkWidget *checkbox_leave_messages;
        
        GtkWidget *page_user_details;
@@ -115,6 +114,7 @@ struct _ModestDefaultAccountSettingsDialogPrivate
        GtkWidget *entry_user_email;
 /*     GtkWidget *entry_incoming_port; */
        GtkWidget *button_signature;
+       GtkWidget *button_delete;
        
        GtkWidget *page_complete_easysetup;
        
@@ -205,7 +205,7 @@ on_modified_entry_changed (GtkEditable *editable, gpointer user_data)
 }
 
 static void
-on_modified_checkbutton_clicked (GtkButton *button, gpointer user_data)
+on_modified_checkbutton_toggled (GtkButton *button, gpointer user_data)
 {
        set_modified (MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG (user_data), TRUE);
 }
@@ -242,9 +242,9 @@ connect_for_modified (ModestDefaultAccountSettingsDialog *self, GtkWidget *widge
        } else if (HILDON_IS_PICKER_BUTTON (widget)) {
                g_signal_connect (G_OBJECT (widget), "value-changed",
                                  G_CALLBACK (on_modified_picker_changed), self);
-       } else if (GTK_IS_BUTTON (widget)) {
-               g_signal_connect (G_OBJECT (widget), "clicked",
-                       G_CALLBACK (on_modified_checkbutton_clicked), self);
+       } else if (HILDON_IS_CHECK_BUTTON (widget)) {
+               g_signal_connect (G_OBJECT (widget), "toggled",
+                       G_CALLBACK (on_modified_checkbutton_toggled), self);
        }
 }
 
@@ -258,14 +258,16 @@ on_caption_entry_changed (GtkEditable *editable, gpointer user_data)
 
 static GtkWidget* 
 create_captioned (ModestDefaultAccountSettingsDialog *self,
-                 GtkSizeGroup *group,
+                 GtkSizeGroup *title_sizegroup,
+                 GtkSizeGroup *value_sizegroup,
                  const gchar *label_text,
                  GtkWidget *control)
 {
 
        GtkWidget *result;
 
-       result = modest_maemo_utils_create_captioned (group, label_text, control);
+       result = modest_maemo_utils_create_captioned (title_sizegroup, value_sizegroup,
+                                                     label_text, control);
 
        /* Connect to the appropriate changed signal for the widget, 
         * so we can ask for the prev/next buttons to be enabled/disabled appropriately:
@@ -320,18 +322,22 @@ create_page_account_details (ModestDefaultAccountSettingsDialog *self)
 {
        ModestDefaultAccountSettingsDialogPrivate *priv;
        GtkWidget *box;
-       GtkSizeGroup* sizegroup;
+       GtkSizeGroup* title_sizegroup;
+       GtkSizeGroup* value_sizegroup;
+       GtkWidget *hbox;
 
        priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
        box = gtk_vbox_new (FALSE, MODEST_MARGIN_NONE);
-       sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+       title_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+       value_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
            
        /* The description widgets: */  
        priv->entry_account_title = GTK_WIDGET (modest_validating_entry_new ());
        /* Do use auto-capitalization: */
        hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_account_title), 
                HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_AUTOCAP);
-       GtkWidget *caption = create_captioned (self, sizegroup, _("mcen_fi_account_title"), 
+       GtkWidget *caption = create_captioned (self, title_sizegroup, value_sizegroup,
+                                              _("mcen_fi_account_title"), 
                                               priv->entry_account_title);
        gtk_widget_show (priv->entry_account_title);
        connect_for_modified (self, priv->entry_account_title);
@@ -362,39 +368,44 @@ create_page_account_details (ModestDefaultAccountSettingsDialog *self)
        gtk_entry_set_max_length (GTK_ENTRY (priv->entry_account_title), 64);
        modest_validating_entry_set_max_func (MODEST_VALIDATING_ENTRY (priv->entry_account_title), 
                on_entry_max, self);
-       
+
+       hbox = gtk_hbox_new (TRUE, 0);
        /* The retrieve picker: */
        priv->retrieve_picker = GTK_WIDGET (modest_retrieve_picker_new (MODEST_EDITABLE_SIZE,
-                                                                       MODEST_EDITABLE_ARRANGEMENT));
-       modest_maemo_utils_create_picker_layout (sizegroup, _("mcen_fi_advsetup_retrievetype"), priv->retrieve_picker);
+                                                                       HILDON_BUTTON_ARRANGEMENT_VERTICAL));
+       modest_maemo_utils_set_vbutton_layout (title_sizegroup, 
+                                              _("mcen_fi_advsetup_retrievetype"), priv->retrieve_picker);
        
        gtk_widget_show (priv->retrieve_picker);
        connect_for_modified (self, priv->retrieve_picker);
-       gtk_box_pack_start (GTK_BOX (box), priv->retrieve_picker, FALSE, FALSE, MODEST_MARGIN_HALF);
+       gtk_box_pack_start (GTK_BOX (hbox), priv->retrieve_picker, TRUE, TRUE, MODEST_MARGIN_HALF);
        
        /* The limit-retrieve picker: */
        priv->limit_retrieve_picker = GTK_WIDGET (modest_limit_retrieve_picker_new (MODEST_EDITABLE_SIZE,
-                                                                                   MODEST_EDITABLE_ARRANGEMENT));
-       modest_maemo_utils_create_picker_layout (sizegroup, _("mcen_fi_advsetup_limit_retrieve"), priv->limit_retrieve_picker);
+                                                                                   HILDON_BUTTON_ARRANGEMENT_VERTICAL));
+       modest_maemo_utils_set_vbutton_layout (value_sizegroup, 
+                                              _("mcen_fi_advsetup_limit_retrieve"), 
+                                              priv->limit_retrieve_picker);
        gtk_widget_show (priv->limit_retrieve_picker);
        connect_for_modified (self, priv->limit_retrieve_picker);
-       gtk_box_pack_start (GTK_BOX (box), priv->limit_retrieve_picker, FALSE, FALSE, MODEST_MARGIN_HALF);
+       gtk_box_pack_start (GTK_BOX (hbox), priv->limit_retrieve_picker, TRUE, TRUE, MODEST_MARGIN_HALF);
+       gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, MODEST_MARGIN_HALF);
+       gtk_widget_show (hbox);
 
        /* The leave-messages widgets: */
-       if(!priv->checkbox_leave_messages)
-               priv->checkbox_leave_messages = gtk_check_button_new ();
-       if (!priv->caption_leave_messages) {
-               priv->caption_leave_messages = 
-                       create_captioned (self, sizegroup, _("mcen_fi_advsetup_leave_on_server"), 
-                                         priv->checkbox_leave_messages);
+       if(!priv->checkbox_leave_messages) {
+               priv->checkbox_leave_messages = 
+                       hildon_check_button_new (HILDON_SIZE_FINGER_HEIGHT);
+               gtk_button_set_label (GTK_BUTTON (priv->checkbox_leave_messages),
+                                     _("mcen_fi_advsetup_leave_on_server"));
+               gtk_button_set_alignment (GTK_BUTTON (priv->checkbox_leave_messages), 0.0, 0.5);
        }
-                       
-       gtk_widget_show (priv->checkbox_leave_messages);
        connect_for_modified (self, priv->checkbox_leave_messages);
-       gtk_box_pack_start (GTK_BOX (box), priv->caption_leave_messages, FALSE, FALSE, MODEST_MARGIN_HALF);
-       gtk_widget_show (priv->caption_leave_messages);
+       gtk_box_pack_start (GTK_BOX (box), priv->checkbox_leave_messages, FALSE, FALSE, MODEST_MARGIN_HALF);
+       gtk_widget_show (priv->checkbox_leave_messages);
 
-       g_object_unref (sizegroup);
+       g_object_unref (title_sizegroup);
+       g_object_unref (value_sizegroup);
        
        gtk_widget_show (GTK_WIDGET (box));
        
@@ -458,7 +469,7 @@ on_button_signature (GtkButton *button, gpointer user_data)
 
        /* Show the window: */  
        modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
-                                    GTK_WINDOW (priv->signature_dialog));
+                                    GTK_WINDOW (priv->signature_dialog), GTK_WINDOW (self));
 
        response = gtk_dialog_run (GTK_DIALOG (priv->signature_dialog));
        gtk_widget_hide (priv->signature_dialog);
@@ -472,17 +483,75 @@ on_button_signature (GtkButton *button, gpointer user_data)
        }
 }
 
+static void
+on_button_delete (GtkButton *button, gpointer user_data)
+{
+       ModestDefaultAccountSettingsDialog *self;
+       ModestDefaultAccountSettingsDialogPrivate *priv;
+       ModestAccountMgr *account_mgr;
+       gchar *account_title = NULL;
+
+       self = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG (user_data);
+       priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
+
+       account_mgr = modest_runtime_get_account_mgr(); 
+       if(!priv->account_name)
+               return;
+
+       account_title = get_entered_account_title (self);
+       
+       /* The warning text depends on the account type: */
+       gchar *txt = NULL;      
+       gint response;
+       ModestProtocol *protocol;
+
+       protocol = modest_protocol_registry_get_protocol_by_type (
+               modest_runtime_get_protocol_registry (),
+               modest_account_mgr_get_store_protocol (account_mgr, priv->account_name));
+       txt = modest_protocol_get_translation (protocol, 
+                                              MODEST_PROTOCOL_TRANSLATION_DELETE_MAILBOX, 
+                                              account_title);
+       if (txt == NULL) {
+               txt = g_strdup_printf (_("emev_nc_delete_mailbox"), 
+                                      account_title);
+       }
+               
+       response = modest_platform_run_confirmation_dialog (GTK_WINDOW (self), txt);
+       g_free (txt);
+       txt = NULL;
+               
+       if (response == GTK_RESPONSE_OK) {
+               /* Remove account. If it succeeds then it also removes
+                  the account from the ModestAccountView: */                             
+               gboolean is_default = FALSE;
+               gchar *default_account_name = modest_account_mgr_get_default_account (account_mgr);
+               if (default_account_name && (strcmp (default_account_name, priv->account_name) == 0))
+                       is_default = TRUE;
+               g_free (default_account_name);
+               
+               gboolean removed = modest_account_mgr_remove_account (account_mgr, priv->account_name);
+               if (!removed) {
+                       g_warning ("%s: modest_account_mgr_remove_account() failed.\n", __FUNCTION__);
+               }
+               gtk_widget_destroy (GTK_WIDGET (self));
+       }
+       g_free (account_title);
+       
+}
+
 static GtkWidget*
 create_page_user_details (ModestDefaultAccountSettingsDialog *self)
 {
        ModestDefaultAccountSettingsDialogPrivate *priv;
        GtkWidget *box;
-       GtkSizeGroup* sizegroup;
+       GtkSizeGroup* title_sizegroup;
+       GtkSizeGroup* value_sizegroup;
 
        priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
 
        box = gtk_vbox_new (FALSE, MODEST_MARGIN_NONE);
-       sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+       title_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+       value_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
         
        /* The name widgets: */
        priv->entry_user_name = GTK_WIDGET (modest_validating_entry_new ());
@@ -495,7 +564,7 @@ create_page_user_details (ModestDefaultAccountSettingsDialog *self)
        modest_validating_entry_set_max_func (MODEST_VALIDATING_ENTRY (priv->entry_user_name), 
                on_entry_max, self);
        GtkWidget *caption = 
-               create_captioned (self, sizegroup, 
+               create_captioned (self, title_sizegroup, value_sizegroup,
                                  _("mcen_li_emailsetup_name"), priv->entry_user_name);
        gtk_widget_show (priv->entry_user_name);
        connect_for_modified (self, priv->entry_user_name);
@@ -518,7 +587,8 @@ create_page_user_details (ModestDefaultAccountSettingsDialog *self)
        priv->entry_user_username = GTK_WIDGET (modest_validating_entry_new ());
        /* Auto-capitalization is the default, so let's turn it off: */
        hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_user_username), HILDON_GTK_INPUT_MODE_FULL);
-       caption = create_captioned (self, sizegroup, _("mail_fi_username"), 
+       caption = create_captioned (self, title_sizegroup, value_sizegroup,
+                                   _("mail_fi_username"), 
                                    priv->entry_user_username);
        gtk_widget_show (priv->entry_user_username);
        connect_for_modified (self, priv->entry_user_username);
@@ -546,7 +616,7 @@ create_page_user_details (ModestDefaultAccountSettingsDialog *self)
                HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE);
        gtk_entry_set_visibility (GTK_ENTRY (priv->entry_user_password), FALSE);
        /* gtk_entry_set_invisible_char (GTK_ENTRY (priv->entry_user_password), '*'); */
-       caption = create_captioned (self, sizegroup, 
+       caption = create_captioned (self, title_sizegroup, value_sizegroup,
                                    _("mail_fi_password"), priv->entry_user_password);
        gtk_widget_show (priv->entry_user_password);
        connect_for_modified (self, priv->entry_user_password);
@@ -557,7 +627,7 @@ create_page_user_details (ModestDefaultAccountSettingsDialog *self)
        priv->entry_user_email = GTK_WIDGET (modest_validating_entry_new ());
        /* Auto-capitalization is the default, so let's turn it off: */
        hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_user_email), HILDON_GTK_INPUT_MODE_FULL);
-       caption = create_captioned (self, sizegroup, 
+       caption = create_captioned (self, title_sizegroup, value_sizegroup,
                                    _("mcen_li_emailsetup_email_address"), priv->entry_user_email);
        gtk_entry_set_text (GTK_ENTRY (priv->entry_user_email), MODEST_EXAMPLE_EMAIL_ADDRESS); /* Default text. */
        gtk_widget_show (priv->entry_user_email);
@@ -571,19 +641,28 @@ create_page_user_details (ModestDefaultAccountSettingsDialog *self)
        modest_validating_entry_set_max_func (MODEST_VALIDATING_ENTRY (priv->entry_user_email), 
                on_entry_max, self);
        
+       /* Delete button: */
+       if (!priv->button_delete)
+               priv->button_delete = gtk_button_new_with_label (_("mcen_bd_delete"));
+       gtk_box_pack_start (GTK_BOX (GTK_DIALOG (self)->action_area), priv->button_delete, 
+                           FALSE, FALSE, 0);
+
        /* Signature button: */
        if (!priv->button_signature)
-               priv->button_signature = gtk_button_new_with_label (_("mcen_bd_edit"));
-       caption = create_captioned (self, sizegroup, _("mcen_fi_email_signature"), priv->button_signature);
+               priv->button_signature = gtk_button_new_with_label (_("mcen_fi_email_signature"));
+       gtk_box_pack_start (GTK_BOX (GTK_DIALOG (self)->action_area), priv->button_signature, 
+                           FALSE, FALSE, 0);
        gtk_widget_show (priv->button_signature);
-       gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, MODEST_MARGIN_HALF);
-       gtk_widget_show (caption);
 
-       g_object_unref (sizegroup);
+       g_object_unref (title_sizegroup);
+       g_object_unref (value_sizegroup);
                
        g_signal_connect (G_OBJECT (priv->button_signature), "clicked",
                G_CALLBACK (on_button_signature), self);
                
+       g_signal_connect (G_OBJECT (priv->button_delete), "clicked",
+               G_CALLBACK (on_button_delete), self);
+               
        gtk_widget_show (GTK_WIDGET (box));
 
        return GTK_WIDGET (box);
@@ -623,7 +702,8 @@ create_page_incoming (ModestDefaultAccountSettingsDialog *self)
 {
        ModestDefaultAccountSettingsDialogPrivate *priv;
        GtkWidget *box;
-       GtkSizeGroup *sizegroup;
+       GtkSizeGroup *title_sizegroup;
+       GtkSizeGroup *value_sizegroup;
 
        priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
 
@@ -631,7 +711,8 @@ create_page_incoming (ModestDefaultAccountSettingsDialog *self)
        /* Create a size group to be used by all captions.
         * Note that HildonCaption does not create a default size group if we do not specify one.
         * We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
-       sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+       title_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+       value_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
         
        /* The incoming server widgets: */
        if(!priv->entry_incomingserver)
@@ -645,7 +726,7 @@ create_page_incoming (ModestDefaultAccountSettingsDialog *self)
        /* The caption title will be updated in update_incoming_server_title().
         * so this default text will never be seen: */
        /* (Note: Changing the title seems pointless. murrayc) */
-       priv->caption_incoming = create_captioned (self, sizegroup, 
+       priv->caption_incoming = create_captioned (self, title_sizegroup, value_sizegroup,
                                                   "Incoming Server", priv->entry_incomingserver);
        gtk_widget_show (priv->entry_incomingserver);
        connect_for_modified (self, priv->entry_incomingserver);
@@ -655,13 +736,14 @@ create_page_incoming (ModestDefaultAccountSettingsDialog *self)
        /* Incoming security widgets */
        priv->incoming_security = 
                modest_maemo_security_options_view_new (MODEST_SECURITY_OPTIONS_INCOMING,
-                                                       TRUE, sizegroup);
+                                                       TRUE, title_sizegroup, value_sizegroup);
        gtk_box_pack_start (GTK_BOX (box), priv->incoming_security, 
                            FALSE, FALSE, MODEST_MARGIN_HALF);
 
        gtk_widget_show (priv->incoming_security);
 
-       g_object_unref (sizegroup);     
+       g_object_unref (title_sizegroup);       
+       g_object_unref (value_sizegroup);       
        gtk_widget_show (GTK_WIDGET (box));
        
        return GTK_WIDGET (box);
@@ -673,7 +755,7 @@ on_check_button_clicked (GtkButton *button, gpointer user_data)
        GtkWidget *widget = GTK_WIDGET (user_data);
        
        /* Enable the widget only if the check button is active: */
-       const gboolean enable = hildon_check_button_get_active (button);
+       const gboolean enable = hildon_check_button_get_active (HILDON_CHECK_BUTTON (button));
        gtk_widget_set_sensitive (widget, enable);
 }
 
@@ -703,7 +785,7 @@ on_button_outgoing_smtp_servers (GtkButton *button, gpointer user_data)
        modest_connection_specific_smtp_window_fill_with_connections (smtp_win, priv->account_manager);
 
        /* Show the window: */  
-       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (smtp_win));
+       modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (smtp_win), GTK_WINDOW (self));
        gtk_widget_show (GTK_WIDGET (smtp_win));
        priv->modified = TRUE;
 }
@@ -730,7 +812,8 @@ create_page_outgoing (ModestDefaultAccountSettingsDialog *self)
        /* Create a size group to be used by all captions.
         * Note that HildonCaption does not create a default size group if we do not specify one.
         * We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
-       GtkSizeGroup *sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+       GtkSizeGroup *title_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+       GtkSizeGroup *value_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
         
        /* The outgoing server widgets: */
        if (!priv->entry_outgoingserver)
@@ -738,7 +821,7 @@ create_page_outgoing (ModestDefaultAccountSettingsDialog *self)
                        hildon_entry_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
        /* Auto-capitalization is the default, so let's turn it off: */
        hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_outgoingserver), HILDON_GTK_INPUT_MODE_FULL);
-       GtkWidget *caption = create_captioned (self, sizegroup, 
+       GtkWidget *caption = create_captioned (self, title_sizegroup, value_sizegroup,
                                               _("mcen_li_emailsetup_smtp"), priv->entry_outgoingserver);
        gtk_widget_show (priv->entry_outgoingserver);
        connect_for_modified (self, priv->entry_outgoingserver);
@@ -748,7 +831,7 @@ create_page_outgoing (ModestDefaultAccountSettingsDialog *self)
        /* Outgoing security widgets */
        priv->outgoing_security = 
                modest_maemo_security_options_view_new (MODEST_SECURITY_OPTIONS_OUTGOING,
-                                                       TRUE, sizegroup);
+                                                       TRUE, title_sizegroup, value_sizegroup);
        gtk_box_pack_start (GTK_BOX (box), priv->outgoing_security, 
                            FALSE, FALSE, MODEST_MARGIN_HALF);
        gtk_widget_show (priv->outgoing_security);
@@ -762,30 +845,31 @@ create_page_outgoing (ModestDefaultAccountSettingsDialog *self)
        /* connection-specific checkbox: */
        if (!priv->checkbox_outgoing_smtp_specific) {
                priv->checkbox_outgoing_smtp_specific = hildon_check_button_new (MODEST_EDITABLE_SIZE);
-               hildon_check_button_set_active (GTK_BUTTON (priv->checkbox_outgoing_smtp_specific), 
+               hildon_check_button_set_active (HILDON_CHECK_BUTTON (priv->checkbox_outgoing_smtp_specific), 
                        FALSE);
+               gtk_button_set_label (GTK_BUTTON (priv->checkbox_outgoing_smtp_specific),
+                                     _("mcen_fi_advsetup_connection_smtp"));
+               gtk_button_set_alignment (GTK_BUTTON (priv->checkbox_outgoing_smtp_specific), 0.0, 0.5);
        }
-       caption = create_captioned (self, sizegroup, _("mcen_fi_advsetup_connection_smtp"), 
-                                   priv->checkbox_outgoing_smtp_specific);
        gtk_widget_show (priv->checkbox_outgoing_smtp_specific);
-       gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, MODEST_MARGIN_HALF);
-       gtk_widget_show (caption);
+       gtk_box_pack_start (GTK_BOX (box), priv->checkbox_outgoing_smtp_specific, 
+                           FALSE, FALSE, MODEST_MARGIN_HALF);
        connect_for_modified (self, priv->checkbox_outgoing_smtp_specific);
        
        /* Connection-specific SMTP-Severs Edit button: */
        if (!priv->button_outgoing_smtp_servers)
-               priv->button_outgoing_smtp_servers = gtk_button_new_with_label (_("mcen_bd_edit"));
-       caption = create_captioned (self, sizegroup, _("mcen_fi_advsetup_optional_smtp"), 
-                                   priv->button_outgoing_smtp_servers);
+               priv->button_outgoing_smtp_servers = gtk_button_new_with_label (_("mcen_fi_advsetup_optional_smtp"));
+       hildon_gtk_widget_set_theme_size (priv->button_outgoing_smtp_servers, 
+                                         HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);  
        gtk_widget_show (priv->button_outgoing_smtp_servers);
-       gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, MODEST_MARGIN_HALF);
-       gtk_widget_show (caption);
+       gtk_box_pack_start (GTK_BOX (box), priv->button_outgoing_smtp_servers, FALSE, FALSE, MODEST_MARGIN_HALF);
        
        /* Only enable the button when the checkbox is checked: */
        enable_widget_for_checkbutton (priv->button_outgoing_smtp_servers, 
                GTK_BUTTON (priv->checkbox_outgoing_smtp_specific));
 
-       g_object_unref (sizegroup);
+       g_object_unref (title_sizegroup);
+       g_object_unref (value_sizegroup);
                
        g_signal_connect (G_OBJECT (priv->button_outgoing_smtp_servers), "clicked",
                G_CALLBACK (on_button_outgoing_smtp_servers), self);
@@ -972,6 +1056,7 @@ modest_default_account_settings_dialog_init (ModestDefaultAccountSettingsDialog
 {
        ModestDefaultAccountSettingsDialogPrivate *priv;
        GtkWidget *pannable;
+       GtkWidget *separator;
 
        priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE(self);
 
@@ -999,25 +1084,30 @@ modest_default_account_settings_dialog_init (ModestDefaultAccountSettingsDialog
        
        /* Add the notebook pages: */
        gtk_box_pack_start (GTK_BOX (priv->main_container),
-                           modest_maemo_utils_create_group_box (_("mcen_ti_account_settings_account"),
-                                                                priv->page_account_details),
+                           priv->page_account_details,
                            FALSE, FALSE, 0);
        gtk_box_pack_start (GTK_BOX (priv->main_container),
-                           modest_maemo_utils_create_group_box (_("mcen_ti_account_settings_userinfo"),
-                                                                priv->page_user_details),
+                           priv->page_user_details,
                            FALSE, FALSE, 0);
 
+       separator = gtk_hseparator_new ();
+       gtk_box_pack_start (GTK_BOX (priv->main_container), separator,
+                           FALSE, FALSE, 0);
+       gtk_widget_show (separator);
        gtk_box_pack_start (GTK_BOX (priv->main_container),
-                           modest_maemo_utils_create_group_box (_("mcen_ti_advsetup_retrieval"),
-                                                                priv->page_incoming),
+                           priv->page_incoming,
+                           FALSE, FALSE, 0);
+       separator = gtk_hseparator_new ();
+       gtk_box_pack_start (GTK_BOX (priv->main_container), separator,
                            FALSE, FALSE, 0);
+       gtk_widget_show (separator);
        gtk_box_pack_start (GTK_BOX (priv->main_container),
-                           modest_maemo_utils_create_group_box (_("mcen_ti_advsetup_sending"),
-                                                                priv->page_outgoing),
+                           priv->page_outgoing,
                            FALSE, FALSE, 0);
                
        GtkDialog *dialog = GTK_DIALOG (self);
        pannable = hildon_pannable_area_new ();
+       g_object_set (G_OBJECT (pannable), "initial-hint", TRUE, NULL);
        hildon_pannable_area_add_with_viewport (HILDON_PANNABLE_AREA (pannable), priv->main_container);
        gtk_container_add (GTK_CONTAINER (dialog->vbox), GTK_WIDGET (pannable));
        gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox), MODEST_MARGIN_HALF);
@@ -1025,7 +1115,7 @@ modest_default_account_settings_dialog_init (ModestDefaultAccountSettingsDialog
        gtk_widget_show (GTK_WIDGET (pannable));
         
     /* Add the buttons: */
-    gtk_dialog_add_button (GTK_DIALOG(self), _("mcen_bd_dialog_ok"), GTK_RESPONSE_OK);
+       gtk_dialog_add_button (GTK_DIALOG(self), _HL("wdgt_bd_save"), GTK_RESPONSE_OK);
 
     gtk_window_set_default_size (GTK_WINDOW (self), -1, 340);
     
@@ -1088,6 +1178,11 @@ modest_default_account_settings_dialog_load_settings (ModestAccountSettingsDialo
                g_free (priv->account_name);
        priv->account_name = g_strdup (account_name);
 
+       if (priv->account_name)
+               gtk_widget_show (priv->button_delete);
+       else
+               gtk_widget_hide (priv->button_delete);
+
        if (priv->settings)
                g_object_unref (priv->settings);
        priv->settings = g_object_ref (settings);
@@ -1112,7 +1207,7 @@ modest_default_account_settings_dialog_load_settings (ModestAccountSettingsDialo
                modest_account_settings_get_retrieve_limit (settings));
        
        
-       hildon_check_button_set_active (GTK_BUTTON (priv->checkbox_leave_messages), 
+       hildon_check_button_set_active (HILDON_CHECK_BUTTON (priv->checkbox_leave_messages), 
                                        modest_account_settings_get_leave_messages_on_server (settings));
        
 
@@ -1127,9 +1222,9 @@ modest_default_account_settings_dialog_load_settings (ModestAccountSettingsDialo
                
                if (!modest_protocol_registry_protocol_type_has_leave_on_server (protocol_registry,
                                                                                 modest_server_account_settings_get_protocol (incoming_account))) {
-                       gtk_widget_hide (priv->caption_leave_messages);
+                       gtk_widget_hide (priv->checkbox_leave_messages);
                } else {
-                       gtk_widget_show (priv->caption_leave_messages);
+                       gtk_widget_show (priv->checkbox_leave_messages);
                }
 
                /* Remember this for later: */
@@ -1195,7 +1290,7 @@ modest_default_account_settings_dialog_load_settings (ModestAccountSettingsDialo
                const gboolean has_specific = 
                        modest_account_settings_get_use_connection_specific_smtp (settings);
                hildon_check_button_set_active (
-                       GTK_BUTTON (priv->checkbox_outgoing_smtp_specific), 
+                       HILDON_CHECK_BUTTON (priv->checkbox_outgoing_smtp_specific), 
                        has_specific);
                g_object_unref (outgoing_account);
        }
@@ -1262,7 +1357,7 @@ save_configuration (ModestDefaultAccountSettingsDialog *dialog)
                MODEST_LIMIT_RETRIEVE_PICKER (priv->limit_retrieve_picker));
        modest_account_settings_set_retrieve_limit (priv->settings, retrieve_limit);
        
-       leave_on_server = hildon_check_button_get_active (GTK_BUTTON (priv->checkbox_leave_messages));
+       leave_on_server = hildon_check_button_get_active (HILDON_CHECK_BUTTON (priv->checkbox_leave_messages));
        modest_account_settings_set_leave_messages_on_server (priv->settings, leave_on_server); 
 
        store_settings = modest_account_settings_get_store_settings (priv->settings);
@@ -1307,7 +1402,7 @@ save_configuration (ModestDefaultAccountSettingsDialog *dialog)
        /* Save connection-specific SMTP server accounts: */
        modest_account_settings_set_use_connection_specific_smtp 
                (priv->settings, 
-                hildon_check_button_get_active(GTK_BUTTON(priv->checkbox_outgoing_smtp_specific)));
+                hildon_check_button_get_active(HILDON_CHECK_BUTTON(priv->checkbox_outgoing_smtp_specific)));
 
        /* this configuration is not persistent, we should not save */
        if (account_name != NULL)