[evolution-patches] [Groupwise Proxy] Fix 314347



Hey,

Attaching patches which fixes
http://bugzilla.gnome.org/show_bug.cgi?id=314347

Basically makes the server request only when the 
proxy tab is clicked from its previous behavior of
making a server call when the edit->preferences->account
dialog is launched.

Cheers,
Shreyas
Index: proxy.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/groupwise-features/proxy.c,v
retrieving revision 1.9
diff -u -p -w -r1.9 proxy.c
--- proxy.c	29 Aug 2005 06:33:58 -0000	1.9
+++ proxy.c	26 Sep 2005 10:52:58 -0000
@@ -73,6 +73,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;
@@ -162,7 +164,7 @@ proxy_dialog_finalize (GObject *object)
 		free_proxy_list (priv->proxy_list);
 		g_free (priv->help_section);
 		g_object_unref (priv->xml_tab);
-		g_free (prd->priv);
+		g_object_unref (prd->priv);
 		prd->priv = NULL;
 	}
 	
@@ -518,12 +520,13 @@ proxy_abort (GtkWidget *button, EConfigH
 	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)
 {
@@ -633,6 +636,7 @@ org_gnome_proxy (EPlugin *epl, EConfigHo
 	GtkButton *addProxy, *removeProxy, *editProxy;
 	proxyDialog *prd;
 	proxyDialogPrivate *priv;
+	int pag_num;
 
 	target_account = (EMConfigTargetAccount *)data->config->target;
 	account = target_account->account;
@@ -663,9 +667,6 @@ org_gnome_proxy (EPlugin *epl, EConfigHo
 			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 {
 			GtkWidget *label;
 			priv->tab_dialog = gtk_vbox_new (TRUE, 10);
@@ -674,13 +675,16 @@ org_gnome_proxy (EPlugin *epl, EConfigHo
 		}	
 			
 		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); 
@@ -688,6 +692,26 @@ org_gnome_proxy (EPlugin *epl, EConfigHo
 		}	
 	}
 	return NULL;
+}
+
+static int
+proxy_page_changed_cb (GtkNotebook *notebook, GtkNotebookPage *page, int num, EAccount *account)
+{
+	proxyDialog *prd;
+	proxyDialogPrivate *priv;
+
+	if (!prd || !prd->priv || !prd->priv->proxy_list)
+		return;
+	
+	prd = g_object_get_data ((GObject *) account, "prd");
+	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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]