diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2001-01-11 08:18:40 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-01-11 08:18:40 +0800 |
commit | 43f23f54d91c91143544034356cb42e415da9eb9 (patch) | |
tree | 39a4c5fc6bee209348d133e80a324eb2f5b5fe39 /mail | |
parent | ee65e2a7329a9f6d818f5cc61092f05b67f4c5bd (diff) | |
download | gsoc2013-evolution-43f23f54d91c91143544034356cb42e415da9eb9.tar.gz gsoc2013-evolution-43f23f54d91c91143544034356cb42e415da9eb9.tar.zst gsoc2013-evolution-43f23f54d91c91143544034356cb42e415da9eb9.zip |
New function that explains to the user why he can't do the action he
2001-01-10 Jeffrey Stedfast <fejj@helixcode.com>
* mail-callbacks.c (configure_mail): New function that explains to
the user why he can't do the action he requested and then procedes
to ask if he'd like to configure his accounts now.
(check_send_configuration): If the user doesn't have configured
accounts, don't let him continue and call configure_mail().
(fetch_mail): Same.
(send_queued_mail): Same.
(send_receieve_mail): Same.
* mail-config.c (mail_config_write): Don't save a "is_configured"
variable. Instead we'll just check to see if we have accounts - if
yes, then configured == TRUE.
(mail_config_is_configured): return accounts != NULL.
(mail_config_get_default_account): Mark the first account as the
default if none are marked.
svn path=/trunk/; revision=7377
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 18 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 38 | ||||
-rw-r--r-- | mail/mail-config.c | 22 |
3 files changed, 38 insertions, 40 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 3a5b1c973d..1fa988b000 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,23 @@ 2001-01-10 Jeffrey Stedfast <fejj@helixcode.com> + * mail-callbacks.c (configure_mail): New function that explains to + the user why he can't do the action he requested and then procedes + to ask if he'd like to configure his accounts now. + (check_send_configuration): If the user doesn't have configured + accounts, don't let him continue and call configure_mail(). + (fetch_mail): Same. + (send_queued_mail): Same. + (send_receieve_mail): Same. + + * mail-config.c (mail_config_write): Don't save a "is_configured" + variable. Instead we'll just check to see if we have accounts - if + yes, then configured == TRUE. + (mail_config_is_configured): return accounts != NULL. + (mail_config_get_default_account): Mark the first account as the + default if none are marked. + +2001-01-10 Jeffrey Stedfast <fejj@helixcode.com> + * mail-account-editor.c (source_auth_type_changed): Set the sensitivity of the Password label too. diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index f26380773a..7943e27443 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -64,14 +64,11 @@ struct post_send_data { guint32 flags; }; -static gboolean -check_configured (FolderBrowser *fb) +static void +configure_mail (FolderBrowser *fb) { MailConfigDruid *druid; - if (mail_config_is_configured ()) - return TRUE; - if (fb) { GtkWidget *dialog; @@ -83,7 +80,7 @@ check_configured (FolderBrowser *fb) GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL); gnome_dialog_set_parent (GNOME_DIALOG (dialog), - GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET(fb), GTK_TYPE_WINDOW))); + GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (fb), GTK_TYPE_WINDOW))); switch (gnome_dialog_run_and_close (GNOME_DIALOG (dialog))) { case 0: @@ -95,10 +92,7 @@ check_configured (FolderBrowser *fb) default: break; } - - return mail_config_is_configured (); - } else - return FALSE; + } } static gboolean @@ -107,7 +101,8 @@ check_send_configuration (FolderBrowser *fb) const MailConfigAccount *account; /* Check general */ - if (!check_configured (fb)) { + if (!mail_config_is_configured ()) { + configure_mail (fb); return FALSE; } @@ -162,25 +157,14 @@ fetch_mail (GtkWidget *widget, gpointer user_data) { GSList *sources; - if (!check_configured (FOLDER_BROWSER (user_data))) { - GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (user_data), - GTK_TYPE_WINDOW); - - gnome_error_dialog_parented (_("You have no mail sources " - "configured"), - GTK_WINDOW (win)); + if (!mail_config_is_configured ()) { + configure_mail (FOLDER_BROWSER (user_data)); return; } sources = mail_config_get_sources (); if (!sources || !sources->data) { - GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (user_data), - GTK_TYPE_WINDOW); - - gnome_error_dialog_parented (_("You have no mail sources " - "configured"), - GTK_WINDOW (win)); return; } @@ -207,6 +191,7 @@ send_queued_mail (GtkWidget *widget, gpointer user_data) const MailConfigAccount *account; if (!mail_config_is_configured ()) { + configure_mail (FOLDER_BROWSER (user_data)); return; } @@ -236,6 +221,11 @@ void send_receieve_mail (GtkWidget *widget, gpointer user_data) { /* receive first then send, this is a temp fix for POP-before-SMTP */ + if (!mail_config_is_configured ()) { + configure_mail (FOLDER_BROWSER (user_data)); + return; + } + fetch_mail (widget, user_data); send_queued_mail (widget, user_data); } diff --git a/mail/mail-config.c b/mail/mail-config.c index f67d2c7578..f238207d79 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -35,7 +35,6 @@ #include "mail-ops.h" typedef struct { - gboolean configured; gboolean thread_list; gboolean view_source; gint paned_size; @@ -201,11 +200,6 @@ config_read (void) mail_config_clear (); - /* Configured */ - str = g_strdup_printf ("=%s/config/General=/General/configured", evolution_dir); - config->configured = gnome_config_get_bool (str); - g_free (str); - /* Accounts */ str = g_strdup_printf ("=%s/config/Mail=/Accounts/", evolution_dir); gnome_config_push_prefix (str); @@ -326,13 +320,6 @@ mail_config_write (void) gchar *str; gint len, i; - /* Configured switch */ - str = g_strdup_printf ("=%s/config/General=/General/configured", - evolution_dir); - config->configured = TRUE; - gnome_config_set_bool (str, config->configured); - g_free (str); - /* Accounts */ str = g_strdup_printf ("=%s/config/Mail=/Accounts/", evolution_dir); gnome_config_push_prefix (str); @@ -456,7 +443,7 @@ mail_config_write_on_exit (void) gboolean mail_config_is_configured (void) { - return config->configured; + return config->accounts != NULL; } gboolean @@ -537,8 +524,11 @@ mail_config_get_default_account (void) l = l->next; } - /* non are marked as default so return the first one */ - return (MailConfigAccount *)config->accounts->data; + /* none are marked as default so mark the first one as the default */ + account = config->accounts->data; + mail_config_set_default_account (account); + + return account; } const GSList * |