[evolution-patches] [addressbook] Patch for Bug #326788



Hi,

The attached patch fixes the Bug 326788 – New->Contact should create
contact on selected Addressbook.
This should also solve the Bug 326721.


Thanks
Devashish Sharma
Index: addressbook/gui/component/addressbook-component.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/addressbook-component.c,v
retrieving revision 1.145
diff -u -p -r1.145 addressbook-component.c
--- addressbook/gui/component/addressbook-component.c	5 Feb 2006 23:46:25 -0000	1.145
+++ addressbook/gui/component/addressbook-component.c	17 Feb 2006 09:10:40 -0000
@@ -283,6 +283,9 @@ impl_requestCreateItem (PortableServer_S
 			CORBA_Environment *ev)
 {
 	EBook *book;
+	GConfClient *gconf_client;	
+	ESourceList *source_list;
+	char *uid;
 
 	if (!item_type_name ||
 	    (strcmp (item_type_name, "address_book") &&
@@ -297,7 +300,28 @@ impl_requestCreateItem (PortableServer_S
 		return;
 	}
 
-	book = e_book_new_default_addressbook (NULL);
+	gconf_client = gconf_client_get_default();
+	uid = gconf_client_get_string (gconf_client, "/apps/evolution/addressbook/display/primary_addressbook",
+			NULL);
+	g_object_unref (gconf_client);
+	if (!e_book_get_addressbooks (&source_list, NULL)) {
+		g_warning ("Could not get addressbook source list from GConf!");
+		return;
+	}
+	if (uid) {
+		ESource *source = e_source_list_peek_source_by_uid(source_list, uid);
+		if (source) {
+			book = e_book_new (source, NULL);
+		}
+		else {
+			book = e_book_new_default_addressbook (NULL);
+		}
+		g_free (uid);
+	}
+	else {
+		book = e_book_new_default_addressbook (NULL);
+	}
+
 	e_book_async_open (book, FALSE, book_loaded_cb, g_strdup (item_type_name));
 }
 


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