aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/groupwise-features
diff options
context:
space:
mode:
authorShreyas Srinivasan <sshreyas@novell.com>2005-10-19 17:40:06 +0800
committerShreyas Srinivasan <shres@src.gnome.org>2005-10-19 17:40:06 +0800
commit722114449fa53241b844fb2b8e748ef915695ac3 (patch)
treec9ea2d93dcc66335c71308faea747e1449a96e08 /plugins/groupwise-features
parent91a6e747a0d241da4d1eba7084619dfe94e2a4ce (diff)
downloadgsoc2013-evolution-722114449fa53241b844fb2b8e748ef915695ac3.tar
gsoc2013-evolution-722114449fa53241b844fb2b8e748ef915695ac3.tar.gz
gsoc2013-evolution-722114449fa53241b844fb2b8e748ef915695ac3.tar.bz2
gsoc2013-evolution-722114449fa53241b844fb2b8e748ef915695ac3.tar.lz
gsoc2013-evolution-722114449fa53241b844fb2b8e748ef915695ac3.tar.xz
gsoc2013-evolution-722114449fa53241b844fb2b8e748ef915695ac3.tar.zst
gsoc2013-evolution-722114449fa53241b844fb2b8e748ef915695ac3.zip
Dont try to connect when the account is offline. Also connect to the
2005-10-19 Shreyas Srinivasan <sshreyas@novell.com> * proxy.c (org_gnome_proxy): Dont try to connect when the account is offline. Also connect to the server only when the proxy tab is clicked. * Fixes #314297, #314345 svn path=/trunk/; revision=30531
Diffstat (limited to 'plugins/groupwise-features')
-rw-r--r--plugins/groupwise-features/ChangeLog6
-rw-r--r--plugins/groupwise-features/proxy.c54
2 files changed, 54 insertions, 6 deletions
diff --git a/plugins/groupwise-features/ChangeLog b/plugins/groupwise-features/ChangeLog
index 6d93f95b69..7cfcbd29aa 100644
--- a/plugins/groupwise-features/ChangeLog
+++ b/plugins/groupwise-features/ChangeLog
@@ -1,3 +1,9 @@
+2005-10-19 Shreyas Srinivasan <sshreyas@novell.com>
+
+ * proxy.c (org_gnome_proxy): Dont try to connect when the account is
+ offline. Also connect to the server only when the proxy tab is clicked.
+ * Fixes #314297, #314345
+
2005-10-14 Vivek Jain <jvivek@novell.com>
* proxy.c :(proxy_get_cnc)
diff --git a/plugins/groupwise-features/proxy.c b/plugins/groupwise-features/proxy.c
index db16d4f502..3828a8ab2a 100644
--- a/plugins/groupwise-features/proxy.c
+++ b/plugins/groupwise-features/proxy.c
@@ -54,11 +54,13 @@
#include <mail/em-config.h>
#include <mail/mail-component.h>
#include <mail/mail-ops.h>
+#include <mail/mail-session.h>
#include <e-util/e-account.h>
#include <e-util/e-account-list.h>
#include <e-util/e-icon-factory.h>
#include <camel/camel-url.h>
+#include <camel/camel-offline-store.h>
#include <libedataserverui/e-passwords.h>
#include <libedataserverui/e-name-selector.h>
#include <proxy.h>
@@ -73,6 +75,8 @@
static GObjectClass *parent_class = NULL;
+static int proxy_page_changed_cb (GtkNotebook *notebook, GtkNotebookPage *page, int num, EAccount *account);
+
struct _proxyDialogPrivate {
/* Glade XML data for the Add/Edit Proxy dialog*/
GladeXML *xml;
@@ -525,12 +529,13 @@ proxy_abort (GtkWidget *button, EConfigHookItemFactoryData *data)
account = target_account->account;
prd = g_object_get_data ((GObject *)account, "prd");
- if (prd == NULL)
+ if (!prd || !prd->priv || !prd->priv->proxy_list)
return;
g_object_unref (prd);
prd = NULL;
}
+
void
proxy_commit (GtkWidget *button, EConfigHookItemFactoryData *data)
{
@@ -640,9 +645,18 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data)
GtkButton *addProxy, *removeProxy, *editProxy;
proxyDialog *prd;
proxyDialogPrivate *priv;
+ CamelOfflineStore *store;
+ CamelException ex;
+ int pag_num;
target_account = (EMConfigTargetAccount *)data->config->target;
account = target_account->account;
+
+ if (!(store = (CamelOfflineStore *) camel_session_get_service (session, e_account_get_string(account, E_ACCOUNT_SOURCE_URL), CAMEL_PROVIDER_STORE, &ex))) {
+ camel_exception_clear (&ex);
+ return NULL;
+ }
+
if (g_strrstr (e_account_get_string(account, E_ACCOUNT_SOURCE_URL), "groupwise://"))
{
prd = proxy_dialog_new ();
@@ -650,7 +664,7 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data)
priv = prd->priv;
priv->xml_tab = glade_xml_new (EVOLUTION_GLADEDIR "/proxy-listing.glade", "proxy_vbox", NULL);
- if (account->enabled) {
+ if (account->enabled && (store->state == CAMEL_OFFLINE_STORE_NETWORK_AVAIL)) {
priv->tab_dialog = GTK_WIDGET (glade_xml_get_widget (priv->xml_tab, "proxy_vbox"));
priv->tree = GTK_TREE_VIEW (glade_xml_get_widget (priv->xml_tab, "proxy_access_list"));
priv->store = gtk_tree_store_new (2,
@@ -670,9 +684,11 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data)
prd->cnc = proxy_get_cnc(account);
priv->proxy_list = NULL;
- if (e_gw_connection_get_proxy_access_list(prd->cnc, &priv->proxy_list)!= E_GW_CONNECTION_STATUS_OK)
- return NULL;
- proxy_update_tree_view (account);
+ } else if (account->enabled){
+ GtkWidget *label;
+ priv->tab_dialog = gtk_vbox_new (TRUE, 10);
+ label = gtk_label_new (_("The Proxy tab will be available only when the account is online."));
+ gtk_box_pack_start ((GtkBox *)priv->tab_dialog, label, TRUE, TRUE, 10);
} else {
GtkWidget *label;
priv->tab_dialog = gtk_vbox_new (TRUE, 10);
@@ -681,22 +697,48 @@ org_gnome_proxy (EPlugin *epl, EConfigHookItemFactoryData *data)
}
gtk_notebook_append_page ((GtkNotebook *)(data->parent), (GtkWidget *)priv->tab_dialog, gtk_label_new("Proxy"));
+ g_signal_connect ((GtkNotebook *)(data->parent), "switch-page", G_CALLBACK (proxy_page_changed_cb), account);
+ pag_num = gtk_notebook_page_num ((GtkNotebook *)(data->parent), (GtkWidget *)priv->tab_dialog);
+ g_object_set_data ((GObject *) account, "proxy_tab_num", pag_num);
gtk_widget_show_all (priv->tab_dialog);
} else if (!g_strrstr (e_account_get_string(account, E_ACCOUNT_SOURCE_URL), "groupwise://")) {
prd = g_object_get_data ((GObject *) account, "prd");
if (prd) {
priv = prd->priv;
- int pag_num;
+
if (priv) {
pag_num = gtk_notebook_page_num ( (GtkNotebook *)(data->parent), (GtkWidget *) priv->tab_dialog);
gtk_notebook_remove_page ( (GtkNotebook *)(data->parent), pag_num);
}
}
}
+
+ camel_object_unref (store);
return NULL;
}
+static int
+proxy_page_changed_cb (GtkNotebook *notebook, GtkNotebookPage *page, int num, EAccount *account)
+{
+ proxyDialog *prd;
+ proxyDialogPrivate *priv;
+
+ prd = g_object_get_data ((GObject *) account, "prd");
+
+ if (!prd || !prd->priv)
+ return;
+
+ priv = prd->priv;
+
+ if (num == g_object_get_data ((GObject *) account, "proxy_tab_num") && account->enabled) {
+ if (e_gw_connection_get_proxy_access_list(prd->cnc, &priv->proxy_list)!= E_GW_CONNECTION_STATUS_OK)
+ return NULL;
+ proxy_update_tree_view (account);
+ }
+ return TRUE;
+}
+
static void
proxy_cancel(GtkWidget *button, EAccount *account)
{