[evolution-patches] Plugins - GroupWise Proxy



Hi,

Attached with is the patch to move the GList to maintain proxies-list
into the proxyDialog structure, rather than setting an amorphous GList
on EAccount using g_object_set.  This fixes #312352 also.

Please review,

Thanks,
Sankar
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/groupwise-features/ChangeLog,v
retrieving revision 1.23
diff -u -p -r1.23 ChangeLog
--- ChangeLog	6 Aug 2005 09:54:05 -0000	1.23
+++ ChangeLog	8 Aug 2005 06:54:42 -0000
@@ -1,3 +1,10 @@
+2005-08-08  Sankar P  <psankar novell com>
+
+	* proxy.c : 
+	Moved the GList to maintain the list of proxies, 
+	into the proxyDialog structure.
+	Fixes #312352
+	
 2005-08-06  Sankar P  <psankar novell com>
 
 	* proxy.c: (proxy_dialog_store_widgets_data)
Index: proxy.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/groupwise-features/proxy.c,v
retrieving revision 1.3
diff -u -p -r1.3 proxy.c
--- proxy.c	6 Aug 2005 09:54:05 -0000	1.3
+++ proxy.c	8 Aug 2005 06:54:42 -0000
@@ -104,6 +104,8 @@ struct _proxyDialogPrivate {
 	GtkWidget *options;
 	GtkWidget *private;
         char *help_section;
+
+	GList *proxy_list;
 };
 
 static void
