From ac93729ec59e4b6ae2169ae3127d46057dfb9b12 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Tue, 10 Jul 2007 17:13:37 +0000 Subject: [PATCH] 2007-07-10 Murray Cumming * src/maemo/modest-account-settings-dialog.c: (show_error): Use the same implementation as in modest-easysetup-wizard.c: (on_entry_invalid_character): The logical ID contains a %s. Guessed what it should be. (on_entry_max), (check_data), (on_response): Adapt to changed show_error(). (create_page_account_details): Really call modest_validating_entry_set_func() on the correct widgets. * src/maemo/easysetup/modest-easysetup-wizard.c: (on_entry_invalid_character): Fix the logical ID here too. (create_page_account_details), (create_page_user_details): Really call modest_validating_entry_set_func() on the correct widgets. * src/modest-tny-account-store.c: (modest_tny_account_store_alert): Do not try to use the account if it is NULL. pmo-trunk-r2679 --- ChangeLog | 16 +++++++ ChangeLog2 | 21 +++++++++ src/maemo/easysetup/modest-easysetup-wizard.c | 11 +++-- src/maemo/modest-account-settings-dialog.c | 58 ++++++++++++++----------- src/modest-tny-account-store.c | 12 ++++- src/modest-tny-account.c | 2 + 6 files changed, 88 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index acb6b92..92e14f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1 +1,17 @@ +2007-07-10 Murray Cumming,,, + + reviewed by: + + * ChangeLog2: + * src/maemo/easysetup/modest-easysetup-wizard.c: + (on_entry_invalid_character), (create_page_account_details), + (create_page_user_details), (show_error): + * src/maemo/modest-account-settings-dialog.c: + (on_entry_invalid_character), (on_entry_max), + (create_page_account_details), (check_data), (on_response), + (show_error): + * src/modest-tny-account-store.c: (modest_tny_account_store_alert): + * src/modest-tny-account.c: + (modest_tny_account_new_for_per_account_local_outbox_folder): + * please check the svn log instead diff --git a/ChangeLog2 b/ChangeLog2 index 3a8df80..a9a9ae2 100644 --- a/ChangeLog2 +++ b/ChangeLog2 @@ -1,3 +1,24 @@ +2007-07-10 Murray Cumming + + * src/maemo/modest-account-settings-dialog.c: + (show_error): Use the same implementation as in + modest-easysetup-wizard.c: + (on_entry_invalid_character): The logical ID contains a %s. + Guessed what it should be. + (on_entry_max), (check_data), (on_response): Adapt to + changed show_error(). + (create_page_account_details): Really call + modest_validating_entry_set_func() on the correct widgets. + * src/maemo/easysetup/modest-easysetup-wizard.c: + (on_entry_invalid_character): Fix the logical ID here too. + (create_page_account_details), + (create_page_user_details): + Really call + modest_validating_entry_set_func() on the correct widgets. + + * src/modest-tny-account-store.c: (modest_tny_account_store_alert): + Do not try to use the account if it is NULL. + 2007-07-10 Johannes Schmid * src/modest-ui-actions.c: (create_move_to_dialog), diff --git a/src/maemo/easysetup/modest-easysetup-wizard.c b/src/maemo/easysetup/modest-easysetup-wizard.c index 07b4be9..2161439 100644 --- a/src/maemo/easysetup/modest-easysetup-wizard.c +++ b/src/maemo/easysetup/modest-easysetup-wizard.c @@ -361,7 +361,9 @@ on_entry_invalid_character (ModestValidatingEntry *self, const gchar* character, /* We could add a special case for whitespace here if (character == NULL) ... */ - show_error (GTK_WIDGET (self), _CS("ckdg_ib_illegal_characters_entered")); + /* TODO: Should this show just this one bad character or all the not-allowed characters? */ + gchar *message = g_strdup_printf (_CS("ckdg_ib_illegal_characters_entered"), character); + show_error (GTK_WIDGET (self), message); } static GtkWidget* @@ -489,6 +491,7 @@ create_page_account_details (ModestEasysetupWizardDialog *self) modest_validating_entry_set_unallowed_characters ( MODEST_VALIDATING_ENTRY (self->entry_account_title), list_prevent); g_list_free (list_prevent); + list_prevent = NULL; modest_validating_entry_set_func(MODEST_VALIDATING_ENTRY(self->entry_account_title), on_entry_invalid_character, self); @@ -537,7 +540,7 @@ create_page_user_details (ModestEasysetupWizardDialog *self) list_prevent = g_list_append (list_prevent, ">"); modest_validating_entry_set_unallowed_characters ( MODEST_VALIDATING_ENTRY (self->entry_user_name), list_prevent); - modest_validating_entry_set_func(MODEST_VALIDATING_ENTRY(self->entry_account_title), + modest_validating_entry_set_func(MODEST_VALIDATING_ENTRY(self->entry_user_name), on_entry_invalid_character, self); g_list_free (list_prevent); @@ -557,7 +560,7 @@ create_page_user_details (ModestEasysetupWizardDialog *self) * as required by our UI specification: */ modest_validating_entry_set_unallowed_characters_whitespace ( MODEST_VALIDATING_ENTRY (self->entry_user_username)); - modest_validating_entry_set_func(MODEST_VALIDATING_ENTRY(self->entry_account_title), + modest_validating_entry_set_func(MODEST_VALIDATING_ENTRY(self->entry_user_username), on_entry_invalid_character, self); /* Set max length as in the UI spec: @@ -1508,7 +1511,7 @@ show_error (GtkWidget *parent_widget, const gchar* text) hildon_banner_show_information(parent_widget, NULL, text); #if 0 - GtkDialog *dialog = GTK_DIALOG (hildon_note_new_information (parent_window, text)); + GtkDialog *dialog = GTK_DIALOG (hildon_note_new_information (parent_window, text)); */ /* GtkDialog *dialog = GTK_DIALOG (gtk_message_dialog_new (parent_window, (GtkDialogFlags)0, diff --git a/src/maemo/modest-account-settings-dialog.c b/src/maemo/modest-account-settings-dialog.c index 7f10380..98b9501 100644 --- a/src/maemo/modest-account-settings-dialog.c +++ b/src/maemo/modest-account-settings-dialog.c @@ -139,10 +139,7 @@ modest_account_settings_dialog_finalize (GObject *object) } static void -show_error (GtkWindow *parent_window, const gchar* text); - -static void -show_ok (GtkWindow *parent_window, const gchar* text); +show_error (GtkWidget *parent_widget, const gchar* text); static void on_combo_incoming_security_changed (GtkComboBox *widget, gpointer user_data); @@ -257,12 +254,23 @@ static GtkWidget* create_caption_new_with_asterisk(ModestAccountSettingsDialog * return caption; } +static void +on_entry_invalid_character (ModestValidatingEntry *self, const gchar* character, gpointer user_data) +{ + /* ModestEasysetupWizardDialog *dialog = MODEST_EASYSETUP_WIZARD_DIALOG (user_data); */ + /* We could add a special case for whitespace here + if (character == NULL) ... + */ + /* TODO: Should this show just this one bad character or all the not-allowed characters? */ + gchar *message = g_strdup_printf (_CS("ckdg_ib_illegal_characters_entered"), character); + show_error (GTK_WIDGET (self), message); +} static void on_entry_max (ModestValidatingEntry *self, gpointer user_data) { - ModestAccountSettingsDialog *dialog = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data); - show_error (GTK_WINDOW (dialog), _CS("ckdg_ib_maximum_characters_reached")); + /* ModestAccountSettingsDialog *dialog = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data); */ + show_error (GTK_WIDGET (self), _CS("ckdg_ib_maximum_characters_reached")); } static GtkWidget* @@ -307,6 +315,8 @@ create_page_account_details (ModestAccountSettingsDialog *self) modest_validating_entry_set_unallowed_characters ( MODEST_VALIDATING_ENTRY (self->entry_account_title), list_prevent); g_list_free (list_prevent); + modest_validating_entry_set_func(MODEST_VALIDATING_ENTRY(self->entry_account_title), + on_entry_invalid_character, self); /* Set max length as in the UI spec: * The UI spec seems to want us to show a dialog if we hit the maximum. */ @@ -898,7 +908,7 @@ check_data (ModestAccountSettingsDialog *self) if(error == NULL || error->domain != modest_maemo_utils_get_supported_secure_authentication_error_quark() || error->code != MODEST_MAEMO_UTILS_GET_SUPPORTED_SECURE_AUTHENTICATION_ERROR_CANCELED) { - show_error (GTK_WINDOW (self), _("Could not discover supported secure authentication methods.")); + show_error (GTK_WIDGET (self), _("Could not discover supported secure authentication methods.")); } if(error != NULL) @@ -967,10 +977,10 @@ on_response (GtkDialog *wizard_dialog, const gboolean enabled = modest_account_mgr_get_enabled (self->account_manager, self->account_name); if (enabled) - show_ok (GTK_WINDOW (self), _("mcen_ib_advsetup_settings_saved")); + show_error (GTK_WIDGET (self), _("mcen_ib_advsetup_settings_saved")); } else - show_error (GTK_WINDOW (self), _("mail_ib_setting_failed")); + show_error (GTK_WIDGET (self), _("mail_ib_setting_failed")); } } } @@ -1469,25 +1479,21 @@ modest_account_settings_dialog_class_init (ModestAccountSettingsDialogClass *kla } static void -show_error (GtkWindow *parent_window, const gchar* text) +show_error (GtkWidget *parent_widget, const gchar* text) { - GtkDialog *dialog = GTK_DIALOG (hildon_note_new_information (parent_window, text)); - /* - GtkDialog *dialog = GTK_DIALOG (gtk_message_dialog_new (parent_window, - (GtkDialogFlags)0, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - text )); - */ + hildon_banner_show_information(parent_widget, NULL, text); +#if 0 + GtkDialog *dialog = GTK_DIALOG (hildon_note_new_information (parent_widget, text); + /* + GtkDialog *dialog = GTK_DIALOG (gtk_message_dialog_new (parent_window, + (GtkDialogFlags)0, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + text )); + */ + gtk_dialog_run (dialog); gtk_widget_destroy (GTK_WIDGET (dialog)); -} - -static void -show_ok (GtkWindow *parent_window, const gchar* text) -{ - /* Don't show a dialog but Banner (NB #59248) */ - hildon_banner_show_information(GTK_WIDGET( - gtk_widget_get_parent_window(GTK_WIDGET(parent_window))), NULL, text); +#endif } diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index de071a6..94369f2 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -1109,8 +1109,16 @@ modest_tny_account_store_alert (TnyAccountStore *self, TnyAccount *account, TnyA if (!server_name) server_name = _("Unknown Server"); - const ModestTransportStoreProtocol proto - = modest_protocol_info_get_transport_store_protocol (tny_account_get_proto (account)); + ModestTransportStoreProtocol proto = MODEST_PROTOCOL_STORE_POP; /* Arbitrary default. */ + if (account) { + const gchar *proto_name = tny_account_get_proto (account); + if (proto_name) + proto = modest_protocol_info_get_transport_store_protocol (proto_name); + else { + g_warning("modest: %s: account with id=%s has no proto.\n", __FUNCTION__, + tny_account_get_id (account)); + } + } /* const gchar *prompt = NULL; */ gchar *prompt = NULL; diff --git a/src/modest-tny-account.c b/src/modest-tny-account.c index d1ac330..f9a2b10 100644 --- a/src/modest-tny-account.c +++ b/src/modest-tny-account.c @@ -730,6 +730,8 @@ modest_tny_account_new_for_per_account_local_outbox_folder (ModestAccountMgr *ac return NULL; } + printf ("DEBUG: %s: Setting session for account: session=%p\n", + __FUNCTION__, session); tny_camel_account_set_session (TNY_CAMEL_ACCOUNT(tny_account), session); /* Make sure that the paths exists on-disk so that TnyCamelStoreAccount can -- 1.7.9.5