X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fhildon2%2Fmodest-easysetup-wizard-dialog.c;h=80288d1f57202a1140b1eae922840d52548971f0;hp=6c6ab474524aa1a2c16722884fa2cb07da540c73;hb=00d136e7daf1ac0831f0ed1fff3f68ddf5d36a21;hpb=51372832576ac3b1423ee599cc5b142aabdebd42 diff --git a/src/hildon2/modest-easysetup-wizard-dialog.c b/src/hildon2/modest-easysetup-wizard-dialog.c index 6c6ab47..80288d1 100644 --- a/src/hildon2/modest-easysetup-wizard-dialog.c +++ b/src/hildon2/modest-easysetup-wizard-dialog.c @@ -58,7 +58,7 @@ #include "modest-utils.h" #include "modest-hildon-includes.h" #include "modest-maemo-security-options-view.h" -#include +#include "modest-account-protocol.h" /* Include config.h so that _() works: */ #ifdef HAVE_CONFIG_H @@ -71,6 +71,8 @@ G_DEFINE_TYPE (ModestEasysetupWizardDialog, modest_easysetup_wizard_dialog, MODE MODEST_TYPE_EASYSETUP_WIZARD_DIALOG, \ ModestEasysetupWizardDialogPrivate)) +#define LABELS_WIDTH -1 + typedef struct _ModestEasysetupWizardDialogPrivate ModestEasysetupWizardDialogPrivate; @@ -290,7 +292,7 @@ create_page_welcome (ModestEasysetupWizardDialog *self) GtkWidget *label = gtk_label_new(_("mcen_ia_emailsetup_intro")); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); /* So that it is not truncated: */ - gtk_widget_set_size_request (label, 600, -1); + gtk_widget_set_size_request (label, LABELS_WIDTH, -1); gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0); gtk_widget_show (label); gtk_widget_show (GTK_WIDGET (box)); @@ -316,19 +318,19 @@ on_account_country_selector_changed (HildonTouchSelector *widget, gint column, g } static void -on_account_serviceprovider_selector_changed (HildonTouchSelector *widget, gint column, gpointer user_data) +update_user_email_from_provider (ModestEasysetupWizardDialog *self) { - ModestEasysetupWizardDialog *self = MODEST_EASYSETUP_WIZARD_DIALOG (user_data); + ModestEasysetupWizardDialogPrivate *priv; + gchar* provider_id; + gchar* domain_name = NULL; + g_assert(self); - ModestEasysetupWizardDialogPrivate *priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE (self); - - priv->dirty = TRUE; - + priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE (self); + /* Fill the providers combo, based on the selected country: */ - gchar* provider_id = modest_provider_picker_get_active_provider_id ( + provider_id = modest_provider_picker_get_active_provider_id ( MODEST_PROVIDER_PICKER (priv->account_serviceprovider_picker)); - gchar* domain_name = NULL; if(provider_id) domain_name = modest_presets_get_domain (priv->presets, provider_id); @@ -344,6 +346,18 @@ on_account_serviceprovider_selector_changed (HildonTouchSelector *widget, gint c } static void +on_account_serviceprovider_selector_changed (HildonTouchSelector *widget, gint column, gpointer user_data) +{ + ModestEasysetupWizardDialog *self = MODEST_EASYSETUP_WIZARD_DIALOG (user_data); + g_assert(self); + ModestEasysetupWizardDialogPrivate *priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE (self); + + priv->dirty = TRUE; + + update_user_email_from_provider (self); +} + +static void on_entry_max (ModestValidatingEntry *self, gpointer user_data) { modest_platform_information_banner (GTK_WIDGET (self), NULL, @@ -359,7 +373,7 @@ create_page_account_details (ModestEasysetupWizardDialog *self) ModestEasysetupWizardDialogPrivate* priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE(self); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_widget_set_size_request (label, 600, -1); + gtk_widget_set_size_request (label, LABELS_WIDTH, -1); gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, MODEST_MARGIN_HALF); gtk_widget_show (label); @@ -539,7 +553,7 @@ create_page_user_details (ModestEasysetupWizardDialog *self) hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_user_email), HILDON_GTK_INPUT_MODE_FULL); caption = create_captioned (self, 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. */ + update_user_email_from_provider (self); gtk_widget_show (priv->entry_user_email); gtk_box_pack_start (GTK_BOX (box), caption, FALSE, FALSE, MODEST_MARGIN_HALF); g_signal_connect(G_OBJECT(priv->entry_user_email), "changed", @@ -565,7 +579,7 @@ create_page_complete_easysetup (ModestEasysetupWizardDialog *self) GtkWidget *label = gtk_label_new(_("mcen_ia_emailsetup_setup_complete")); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_widget_set_size_request (label, 600, -1); + gtk_widget_set_size_request (label, LABELS_WIDTH, -1); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); /* The documentation for gtk_label_set_line_wrap() says that we must * call gtk_widget_set_size_request() with a hard-coded width, @@ -575,7 +589,7 @@ create_page_complete_easysetup (ModestEasysetupWizardDialog *self) label = gtk_label_new (_("mcen_ia_easysetup_complete")); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_widget_set_size_request (label, 600, -1); + gtk_widget_set_size_request (label, LABELS_WIDTH, -1); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0); @@ -690,7 +704,7 @@ create_page_custom_incoming (ModestEasysetupWizardDialog *self) /* Show note that account type cannot be changed in future: */ label = gtk_label_new (_("mcen_ia_emailsetup_account_type")); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_widget_set_size_request (label, 600, -1); + gtk_widget_set_size_request (label, LABELS_WIDTH, -1); gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0); gtk_widget_show (label); @@ -796,7 +810,7 @@ on_button_outgoing_smtp_servers (GtkButton *button, gpointer user_data) modest_connection_specific_smtp_window_fill_with_connections (MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (specific_window), priv->account_manager); /* Show the window */ - modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (specific_window)); + modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (specific_window), GTK_WINDOW (self)); gtk_widget_show (specific_window); } @@ -899,7 +913,7 @@ show_advanced_edit(gpointer user_data) } modest_account_settings_dialog_load_settings (dialog, priv->settings); - modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog)); + modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog), GTK_WINDOW (self)); response = gtk_dialog_run (GTK_DIALOG (dialog)); @@ -923,14 +937,14 @@ create_page_complete_custom (ModestEasysetupWizardDialog *self) GtkWidget *label = gtk_label_new(_("mcen_ia_emailsetup_setup_complete")); GtkWidget *button_edit = gtk_button_new_with_label (_("mcen_bd_edit")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); - gtk_widget_set_size_request (label, 600, -1); + gtk_widget_set_size_request (label, LABELS_WIDTH, -1); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0); gtk_widget_show (label); label = gtk_label_new (_("mcen_ia_customsetup_complete")); gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); - gtk_widget_set_size_request (label, 600, -1); + gtk_widget_set_size_request (label, LABELS_WIDTH, -1); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0); gtk_widget_show (label); @@ -1584,6 +1598,7 @@ on_before_next (ModestWizardDialog *dialog, GtkWidget *current_page, GtkWidget * /* Aavoid a clash with an existing display name: */ const gboolean name_in_use = modest_account_mgr_account_with_display_name_exists ( priv->account_manager, account_title); + g_free (account_title); if (name_in_use) { /* Warn the user via a dialog: */ @@ -1769,7 +1784,7 @@ save_to_settings (ModestEasysetupWizardDialog *self) { ModestEasysetupWizardDialogPrivate *priv = MODEST_EASYSETUP_WIZARD_DIALOG_GET_PRIVATE (self); guint special_port; - gchar *provider_id; + gchar *provider_id = NULL; gchar* display_name; const gchar *username, *password; gchar *store_hostname, *transport_hostname; @@ -1822,6 +1837,7 @@ save_to_settings (ModestEasysetupWizardDialog *self) "but it's not a ModestAccountProtocol"); } + g_free (provider_id); return; } @@ -1868,10 +1884,15 @@ save_to_settings (ModestEasysetupWizardDialog *self) /* we check if there is a *special* port */ special_port = modest_presets_get_port (priv->presets, provider_id, TRUE /* incoming */); - if (special_port != 0) + if (special_port != 0) { store_port = special_port; - else - store_port = get_port_from_protocol(store_provider_server_type, store_security); + } else { + gboolean use_alternate_port = FALSE; + if (modest_protocol_registry_protocol_type_is_secure (modest_runtime_get_protocol_registry (), + store_security)) + use_alternate_port = TRUE; + store_port = get_port_from_protocol(store_provider_server_type, use_alternate_port); + } modest_server_account_settings_set_security_protocol (store_settings, store_security); @@ -1994,5 +2015,6 @@ save_to_settings (ModestEasysetupWizardDialog *self) display_name = get_entered_account_title (self); modest_account_settings_set_display_name (priv->settings, display_name); g_free (display_name); + g_free (provider_id); }