From 37a2e1d1085479f77e403c1b2b8ecc0bbbd8e16b Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Wed, 2 May 2007 11:13:37 +0000 Subject: [PATCH] 2007-05-02 Murray Cumming * src/modest-account-mgr.h: * src/modest-account-mgr.c: (modest_account_mgr_account_names): Add a gboolean enabled_only parameter, so we can get lists of onlt the enabled accounts. (modest_account_mgr_add_account),, (modest_account_mgr_account_with_display_name_exists): * src/maemo/modest-msg-edit-window.c: (get_transports): * src/modest-account-mgr-helpers.c: (modest_account_mgr_set_first_account_as_default): * src/modest-init.c: (init_default_account_maybe): * src/modest-tny-account-store.c: (get_accounts): * src/modest-ui-actions.c: (modest_ui_actions_on_accounts), (do_send_receive_auto), (modest_ui_actions_on_send_receive): * tests/check_account-mgr.c: (START_TEST): Provide the extra parameter, as appropriate. * src/widgets/modest-account-view.c: (update_account_view): Do not show disabled accounts (meaning that there is no way to enable/disable accounts in the UI (the feature is not in our UI specification), so we can use this internally only to mark unfinished or temporary account data. * src/maemo/easysetup/modest-easysetup-wizard.c: (create_account): Add boolean enable parameter, so we can specify FALSE to create the temporary account. (on_button_edit_advanced_settings): Create the temporary account as disabled. (on_before_next): When finishing, when there is a temporary account, just set it as enabled. Also, use a timeout to delay the showing of the dialog until gconf is likely to return correct information, due to a maemo gconf bug that is fixed in osso 1.1, but not yet in Bora. However, the dialog stays on screen after it is destroyed. * src/maemo/modest-account-settings-dialog.c: on_response(): Do not check for invalid data when cancelling. Use a hildon note instead of a dialog to complain about invalid data. Do not show the account-saved note if the account is disabled (a temporary account that will not really be saved for use until later.) pmo-trunk-r1727 --- ChangeLog2 | 42 +++++++++++ src/maemo/easysetup/modest-easysetup-wizard.c | 100 +++++++++++++++++++------ src/maemo/modest-account-settings-dialog.c | 25 ++++--- src/maemo/modest-msg-edit-window.c | 3 +- src/modest-account-mgr-helpers.c | 2 +- src/modest-account-mgr.c | 37 +++++++-- src/modest-account-mgr.h | 10 ++- src/modest-init.c | 4 +- src/modest-tny-account-store.c | 3 +- src/modest-ui-actions.c | 10 ++- src/widgets/modest-account-view.c | 38 ++++++---- tests/check_account-mgr.c | 10 +-- 12 files changed, 215 insertions(+), 69 deletions(-) diff --git a/ChangeLog2 b/ChangeLog2 index b5c569c..7df983f 100644 --- a/ChangeLog2 +++ b/ChangeLog2 @@ -1,3 +1,45 @@ +2007-05-02 Murray Cumming + + * src/modest-account-mgr.h: + * src/modest-account-mgr.c: + (modest_account_mgr_account_names): Add a gboolean enabled_only + parameter, so we can get lists of onlt the enabled accounts. + + (modest_account_mgr_add_account),, + (modest_account_mgr_account_with_display_name_exists): + * src/maemo/modest-msg-edit-window.c: (get_transports): + * src/modest-account-mgr-helpers.c: + (modest_account_mgr_set_first_account_as_default): + * src/modest-init.c: (init_default_account_maybe): + * src/modest-tny-account-store.c: (get_accounts): + * src/modest-ui-actions.c: (modest_ui_actions_on_accounts), + (do_send_receive_auto), (modest_ui_actions_on_send_receive): + * tests/check_account-mgr.c: (START_TEST): + Provide the extra parameter, as appropriate. + + * src/widgets/modest-account-view.c: (update_account_view): + Do not show disabled accounts (meaning that there is no way to + enable/disable accounts in the UI (the feature is not in our UI + specification), so we can use this internally only to mark unfinished + or temporary account data. + + * src/maemo/easysetup/modest-easysetup-wizard.c: + (create_account): Add boolean enable parameter, so we can specify FALSE + to create the temporary account. + (on_button_edit_advanced_settings): Create the temporary account as disabled. + (on_before_next): When finishing, when there is a temporary account, just + set it as enabled. + Also, use a timeout to delay the showing of the dialog until gconf is likely + to return correct information, due to a maemo gconf bug that is fixed in + osso 1.1, but not yet in Bora. + However, the dialog stays on screen after it is destroyed. + + * src/maemo/modest-account-settings-dialog.c: on_response(): Do not check + for invalid data when cancelling. Use a hildon note instead of a dialog + to complain about invalid data. Do not show the account-saved note if the + account is disabled (a temporary account that will not really be saved for use + until later.) + 2007-04-30 Murray Cumming * src/modest-account-mgr-helpers.h: diff --git a/src/maemo/easysetup/modest-easysetup-wizard.c b/src/maemo/easysetup/modest-easysetup-wizard.c index 716d794..0433321 100644 --- a/src/maemo/easysetup/modest-easysetup-wizard.c +++ b/src/maemo/easysetup/modest-easysetup-wizard.c @@ -101,7 +101,7 @@ static void show_error (GtkWindow *parent_window, const gchar* text); static gboolean -create_account (ModestEasysetupWizardDialog *self); +create_account (ModestEasysetupWizardDialog *self, gboolean enabled); static void create_subsequent_easysetup_pages (ModestEasysetupWizardDialog *self); @@ -713,6 +713,37 @@ static GtkWidget* create_page_custom_outgoing (ModestEasysetupWizardDialog *self return GTK_WIDGET (box); } +static gboolean +on_timeout_show_advanced_edit(gpointer user_data) +{ + ModestEasysetupWizardDialog * self = MODEST_EASYSETUP_WIZARD_DIALOG (user_data); + + if (!(self->saved_account_name)) + return FALSE; + + /* Show the Account Settings window: */ + ModestAccountSettingsDialog *dialog = modest_account_settings_dialog_new (); + modest_account_settings_dialog_set_account_name (dialog, self->saved_account_name); + + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self)); + + gtk_dialog_run (GTK_DIALOG (dialog)); + + /* TODO: The hide() is not necessary. + * It is just here to show that it doesn't work, + * just as destroy doesn't work. + */ + gtk_widget_hide (GTK_WIDGET(dialog)); + + /* TODO: The dialog remains on screen, not allowing any interaction. + * But gtk_widget_destroy() should always destroy. + */ + printf("debug: destroying settings dialog\n"); + gtk_widget_destroy (GTK_WIDGET (dialog)); + printf("debug: after destroying settings dialog (doesn't seem to work).\n"); + + return FALSE; /* Do not call this timeout callback again. */ +} static void on_button_edit_advanced_settings (GtkButton *button, gpointer user_data) @@ -723,7 +754,13 @@ on_button_edit_advanced_settings (GtkButton *button, gpointer user_data) * without recoding it to use non-gconf information. * This account will be deleted if Finish is never actually clicked. */ - const gboolean saved = create_account (self); + gboolean saved = TRUE; + gboolean was_already_saved = TRUE; + if (!(self->saved_account_name)) { + saved = create_account (self, FALSE); + was_already_saved = FALSE; + } + if (!saved) return; @@ -731,14 +768,17 @@ on_button_edit_advanced_settings (GtkButton *button, gpointer user_data) return; /* Show the Account Settings window: */ - ModestAccountSettingsDialog *dialog = modest_account_settings_dialog_new (); - modest_account_settings_dialog_set_account_name (dialog, self->saved_account_name); - - gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self)); - printf ("debug: before run\n"); - gtk_dialog_run (GTK_DIALOG (dialog)); - printf ("debug: after run\n"); - gtk_widget_destroy (GTK_WIDGET (dialog)); + if (was_already_saved) { + /* Just show the dialog immediately: */ + on_timeout_show_advanced_edit(self); + } + else + { + printf ("debug: waiting for gconf to update its local cache. " + "This is a hack to work around a maemo gconf bug in maemo bora.\n"); + + g_timeout_add (5000, on_timeout_show_advanced_edit, self); + } } static GtkWidget* create_page_complete_custom (ModestEasysetupWizardDialog *self) { @@ -1082,7 +1122,14 @@ on_before_next (ModestWizardDialog *dialog, GtkWidget *current_page, GtkWidget * */ if(!next_page) /* This is NULL when this is a click on Finish. */ { - create_account (account_wizard); + if (account_wizard->saved_account_name) { + /* Just enable the already-saved account (temporarily created when + * editing advanced settings): */ + modest_account_mgr_set_enabled (account_wizard->account_manager, + account_wizard->saved_account_name, TRUE); + } else { + create_account (account_wizard, TRUE /* enabled */); + } } @@ -1130,28 +1177,32 @@ on_enable_buttons (ModestWizardDialog *dialog, GtkWidget *current_page) enable_next = FALSE; } - /* Enable the buttons, - * identifying them via their associated response codes: - */ - GtkDialog *dialog_base = GTK_DIALOG (dialog); - gtk_dialog_set_response_sensitive (dialog_base, - MODEST_WIZARD_DIALOG_NEXT, - enable_next); - + /* Enable the buttons, + * identifying them via their associated response codes: */ + /* Disable the Finish button until we are on the last page, * because HildonWizardDialog enables this for all but the first page: */ GtkNotebook *notebook = NULL; + GtkDialog *dialog_base = GTK_DIALOG (dialog); g_object_get (dialog_base, "wizard-notebook", ¬ebook, NULL); gint current = gtk_notebook_get_current_page (notebook); gint last = gtk_notebook_get_n_pages (notebook) - 1; - gboolean is_last = (current == last); + const gboolean is_last = (current == last); if(!is_last) { gtk_dialog_set_response_sensitive (dialog_base, MODEST_WIZARD_DIALOG_FINISH, FALSE); + } else + { + /* Disable Next on the last page: */ + enable_next = FALSE; } + + gtk_dialog_set_response_sensitive (dialog_base, + MODEST_WIZARD_DIALOG_NEXT, + enable_next); } static void @@ -1194,7 +1245,7 @@ show_error (GtkWindow *parent_window, const gchar* text) * @result: TRUE if the account was successfully created. */ gboolean -create_account (ModestEasysetupWizardDialog *self) +create_account (ModestEasysetupWizardDialog *self, gboolean enabled) { ModestEasysetupWizardDialogPrivate *priv = WIZARD_DIALOG_GET_PRIVATE (self); @@ -1301,7 +1352,9 @@ create_account (ModestEasysetupWizardDialog *self) /* Sanity check: */ /* There must be at least one account now: */ - GSList *account_names = modest_account_mgr_account_names (self->account_manager); + /* Note, when this fails is is caused by a Maemo gconf bug that has been + * fixed in versions after 3.1. */ + GSList *account_names = modest_account_mgr_account_names (self->account_manager, FALSE); if(!account_names) { g_warning ("modest_account_mgr_account_names() returned NULL after adding an account."); @@ -1377,7 +1430,8 @@ create_account (ModestEasysetupWizardDialog *self) /* Create the account, which will contain the two "server accounts": */ created = modest_account_mgr_add_account (self->account_manager, account_name, store_name, /* The name of our POP/IMAP server account. */ - transport_name /* The name of our SMTP server account. */); + transport_name, /* The name of our SMTP server account. */ + enabled); g_free (store_name); g_free (transport_name); diff --git a/src/maemo/modest-account-settings-dialog.c b/src/maemo/modest-account-settings-dialog.c index 21ba1cf..8561270 100644 --- a/src/maemo/modest-account-settings-dialog.c +++ b/src/maemo/modest-account-settings-dialog.c @@ -824,11 +824,9 @@ on_response (GtkDialog *wizard_dialog, /* Warn about unsaved changes: */ if (response_id == GTK_RESPONSE_CANCEL && self->modified) { - GtkDialog *dialog = GTK_DIALOG (gtk_message_dialog_new (GTK_WINDOW (self), - (GtkDialogFlags)0, - GTK_MESSAGE_INFO, - GTK_BUTTONS_OK_CANCEL, /* TODO: These button names are ambiguous, and not specified in the UI specification. */ - _("imum_nc_wizard_confirm_lose_changes") )); + GtkDialog *dialog = GTK_DIALOG (hildon_note_new_confirmation (GTK_WINDOW (self), + _("imum_nc_wizard_confirm_lose_changes"))); + /* TODO: These button names will be ambiguous, and not specified in the UI specification. */ const gint dialog_response = gtk_dialog_run (dialog); gtk_widget_destroy (GTK_WIDGET (dialog)); @@ -837,7 +835,7 @@ on_response (GtkDialog *wizard_dialog, prevent_response = TRUE; } /* Check for invalid input: */ - else if (!check_data (self)) { + else if (response_id != GTK_RESPONSE_CANCEL && !check_data (self)) { prevent_response = TRUE; } @@ -848,12 +846,19 @@ on_response (GtkDialog *wizard_dialog, return; } - if (response_id == GTK_RESPONSE_OK) { /* Try to save the changes: */ const gboolean saved = save_configuration (self); - if (saved) - show_ok (GTK_WINDOW (self), _("mcen_ib_advsetup_settings_saved")); + if (saved) { + /* Do not show the account-saved dialog if we are just saving this + * temporarily, because from the user's point of view it will not + * really be saved (saved + enabled) until later. + */ + 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")); + } else show_error (GTK_WINDOW (self), _("mail_ib_setting_failed")); } @@ -1275,6 +1280,7 @@ modest_account_settings_dialog_class_init (ModestAccountSettingsDialogClass *kla static void show_error (GtkWindow *parent_window, const gchar* text) { + printf("debug: show_error\n"); GtkDialog *dialog = GTK_DIALOG (hildon_note_new_information (parent_window, text)); /* GtkDialog *dialog = GTK_DIALOG (gtk_message_dialog_new (parent_window, @@ -1291,6 +1297,7 @@ show_error (GtkWindow *parent_window, const gchar* text) static void show_ok (GtkWindow *parent_window, const gchar* text) { + printf("debug: show_ok\n"); GtkDialog *dialog = GTK_DIALOG (hildon_note_new_information (parent_window, text)); /* GtkDialog *dialog = GTK_DIALOG (gtk_message_dialog_new (parent_window, diff --git a/src/maemo/modest-msg-edit-window.c b/src/maemo/modest-msg-edit-window.c index da30d63..3d90a53 100644 --- a/src/maemo/modest-msg-edit-window.c +++ b/src/maemo/modest-msg-edit-window.c @@ -262,7 +262,8 @@ get_transports (void) GSList *cursor, *accounts; account_mgr = modest_runtime_get_account_mgr(); - cursor = accounts = modest_account_mgr_account_names (account_mgr); + cursor = accounts = modest_account_mgr_account_names (account_mgr, + TRUE /* only enabled accounts. */); while (cursor) { gchar *account_name = (gchar*)cursor->data; gchar *from_string = modest_account_mgr_get_from_string (account_mgr, diff --git a/src/modest-account-mgr-helpers.c b/src/modest-account-mgr-helpers.c index 6be7d5c..20ed6a6 100644 --- a/src/modest-account-mgr-helpers.c +++ b/src/modest-account-mgr-helpers.c @@ -585,7 +585,7 @@ gboolean modest_account_mgr_set_first_account_as_default (ModestAccountMgr *self) { gboolean result = FALSE; - GSList *account_names = modest_account_mgr_account_names (self); + GSList *account_names = modest_account_mgr_account_names (self, TRUE /* only enabled */); if(account_names) { const gchar* account_name = (const gchar*)account_names->data; diff --git a/src/modest-account-mgr.c b/src/modest-account-mgr.c index 735ab8e..ba553d8 100644 --- a/src/modest-account-mgr.c +++ b/src/modest-account-mgr.c @@ -222,7 +222,8 @@ gboolean modest_account_mgr_add_account (ModestAccountMgr *self, const gchar *name, const gchar *store_account, - const gchar *transport_account) + const gchar *transport_account, + gboolean enabled) { ModestAccountMgrPrivate *priv; gchar *key; @@ -289,7 +290,7 @@ modest_account_mgr_add_account (ModestAccountMgr *self, return FALSE; } } - modest_account_mgr_set_enabled (self, name, TRUE); + modest_account_mgr_set_enabled (self, name, enabled); /* if no default account has been defined yet, do so now */ default_account = modest_account_mgr_get_default_account (self); @@ -640,7 +641,7 @@ modest_account_mgr_search_server_accounts (ModestAccountMgr * self, GSList* -modest_account_mgr_account_names (ModestAccountMgr * self) +modest_account_mgr_account_names (ModestAccountMgr * self, gboolean only_enabled) { GSList *accounts; ModestAccountMgrPrivate *priv; @@ -662,7 +663,32 @@ modest_account_mgr_account_names (ModestAccountMgr * self) } strip_prefix_from_elements (accounts, prefix_len); - return accounts; + + GSList *result = NULL; + + /* Filter-out the disabled accounts if requested: */ + if (only_enabled) { + GSList *iter = accounts; + while (iter) { + if (!(iter->data)) + continue; + + const gchar* account_name = (const gchar*)iter->data; + if (account_name && modest_account_mgr_get_enabled (self, account_name)) + result = g_slist_append (result, g_strdup (account_name)); + + iter = g_slist_next (iter); + } + + /* TODO: Free the strings too? */ + g_slist_free (accounts); + accounts = NULL; + } + else + result = accounts; + + + return result; } @@ -958,7 +984,8 @@ gboolean modest_account_mgr_account_with_display_name_exists (ModestAccountMgr GSList *account_names = NULL; GSList *cursor = NULL; - cursor = account_names = modest_account_mgr_account_names (self); + cursor = account_names = modest_account_mgr_account_names (self, + TRUE /* enabled accounts, because disabled accounts are not user visible. */); gboolean found = FALSE; diff --git a/src/modest-account-mgr.h b/src/modest-account-mgr.h index 6e8b888..85ddd38 100644 --- a/src/modest-account-mgr.h +++ b/src/modest-account-mgr.h @@ -90,18 +90,18 @@ ModestAccountMgr* modest_account_mgr_new (ModestConf *modest_c * @name: name (id) of the account, which is a valid UTF8 string that does not contain '/' * @store_name: the store account (ie. POP/IMAP) * @transport_name: the transport account (ie. sendmail/SMTP) - * @err: a GError ptr, or NULL to ignore. + * @enabled: Whether the account should be enabled initially. * * Create a new account. The account with @name should not already exist. The @name will * be used as the initial display name of the new account. * * Returns: TRUE if the creation succeeded, FALSE otherwise, - * @err gives details in case of error */ gboolean modest_account_mgr_add_account (ModestAccountMgr *self, const gchar* name, const gchar* store_name, - const gchar* transport_name); + const gchar* transport_name, + gboolean enabled); /** * modest_account_mgr_add_server_account: @@ -167,6 +167,7 @@ gboolean modest_account_mgr_remove_account (ModestAccountMgr *sel /** * modest_account_mgr_account_names: * @self: a ModestAccountMgr instance + * @only_enabled: Whether only enabled accounts should be returned. * * list all account names * @@ -177,7 +178,8 @@ gboolean modest_account_mgr_remove_account (ModestAccountMgr *sel * because this is implemented via gconf_client_all_dirs() which also requires a deep free, * though that's not documented. murrayc. */ -GSList* modest_account_mgr_account_names (ModestAccountMgr *self); +GSList* modest_account_mgr_account_names (ModestAccountMgr *self, + gboolean only_enabled); /** diff --git a/src/modest-init.c b/src/modest-init.c index 53c32dc..ecd79b9 100644 --- a/src/modest-init.c +++ b/src/modest-init.c @@ -354,7 +354,7 @@ free_element (gpointer data, gpointer user_data) } - +/* TODO: This is a duplicate of modest_account_mgr_set_first_account_as_default(). */ /** * init_default_account_maybe: * @@ -372,7 +372,7 @@ init_default_account_maybe (ModestAccountMgr *acc_mgr) gchar *default_account; gboolean retval = TRUE; - all_accounts = modest_account_mgr_account_names (acc_mgr); + all_accounts = modest_account_mgr_account_names (acc_mgr, TRUE /* enabled accounts only */); if (all_accounts) { /* if there are any accounts, there should be a default one */ default_account = modest_account_mgr_get_default_account (acc_mgr); diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index 70b2257..aaa8101 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -455,7 +455,8 @@ get_accounts (TnyAccountStore *self, TnyList *list, TnyAccountType type) priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self); - account_names = modest_account_mgr_account_names (priv->account_mgr); + account_names = modest_account_mgr_account_names (priv->account_mgr, + TRUE /* including disabled accounts */); for (cursor = account_names; cursor; cursor = cursor->next) { diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 7f0ec85..0be3a21 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -241,11 +241,11 @@ modest_ui_actions_on_accounts (GtkAction *action, ModestWindow *win) * because it requires a providers preset file which is not publically available. */ #ifdef MODEST_PLATFORM_MAEMO /* Defined in config.h */ - GSList *account_names = modest_account_mgr_account_names (modest_runtime_get_account_mgr()); + GSList *account_names = modest_account_mgr_account_names (modest_runtime_get_account_mgr(), + TRUE /* enabled accounts only */); gboolean accounts_exist = account_names != NULL; g_slist_free (account_names); -/* To test, while modest_account_mgr_account_names() is broken: accounts_exist = TRUE; */ if (!accounts_exist) { /* If there are no accounts yet, just show the easy-setup wizard, as per the UI spec: */ ModestEasysetupWizardDialog *wizard = modest_easysetup_wizard_dialog_new (); @@ -761,7 +761,8 @@ do_send_receive_auto (ModestWindow *win) tny_device_is_online(modest_runtime_get_device()) ? "yes":"no"); /* TODO: Delete the item->data strings as well as the list? */ - GSList *account_names = modest_account_mgr_account_names (modest_runtime_get_account_mgr()); + GSList *account_names = modest_account_mgr_account_names (modest_runtime_get_account_mgr(), + TRUE /* enabled accounts only */); GSList *iter = account_names; while (iter) { const gchar * account_name = (const char*) iter->data; @@ -799,7 +800,8 @@ void modest_ui_actions_on_send_receive (GtkAction *action, ModestWindow *win) { /* Check that at least one account exists: */ - GSList *account_names = modest_account_mgr_account_names (modest_runtime_get_account_mgr()); + GSList *account_names = modest_account_mgr_account_names (modest_runtime_get_account_mgr(), + TRUE /* enabled accounts only */); gboolean accounts_exist = account_names != NULL; g_slist_free (account_names); diff --git a/src/widgets/modest-account-view.c b/src/widgets/modest-account-view.c index 99c0756..529b321 100644 --- a/src/widgets/modest-account-view.c +++ b/src/widgets/modest-account-view.c @@ -159,7 +159,15 @@ update_account_view (ModestAccountMgr *account_mgr, ModestAccountView *view) model = GTK_LIST_STORE(gtk_tree_view_get_model (GTK_TREE_VIEW(view))); gtk_list_store_clear (model); - cursor = account_names = modest_account_mgr_account_names (account_mgr); + /* Note: We do not show disabled accounts. + * Of course, this means that there is no UI to enable or disable + * accounts. That is OK for maemo where no such feature or UI is + * specified, so the "enabled" property is used internally to avoid + * showing unfinished accounts. If a user-visible "enabled" is + * needed in the future, we must use a second property for the + * current use instead */ + cursor = account_names = modest_account_mgr_account_names (account_mgr, + TRUE /* only enabled accounts. */); if(account_names == NULL) { @@ -192,19 +200,21 @@ update_account_view (ModestAccountMgr *account_mgr, ModestAccountView *view) else last_updated_string = g_strdup (_("Never")); - gtk_list_store_insert_with_values ( - model, &iter, 0, - MODEST_ACCOUNT_VIEW_NAME_COLUMN, account_name, - MODEST_ACCOUNT_VIEW_DISPLAY_NAME_COLUMN, account_data->display_name, - MODEST_ACCOUNT_VIEW_IS_ENABLED_COLUMN, account_data->is_enabled, - MODEST_ACCOUNT_VIEW_IS_DEFAULT_COLUMN, account_data->is_default, - - MODEST_ACCOUNT_VIEW_PROTO_COLUMN, - modest_protocol_info_get_protocol_name (account_data->store_account->proto), - - MODEST_ACCOUNT_VIEW_LAST_UPDATED_COLUMN, last_updated_string, - -1); - g_free (last_updated_string); + if (account_data->is_enabled) { + gtk_list_store_insert_with_values ( + model, &iter, 0, + MODEST_ACCOUNT_VIEW_NAME_COLUMN, account_name, + MODEST_ACCOUNT_VIEW_DISPLAY_NAME_COLUMN, account_data->display_name, + MODEST_ACCOUNT_VIEW_IS_ENABLED_COLUMN, account_data->is_enabled, + MODEST_ACCOUNT_VIEW_IS_DEFAULT_COLUMN, account_data->is_default, + + MODEST_ACCOUNT_VIEW_PROTO_COLUMN, + modest_protocol_info_get_protocol_name (account_data->store_account->proto), + + MODEST_ACCOUNT_VIEW_LAST_UPDATED_COLUMN, last_updated_string, + -1); + g_free (last_updated_string); + } } modest_account_mgr_free_account_data (account_mgr, account_data); diff --git a/tests/check_account-mgr.c b/tests/check_account-mgr.c index 697d411..ee7db6a 100644 --- a/tests/check_account-mgr.c +++ b/tests/check_account-mgr.c @@ -114,11 +114,11 @@ START_TEST (test_add_exists_remove_account_regular) result = modest_account_mgr_add_account (account_mgr, name, store_account, - transport_account); + transport_account, TRUE); fail_unless (result, "modest_account_mgr_add_account failed:\n" \ "name: %s\nstore: %s\ntransport: %s\n", - name, store_account, transport_account); + name, store_account, transport_account, TRUE); g_free (store_account); g_free (transport_account); @@ -227,7 +227,7 @@ START_TEST (test_add_exists_remove_account_invalid) result = modest_account_mgr_add_account (NULL, TEST_MODEST_ACCOUNT_NAME, "store_account", - "transport_account"); + "transport_account", TRUE); fail_unless (!result, "modest_account_mgr_add_account does not return FALSE when" \ "passing a NULL ModestAccountMgr"); @@ -236,7 +236,7 @@ START_TEST (test_add_exists_remove_account_invalid) result = modest_account_mgr_add_account (account_mgr, NULL, "store_account", - "transport_account"); + "transport_account", TRUE); fail_unless (!result, "modest_account_mgr_add_account does not return FALSE when" \ "passing a NULL account name"); @@ -245,7 +245,7 @@ START_TEST (test_add_exists_remove_account_invalid) result = modest_account_mgr_add_account (account_mgr, "ïnválid//accountñ//nÄméç", "store_account", - "transport_account"); + "transport_account", TRUE); fail_unless (!result, "modest_account_mgr_add_account does not return FALSE when" \ "passing an invalid account name"); -- 1.7.9.5