@@ -137,10 +139,11 @@ free_proxy_handler (proxyHandler *handle
 void
 free_proxy_list (GList *proxy_list)
 {
-	g_list_foreach (proxy_list, (GFunc) free_proxy_handler, NULL);
-	g_list_free (proxy_list);
-	proxy_list = NULL;
-
+	if (proxy_list) {
+		g_list_foreach (proxy_list, (GFunc) free_proxy_handler, NULL);
+		g_list_free (proxy_list);
+		proxy_list = NULL;
+	}
 }
 
 static void
@@ -156,6 +159,7 @@ proxy_dialog_finalize (GObject *object)
 		g_object_unref (priv->proxy_name_selector);
 
 	if (priv) {
+		free_proxy_list (priv->proxy_list);
 		g_free (priv->help_section);
 		g_object_unref (priv->xml_tab);
 		g_object_unref (prd->priv);
@@ -214,6 +218,8 @@ proxy_dialog_init (GObject *object)
 	priv->options = NULL;
 	priv->private = NULL;
 	priv->help_section = NULL;
+
+	priv->proxy_list = NULL;
 }
 
 GType
@@ -325,7 +331,7 @@ proxy_dialog_store_widgets_data (EAccoun
 				EDestinationStore *destination_store;
 				GList *destinations, *tmp;
 				char *name, *email;
-				GList *existing_list;
+				GList *existing_list, *proxy_list;
 				name_selector_entry = e_name_selector_peek_section_entry (priv->proxy_name_selector, "Add User");
 				destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY (
 							name_selector_entry));
@@ -351,7 +357,7 @@ proxy_dialog_store_widgets_data (EAccoun
 					}
 
 					/*check whether already exists*/
-					existing_list = g_object_get_data ( (GObject*)account, "proxy_list");
+					existing_list = priv->proxy_list;
 
 					for (;existing_list; existing_list = g_list_next(existing_list)) {
 						new_proxy = (proxyHandler *) existing_list->data;
@@ -379,7 +385,9 @@ proxy_dialog_store_widgets_data (EAccoun
 					new_proxy->uniqueid = NULL;
 					new_proxy->flags =  E_GW_PROXY_NEW;
 					new_proxy->permissions = proxy_get_permissions_from_dialog (account);
-					g_object_set_data_full ((GObject *) account, "proxy_list", g_list_append (g_object_get_data ((GObject*) account,"proxy_list"), new_proxy), (GDestroyNotify) free_proxy_list);
+				
+					priv->proxy_list = g_list_append (priv->proxy_list, new_proxy);
+					//g_object_set_data ((GObject *) account, "proxy_list", proxy_list);
 				}
 			}
 			break;
@@ -497,20 +505,14 @@ proxy_abort (GtkWidget *button, EConfigH
 	EMConfigTargetAccount *target_account;
 	EAccount *account;
 	proxyDialog *prd = NULL;
-	GList *proxy_list;
 
 	target_account = (EMConfigTargetAccount *)data->config->target;
 	account = target_account->account;
 	prd = g_object_get_data ((GObject *)account, "prd");    
-	proxy_list = (GList *) g_object_get_data ((GObject *) account, "proxy_dialog");
 	
-	if (prd == NULL || proxy_list == NULL)
+	if (prd == NULL)
 		return;
 
-	g_list_foreach (proxy_list, (GFunc) free_proxy_handler, NULL);
-	g_list_free (proxy_list);
-	proxy_list = NULL;
-
 	g_object_unref (prd);
 	prd = NULL;
 }
@@ -520,19 +522,17 @@ proxy_commit (GtkWidget *button, EConfig
 	EAccount *account;
 	EMConfigTargetAccount *target_account;
 	proxyDialogPrivate *priv;
-	GList *l, *proxy_list;
+	GList *l;
 	proxyHandler *aclInstance;
 	proxyDialog *prd = NULL;
 
 	target_account = (EMConfigTargetAccount *)data->config->target;
 	account = target_account->account;
 	prd = g_object_get_data ((GObject *)account, "prd");    
-	l = g_object_get_data ( (GObject *)account, "proxy_list") ;
-
+	priv = prd->priv;
+	l = priv->proxy_list;
 	if (prd == NULL || l == NULL)
 		return;
-	
-	priv = prd->priv;
 	for (;l; l = g_list_next (l)) {
 		aclInstance = (proxyHandler *) l->data;
 
@@ -553,11 +553,6 @@ proxy_commit (GtkWidget *button, EConfig
 		}
 	}
 
-	proxy_list = (GList *) g_object_get_data ((GObject *) account, "proxy_dialog");
-	g_list_foreach (proxy_list, (GFunc) free_proxy_handler, NULL);
-	g_list_free (proxy_list);
-	proxy_list = NULL;
-
 	g_object_unref (prd);
 	prd = NULL;
 }
@@ -604,7 +599,7 @@ proxy_update_tree_view (EAccount *accoun
 	broken_image = gdk_pixbuf_new_from_file (file_name, NULL);
 	
 	gtk_tree_store_clear (priv->store);
-	l = g_object_get_data ( (GObject *)account, "proxy_list") ;
+	l = priv->proxy_list;
 
 	for (;l; l = g_list_next(l)) {        
 	        aclInstance = (proxyHandler *) l->data;
@@ -659,8 +654,8 @@ org_gnome_proxy (EPlugin *epl, EConfigHo
 			
 			if (e_gw_connection_get_proxy_access_list(prd->cnc, &proxy_list)!= E_GW_CONNECTION_STATUS_OK) 
 				return NULL;
-			
-			g_object_set_data_full ((GObject *) account, "proxy_list", proxy_list, (GDestroyNotify) free_proxy_list);
+			priv->proxy_list = proxy_list;
+			//g_object_set_data ((GObject *) account, "proxy_list", proxy_list);
 			proxy_update_tree_view (account);
 		} else {
 			GtkWidget *label;
@@ -736,8 +731,14 @@ proxy_edit_ok (GtkWidget *button, EAccou
 static proxyHandler * 
 proxy_get_item_from_list (EAccount *account, char *account_name)
 {
-	GList *l = g_object_get_data ((GObject *)account, "proxy_list");
+	proxyDialogPrivate *priv;
+	proxyDialog *prd = NULL;
+	GList *l;
 	proxyHandler *iter;
+	
+	prd = g_object_get_data ((GObject *)account, "prd");    
+	priv = prd->priv;
+	l = priv->proxy_list;
 
 	for (;l; l = g_list_next(l)) {        
 	        iter = (proxyHandler *) l->data;


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