diff options
author | Peter Williams <peterw@ximian.com> | 2001-08-22 23:50:42 +0800 |
---|---|---|
committer | Peter Williams <peterw@src.gnome.org> | 2001-08-22 23:50:42 +0800 |
commit | e84ebd2e0a9ff78773bdd2cecfe0f2b6ebc2c252 (patch) | |
tree | ba38fc5831643d3a2646d89b63091272827f6959 /mail/mail-config-druid.c | |
parent | ad546eab4d56710ea0520353a276f3619f661d17 (diff) | |
download | gsoc2013-evolution-e84ebd2e0a9ff78773bdd2cecfe0f2b6ebc2c252.tar.gz gsoc2013-evolution-e84ebd2e0a9ff78773bdd2cecfe0f2b6ebc2c252.tar.zst gsoc2013-evolution-e84ebd2e0a9ff78773bdd2cecfe0f2b6ebc2c252.zip |
Prevent the user from creating two accounts with the same name.
2001-08-22 Peter Williams <peterw@ximian.com>
Prevent the user from creating two accounts with the same name.
* mail-config.c (impl_GNOME_Evolution_MailConfig_addAccount): Abort
if the account has the same name as another account.
* mail-account-gui.c (mail_account_gui_save): Don't let the user
save if the account has the same name as another account.
* mail-config-druid.c (management_check): Disable the next button
if the account name is the same as a preexisting account.
(construct): The only part of 'pages' that was being used was the
name. 'wizard_pages' now has the callbacks, while 'pages' is just
an array of char *'s.
(wizard_finish_cb): Save the account first because that's the
right way, and try to honor mail_account_gui_save's return value.
* mail-config.glade: Add a label noting that you're not allowed
to create two accounts with the same name.
svn path=/trunk/; revision=12384
Diffstat (limited to 'mail/mail-config-druid.c')
-rw-r--r-- | mail/mail-config-druid.c | 69 |
1 files changed, 20 insertions, 49 deletions
diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c index 966894bc81..f5781cacb9 100644 --- a/mail/mail-config-druid.c +++ b/mail/mail-config-druid.c @@ -355,6 +355,10 @@ management_check (MailConfigWizard *wizard) text = gtk_entry_get_text (wizard->gui->account_name); next_sensitive = text && *text; + /* no accounts with the same name */ + if (next_sensitive && mail_config_get_account_by_name (text)) + next_sensitive = FALSE; + evolution_wizard_set_buttons_sensitive (wizard->wizard, TRUE, next_sensitive, TRUE, NULL); } @@ -380,7 +384,6 @@ management_changed (GtkWidget *widget, gpointer data) management_check (gui); } - static MailConfigAccount * make_account (void) { @@ -403,48 +406,14 @@ make_account (void) return account; } -static struct { - char *name; - GtkSignalFunc next_func; - GtkSignalFunc prepare_func; - GtkSignalFunc back_func; - GtkSignalFunc finish_func; -} pages[] = { - { "identity_page", - GTK_SIGNAL_FUNC (identity_next), - GTK_SIGNAL_FUNC (identity_prepare), - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, - { "source_page", - GTK_SIGNAL_FUNC (source_next), - GTK_SIGNAL_FUNC (source_prepare), - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, - { "extra_page", - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (extra_prepare), - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, - { "transport_page", - GTK_SIGNAL_FUNC (transport_next), - GTK_SIGNAL_FUNC (transport_prepare), - GTK_SIGNAL_FUNC (transport_back), - GTK_SIGNAL_FUNC (NULL) }, - { "management_page", - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (management_prepare), - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) }, - { "finish_page", - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (druid_finish) }, - { NULL, - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL), - GTK_SIGNAL_FUNC (NULL) } +static const char *pages[] = { + "identity_page", + "source_page", + "extra_page", + "transport_page", + "management_page", + "finish_page", + NULL }; static int @@ -611,11 +580,11 @@ construct (MailConfigDruid *druid) g_hash_table_destroy (page_hash); } page_hash = g_hash_table_new (NULL, NULL); - for (i = 0; pages[i].name != NULL; i++) { + for (i = 0; pages[i] != NULL; i++) { GtkWidget *page; GnomeDruidPageStandard *dpage; - page = glade_xml_get_widget (druid->xml, pages[i].name); + page = glade_xml_get_widget (druid->xml, pages[i]); /* Store pages */ g_hash_table_insert (page_hash, page, GINT_TO_POINTER (i)); page_list = g_list_append (page_list, page); @@ -703,7 +672,6 @@ get_fn (EvolutionWizard *wizard, gtk_signal_connect (GTK_OBJECT (gui->gui->source.path), "changed", source_changed, gui); gtk_signal_connect (GTK_OBJECT (gui->gui->transport.hostname), - "changed", transport_changed, gui); gtk_signal_connect (GTK_OBJECT (gui->gui->transport.username), "changed", transport_changed, gui); @@ -837,12 +805,15 @@ wizard_finish_cb (EvolutionWizard *wizard, { MailAccountGui *gui = w->gui; - /* Add the account to our list (do it first because future + /* Save the settings for that account */ + if (mail_account_gui_save (gui) == FALSE) + /* problem. Um, how to keep the druid alive? */ + return; + + /* Add the account to our list (do it early because future steps might want to access config->accounts) */ mail_config_add_account (gui->account); - /* Save the settings for that account */ - mail_account_gui_save (gui); if (gui->account->source) gui->account->source->enabled = TRUE; |