diff options
author | Devashish Sharma <dsharma@src.gnome.org> | 2006-02-23 12:52:22 +0800 |
---|---|---|
committer | Devashish Sharma <dsharma@src.gnome.org> | 2006-02-23 12:52:22 +0800 |
commit | 24bf0218e8f93e904e0f8d0285806fc1506cbbb3 (patch) | |
tree | 1ce2820253b6e8b44ff1a5fab598e80b424aa5bf /addressbook/gui | |
parent | febbaf9d0562534aa676226de1138a7005d4d4c5 (diff) | |
download | gsoc2013-evolution-24bf0218e8f93e904e0f8d0285806fc1506cbbb3.tar.gz gsoc2013-evolution-24bf0218e8f93e904e0f8d0285806fc1506cbbb3.tar.zst gsoc2013-evolution-24bf0218e8f93e904e0f8d0285806fc1506cbbb3.zip |
New->Contact should create contact on selected addressbook.
svn path=/trunk/; revision=31566
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/component/addressbook-component.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index 476220afed..ad99d22fc9 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -283,6 +283,9 @@ impl_requestCreateItem (PortableServer_Servant servant, 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_Servant servant, 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)); } |