aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-accounts.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-03-27 13:23:27 +0800
committerDan Winship <danw@src.gnome.org>2001-03-27 13:23:27 +0800
commit6dd8aabeeee1945c4d96af5e045b75995db56517 (patch)
treeda872e79836a7a5237ed5e37cefe71a789f66ca0 /mail/mail-accounts.c
parent0b8af6dc0a87c119bf91b7aa62157d627cf573d0 (diff)
downloadgsoc2013-evolution-6dd8aabeeee1945c4d96af5e045b75995db56517.tar.gz
gsoc2013-evolution-6dd8aabeeee1945c4d96af5e045b75995db56517.tar.zst
gsoc2013-evolution-6dd8aabeeee1945c4d96af5e045b75995db56517.zip
Probably the very last new config dialog ever. (Ha ha). From Anna, based
* mail-config.glade: Probably the very last new config dialog ever. (Ha ha). From Anna, based on a story by me. * mail-account-gui.c: New code for the new mail-config.glade. This abstracts out all of the common code between the account editor and the druid. It also handles the spiffy new provider-specific config stuff. FIXME: The code to check if a service is ok or not is no longer there... waiting until the online/offline stuff from the shell appears. * mail-account-editor.c, mail-config-druid.c: These are much smaller now, since most of the interesting bits moved to mail-account-gui.c * mail-accounts.c: Add an enabled/disabled column/button to replace the checkbox that used to be in the editor, because it really makes more sense to have it out here. This looks ugly. Probably ought to ETable it... (load_accounts): Fill in the enabled column. (mail_select, mail_unselect): toggle the sensitivity and name of the Enable/Disable button appropriately (mail_able): Handle the enable/disable button. * mail-config.c: Remove reply-to from MailConfigIdentity since it didn't belong there (and wasn't being saved anyway). (mail_config_check_service): Simplify this a bit. This really needs to pop up a dialog with a "connecting..." message and a cancel button. svn path=/trunk/; revision=8971
Diffstat (limited to 'mail/mail-accounts.c')
-rw-r--r--mail/mail-accounts.c49
1 files changed, 40 insertions, 9 deletions
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c
index dfe2a1248f..7bb2f5ca9e 100644
--- a/mail/mail-accounts.c
+++ b/mail/mail-accounts.c
@@ -102,7 +102,7 @@ load_accounts (MailAccountsDialog *dialog)
while (node) {
CamelURL *url;
- gchar *text[2];
+ gchar *text[3];
account = node->data;
@@ -110,17 +110,17 @@ load_accounts (MailAccountsDialog *dialog)
url = camel_url_new (account->source->url, NULL);
else
url = NULL;
-
- text[0] = g_strdup (account->name);
- text[1] = g_strdup_printf ("%s%s", url && url->protocol ? url->protocol : _("None"),
+
+ text[0] = (account->source && account->source->enabled) ? "+" : "";
+ text[1] = account->name;
+ text[2] = g_strdup_printf ("%s%s", url && url->protocol ? url->protocol : _("None"),
account->default_account ? _(" (default)") : "");
if (url)
camel_url_free (url);
gtk_clist_append (dialog->mail_accounts, text);
- g_free (text[0]);
- g_free (text[1]);
+ g_free (text[2]);
/* set the account on the row */
gtk_clist_set_row_data (dialog->mail_accounts, i, (gpointer) account);
@@ -132,23 +132,31 @@ load_accounts (MailAccountsDialog *dialog)
gtk_clist_thaw (dialog->mail_accounts);
}
+#ifdef ENABLE_NTTP
static void
load_news (MailAccountsDialog *dialog)
{
/* FIXME: implement */
;
}
+#endif
/* mail callbacks */
static void
mail_select (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data)
{
MailAccountsDialog *dialog = data;
-
+ MailConfigAccount *account = gtk_clist_get_row_data (clist, row);
+
dialog->accounts_row = row;
gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), TRUE);
+ if (account->source && account->source->enabled)
+ gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->mail_able)->child), _("Disable"));
+ else
+ gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->mail_able)->child), _("Enable"));
}
static void
@@ -160,6 +168,7 @@ mail_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gp
gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), FALSE);
}
static void
@@ -197,7 +206,7 @@ mail_edit (GtkButton *button, gpointer data)
MailAccountsDialog *dialog = data;
if (dialog->accounts_row >= 0) {
- const MailConfigAccount *account;
+ MailConfigAccount *account;
MailAccountEditor *editor;
account = gtk_clist_get_row_data (dialog->mail_accounts, dialog->accounts_row);
@@ -259,6 +268,7 @@ mail_delete (GtkButton *button, gpointer data)
gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), FALSE);
}
}
}
@@ -281,6 +291,24 @@ mail_default (GtkButton *button, gpointer data)
}
}
+static void
+mail_able (GtkButton *button, gpointer data)
+{
+ MailAccountsDialog *dialog = data;
+ const MailConfigAccount *account;
+
+ if (dialog->accounts_row >= 0) {
+ int row;
+
+ row = dialog->accounts_row;
+ account = gtk_clist_get_row_data (dialog->mail_accounts, row);
+ account->source->enabled = !account->source->enabled;
+ mail_config_write ();
+ load_accounts (dialog);
+ gtk_clist_select_row (dialog->mail_accounts, row, 0);
+ }
+}
+
#ifdef ENABLE_NNTP
/* news callbacks */
static void
@@ -446,7 +474,7 @@ construct (MailAccountsDialog *dialog)
GladeXML *gui;
GtkWidget *notebook;
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "mail-accounts-dialog");
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL);
dialog->gui = gui;
/* get our toplevel widget */
@@ -480,6 +508,9 @@ construct (MailAccountsDialog *dialog)
dialog->mail_default = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailDefault"));
gtk_signal_connect (GTK_OBJECT (dialog->mail_default), "clicked",
GTK_SIGNAL_FUNC (mail_default), dialog);
+ dialog->mail_able = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailAble"));
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_able), "clicked",
+ GTK_SIGNAL_FUNC (mail_able), dialog);
#if defined (ENABLE_NNTP)
dialog->news_accounts = GTK_CLIST (glade_xml_get_widget (gui, "clistAccounts"));