aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorShreyas Srinivasan <sshreyas@novell.com>2005-07-10 18:03:56 +0800
committerShreyas Srinivasan <shres@src.gnome.org>2005-07-10 18:03:56 +0800
commit7d9c68cbe5307c661480506c53c6e0c4db56d98e (patch)
tree81b08b8fe0155bbef550a1ac53b4ad57035410f7 /mail
parent38035659d1d57b512b28b19dc4436609de3d52ca (diff)
downloadgsoc2013-evolution-7d9c68cbe5307c661480506c53c6e0c4db56d98e.tar
gsoc2013-evolution-7d9c68cbe5307c661480506c53c6e0c4db56d98e.tar.gz
gsoc2013-evolution-7d9c68cbe5307c661480506c53c6e0c4db56d98e.tar.bz2
gsoc2013-evolution-7d9c68cbe5307c661480506c53c6e0c4db56d98e.tar.lz
gsoc2013-evolution-7d9c68cbe5307c661480506c53c6e0c4db56d98e.tar.xz
gsoc2013-evolution-7d9c68cbe5307c661480506c53c6e0c4db56d98e.tar.zst
gsoc2013-evolution-7d9c68cbe5307c661480506c53c6e0c4db56d98e.zip
Add new functions to remove proxy accounts and proxies created by the
2005-07-10 Shreyas Srinivasan <sshreyas@novell.com> * mail-config.[ch]: Add new functions to remove proxy accounts and proxies created by the account. * mail-compnent.c: Remove proxy accounts at startup * mail.error.xml: Add warnings for proxy disable and removal of a proxy when its parents are removed. * em-account-prefs.c: Add checks not to display proxies and handling of parent removal/ disabling. svn path=/trunk/; revision=29698
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/em-account-prefs.c94
-rw-r--r--mail/mail-component.c2
-rw-r--r--mail/mail-config.c18
-rw-r--r--mail/mail-config.h4
-rw-r--r--mail/mail.error.xml9
6 files changed, 104 insertions, 33 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index ae5efa8bd0..810b854133 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,13 @@
+2005-07-10 Shreyas Srinivasan <sshreyas@novell.com>
+
+ * mail-config.[ch]: Add new functions to remove proxy accounts and
+ proxies created by the account.
+ * mail-compnent.c: Remove proxy accounts at startup
+ * mail.error.xml: Add warnings for proxy disable and removal of a
+ proxy when its parents are removed.
+ * em-account-prefs.c: Add checks not to display proxies and
+ handling of parent removal/ disabling.
+
2005-07-06 Vivek Jain <jvivek@novell.com>
* em-junk-filter.c : moved to plugins/sa-junk-plugin
diff --git a/mail/em-account-prefs.c b/mail/em-account-prefs.c
index 0378bc769e..a3c2256525 100644
--- a/mail/em-account-prefs.c
+++ b/mail/em-account-prefs.c
@@ -192,7 +192,7 @@ account_edit_clicked (GtkButton *button, gpointer user_data)
if (gtk_tree_selection_get_selected (selection, &model, &iter))
gtk_tree_model_get (model, &iter, 3, &account, -1);
- if (account) {
+ if (account && !account->parent_uid && !mail_config_has_proxies (account)) {
EMAccountEditor *emae;
/** @HookPoint-EMConfig: Mail Account Editor
@@ -227,6 +227,7 @@ account_delete_clicked (GtkButton *button, gpointer user_data)
GtkTreeModel *model;
GtkTreeIter iter;
int ans;
+ gboolean has_proxies = FALSE;
selection = gtk_tree_view_get_selection (prefs->table);
if (gtk_tree_selection_get_selected (selection, &model, &iter))
@@ -235,8 +236,10 @@ account_delete_clicked (GtkButton *button, gpointer user_data)
/* make sure we have a valid account selected and that we aren't editing anything... */
if (account == NULL || prefs->editor != NULL)
return;
-
- ans = e_error_run(PREFS_WINDOW(prefs), "mail:ask-delete-account", NULL);
+
+ has_proxies = mail_config_has_proxies (account);
+ ans = e_error_run(PREFS_WINDOW(prefs), has_proxies?"mail:ask-delete-account-with-proxies":"mail:ask-delete-account",NULL);
+
if (ans == GTK_RESPONSE_YES) {
int len;
@@ -244,6 +247,10 @@ account_delete_clicked (GtkButton *button, gpointer user_data)
if (account->enabled && account->source && account->source->url)
mail_component_remove_store_by_uri (mail_component_peek (), account->source->url);
+ /* remove all the proxies account has created*/
+ if (has_proxies)
+ mail_config_remove_account_proxies (account);
+
/* remove it from the config file */
mail_config_remove_account (account);
accounts = mail_config_get_accounts ();
@@ -298,7 +305,7 @@ account_able_changed(EAccount *account)
mail_component_load_store_by_uri (component,
account->source->url,
account->name);
- else
+ else
mail_component_remove_store_by_uri (component, account->source->url);
}
@@ -323,8 +330,8 @@ account_able_clicked (GtkButton *button, gpointer user_data)
gtk_button_set_label (prefs->mail_able, account->enabled ? _("Disable") : _("Enable"));
/* let the rest of the application know it changed */
- e_account_list_change(mail_config_get_accounts(), account);
- account_able_changed(account);
+ e_account_list_change (mail_config_get_accounts(), account);
+ account_able_changed (account);
}
}
@@ -344,17 +351,32 @@ account_able_toggled (GtkCellRendererToggle *renderer, char *arg1, gpointer user
if (gtk_tree_model_get_iter (model, &iter, path)) {
gtk_tree_model_get (model, &iter, 3, &account, -1);
+
+ if (mail_config_has_proxies (account)) {
+ int ans;
+
+ ans = e_error_run(PREFS_WINDOW(prefs), "mail:ask-delete-proxy-accounts",NULL);
+
+ if (ans == GTK_RESPONSE_NO) {
+ gtk_tree_path_free (path);
+ return;
+ }
+
+ mail_config_remove_account_proxies (account);
+ gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), 1);
+ }
+
account->enabled = !account->enabled;
+ e_account_list_change(mail_config_get_accounts(), account);
+ account_able_changed (account);
gtk_list_store_set ((GtkListStore *) model, &iter, 0, account->enabled, -1);
-
+
if (gtk_tree_selection_iter_is_selected (selection, &iter))
gtk_button_set_label (prefs->mail_able, account->enabled ? _("Disable") : _("Enable"));
/* let the rest of the application know it changed */
- e_account_list_change(mail_config_get_accounts(), account);
- account_able_changed(account);
}
-
+
gtk_tree_path_free (path);
}
@@ -371,6 +393,7 @@ account_cursor_change (GtkTreeSelection *selection, EMAccountPrefs *prefs)
EAccount *account = NULL;
GtkTreeModel *model;
GtkTreeIter iter;
+ const char *url = NULL;
int state;
state = gconf_client_key_is_writable(mail_config_get_gconf_client(), "/apps/evolution/mail/accounts", NULL);
@@ -378,6 +401,7 @@ account_cursor_change (GtkTreeSelection *selection, EMAccountPrefs *prefs)
state = gtk_tree_selection_get_selected (selection, &model, &iter);
if (state) {
gtk_tree_model_get (model, &iter, 3, &account, -1);
+ url = e_account_get_string (account, E_ACCOUNT_SOURCE_URL);
if (account->source && account->enabled)
gtk_button_set_label (prefs->mail_able, _("Disable"));
else
@@ -389,8 +413,10 @@ account_cursor_change (GtkTreeSelection *selection, EMAccountPrefs *prefs)
} else {
gtk_widget_set_sensitive (GTK_WIDGET (prefs), FALSE);
}
+
+ if( url != NULL )
+ gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), !mail_config_has_proxies(account));
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), state);
gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), state);
gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), state);
gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), state);
@@ -419,31 +445,33 @@ mail_accounts_load (EMAccountPrefs *prefs)
CamelURL *url;
account = (EAccount *) e_iterator_get (node);
+
+ if (!account->parent_uid) {
+ url = account->source && account->source->url ? camel_url_new (account->source->url, NULL) : NULL;
+
+ gtk_list_store_append (model, &iter);
+ if (account == default_account) {
+ /* translators: default account indicator */
+ name = val = g_strdup_printf ("%s %s", account->name, _("[Default]"));
+ } else {
+ val = account->name;
+ name = NULL;
+ }
+
+ gtk_list_store_set (model, &iter,
+ 0, account->enabled,
+ 1, val,
+ 2, url && url->protocol ? url->protocol : (char *) _("None"),
+ 3, account,
+ -1);
+ g_free (name);
+
+ if (url)
+ camel_url_free (url);
- url = account->source && account->source->url ? camel_url_new (account->source->url, NULL) : NULL;
-
- gtk_list_store_append (model, &iter);
- if (account == default_account) {
- /* translators: default account indicator */
- name = val = g_strdup_printf ("%s %s", account->name, _("[Default]"));
- } else {
- val = account->name;
- name = NULL;
+ row++;
}
- gtk_list_store_set (model, &iter,
- 0, account->enabled,
- 1, val,
- 2, url && url->protocol ? url->protocol : (char *) _("None"),
- 3, account,
- -1);
- g_free (name);
-
- if (url)
- camel_url_free (url);
-
- row++;
-
e_iterator_next (node);
}
diff --git a/mail/mail-component.c b/mail/mail-component.c
index ac6453de28..b8aa43d910 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -359,6 +359,7 @@ mc_startup(MailComponent *mc)
started = 1;
mc_setup_local_store(mc);
+ mail_config_prune_proxies ();
load_accounts(mc, mail_config_get_accounts());
vfolder_load_storage();
}
@@ -711,6 +712,7 @@ impl_quit(PortableServer_Servant servant, CORBA_Environment *ev)
{
MailComponent *mc = MAIL_COMPONENT(bonobo_object_from_servant(servant));
+ mail_config_prune_proxies ();
switch (mc->priv->quit_state) {
case MC_QUIT_START: {
int now = time(NULL)/60/60/24, days;
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 72fa5c6695..520aec3091 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -671,6 +671,24 @@ mail_config_get_account_by_transport_url (const char *transport_url)
return NULL;
}
+int
+mail_config_has_proxies (EAccount *account)
+{
+ return e_account_list_account_has_proxies (config->accounts, account);
+}
+
+void
+mail_config_remove_account_proxies (EAccount *account)
+{
+ e_account_list_remove_account_proxies (config->accounts, account);
+}
+
+void
+mail_config_prune_proxies (void)
+{
+ e_account_list_prune_proxies (config->accounts);
+}
+
EAccountList *
mail_config_get_accounts (void)
{
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 679dabeb7d..ec8fd74b5b 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -134,6 +134,10 @@ void mail_config_add_account (struct _EAccount *account);
void mail_config_remove_account (struct _EAccount *account);
void mail_config_set_default_account (struct _EAccount *account);
+void mail_config_remove_account_proxies (struct _EAccount *account);
+void mail_config_prune_proxies (void);
+int mail_config_has_proxies (struct _EAccount *account);
+
struct _EAccountIdentity *mail_config_get_default_identity (void);
struct _EAccountService *mail_config_get_default_transport (void);
diff --git a/mail/mail.error.xml b/mail/mail.error.xml
index d769aad1c2..5cb2138bdb 100644
--- a/mail/mail.error.xml
+++ b/mail/mail.error.xml
@@ -249,6 +249,15 @@ The message is stored in the Outbox folder. Check the message for errors and re
<button stock="gtk-no" _label="Don't delete" response="GTK_RESPONSE_NO"/>
</error>
+<error id="ask-delete-account-with-proxies" type="question" default="GTK_RESPONSE_NO" modal="true">
+ <_title>Delete account?</_title>
+ <_primary>Are you sure you want to delete this account and all its proxies?</_primary>
+ <_secondary xml:space="preserve">If you proceed, the account information and
+all proxy information will be deleted permanently.</_secondary>
+ <button stock="gtk-delete" response="GTK_RESPONSE_YES"/>
+ <button stock="gtk-no" _label="Don't delete" response="GTK_RESPONSE_NO"/>
+ </error>
+
<error id="no-save-signature" type="error">
<_primary>Could not save signature file.</_primary>
<_secondary xml:space="preserve">Because &quot;{0}&quot;.</_secondary>