[evolution-patches] patch for address book config dialog



Hi,
Currently we do not show "On Ldap Servers" in group menu when evo is not
compiled with ldap enabled. But in address book config code we always
maintain a list of all source groups including ldap  irrespective of
whether ldap is enabled or not. Because of this when one more source
group is added to address book component and address books are created
under it, they actually get created under LDAP group. Attached patch
solves the problem . It also fixes a memory leak.

Thanks,
Sivaiah
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1602
diff -u -r1.1602 ChangeLog
--- ChangeLog	28 Feb 2004 01:22:45 -0000	1.1602
+++ ChangeLog	2 Mar 2004 08:47:10 -0000
@@ -1,3 +1,11 @@
+2004-03-02  Sivaiah Nallagatla <snallagatla novell com>
+
+	* gui/component/addressbook-config.c : 
+	(addressbook_add_server_druid) : maintain a list of only those source groups which are added to menu
+	instead of all
+	(source_group_changed_cb) : use the new list to get the selected group 
+	(addressbook_source_dialog_destroy) : free the new list
+
 2004-02-27  Chris Toshok  <toshok ximian com>
 
 	* gui/widgets/eab-contact-display.c
Index: gui/component/addressbook-config.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/addressbook-config.c,v
retrieving revision 1.68
diff -u -r1.68 addressbook-config.c
--- gui/component/addressbook-config.c	26 Feb 2004 21:01:31 -0000	1.68
+++ gui/component/addressbook-config.c	2 Mar 2004 08:47:11 -0000
@@ -96,6 +96,7 @@
 
 	/* Source selection (druid only) */
 	ESourceList *source_list;
+	GSList *menu_source_groups;
 	GtkWidget *group_optionmenu;
 
 	/* ESource we're currently editing (editor only) */
@@ -463,6 +464,8 @@
 	AddressbookSourceDialog *dialog = data;
 
 	g_object_unref (dialog->gui);
+	g_object_unref (dialog->source_list);
+	g_slist_free (dialog->menu_source_groups);
 	g_free (dialog);
 }
 
@@ -961,8 +964,8 @@
 static void
 source_group_changed_cb (GtkWidget *widget, AddressbookSourceDialog *sdialog)
 {
-	sdialog->source_group = g_slist_nth (e_source_list_peek_groups (sdialog->source_list),
-		gtk_option_menu_get_history (GTK_OPTION_MENU (sdialog->group_optionmenu)))->data;
+	sdialog->source_group = g_slist_nth (sdialog->menu_source_groups,
+					     gtk_option_menu_get_history (GTK_OPTION_MENU (sdialog->group_optionmenu)))->data;
 }
 
 static void
@@ -1019,6 +1022,7 @@
 	AddressbookSourceDialog *sdialog = g_new0 (AddressbookSourceDialog, 1);
 	GtkWidget *page;
 	GConfClient *gconf_client;
+	GSList *source_groups;
 
 	sdialog->gui = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, NULL, NULL);
 
@@ -1037,6 +1041,15 @@
 
 	gconf_client = gconf_client_get_default ();
 	sdialog->source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/addressbook/sources");
+	source_groups = e_source_list_peek_groups (sdialog->source_list);
+	sdialog->menu_source_groups = g_slist_copy (source_groups);
+#ifndef HAVE_LDAP
+	for ( ; source_groups != NULL; source_groups = g_slist_next (source_groups))
+
+		if (!strcmp ("ldap://";, e_source_group_peek_base_uri (source_groups->data)))	
+			sdialog->menu_source_groups = g_slist_remove (sdialog->menu_source_groups, source_groups->data);
+#endif 
+
 	sdialog->group_optionmenu = glade_xml_get_widget (sdialog->gui, "druid-group-option-menu");
 	if (!GTK_IS_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (sdialog->group_optionmenu)))) {
 		GtkWidget *menu = gtk_menu_new ();


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