aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2004-04-17 05:32:52 +0800
committerChris Toshok <toshok@src.gnome.org>2004-04-17 05:32:52 +0800
commit5e766d8fb292fb1a3727d240210b658fce34325e (patch)
tree0c733d806dcef3cbbf60584609804844e6e7c082 /addressbook
parent26ccc3eed18996fc1e87bae8e3702c1929003877 (diff)
downloadgsoc2013-evolution-5e766d8fb292fb1a3727d240210b658fce34325e.tar
gsoc2013-evolution-5e766d8fb292fb1a3727d240210b658fce34325e.tar.gz
gsoc2013-evolution-5e766d8fb292fb1a3727d240210b658fce34325e.tar.bz2
gsoc2013-evolution-5e766d8fb292fb1a3727d240210b658fce34325e.tar.lz
gsoc2013-evolution-5e766d8fb292fb1a3727d240210b658fce34325e.tar.xz
gsoc2013-evolution-5e766d8fb292fb1a3727d240210b658fce34325e.tar.zst
gsoc2013-evolution-5e766d8fb292fb1a3727d240210b658fce34325e.zip
new function, use the async interface to load the book.
2004-04-16 Chris Toshok <toshok@ximian.com> * gui/component/addressbook-component.c (book_loaded_cb): new function, use the async interface to load the book. (impl_requestCreateItem): use e_book_async_get_default_addressbook. svn path=/trunk/; revision=25496
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog7
-rw-r--r--addressbook/gui/component/addressbook-component.c57
2 files changed, 42 insertions, 22 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index b629f41044..830b748a8a 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,10 @@
+2004-04-16 Chris Toshok <toshok@ximian.com>
+
+ * gui/component/addressbook-component.c (book_loaded_cb): new
+ function, use the async interface to load the book.
+ (impl_requestCreateItem): use
+ e_book_async_get_default_addressbook.
+
2004-04-16 Hans Petter Jansson <hpj@ximian.com>
* gui/contact-editor/contact-editor.glade: Commit new contact editor
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index 6138aaf6ea..3c5ad9ce83 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -117,44 +117,57 @@ impl__get_userCreatableItems (PortableServer_Servant servant,
}
static void
-impl_requestCreateItem (PortableServer_Servant servant,
- const CORBA_char *item_type_name,
- CORBA_Environment *ev)
+book_loaded_cb (EBook *book, EBookStatus status, gpointer data)
{
- AddressbookComponent *addressbook_component = ADDRESSBOOK_COMPONENT (bonobo_object_from_servant (servant));
- AddressbookComponentPrivate *priv;
- EBook *book = NULL;
EContact *contact;
+ char *item_type_name = data;
- priv = addressbook_component->priv;
-
- if (!strcmp (item_type_name, "address_book")) {
- addressbook_config_create_new_source (NULL);
- return;
- }
-
- if (!e_book_get_default_addressbook (&book, NULL)) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_Failed, NULL);
+ if (status != E_BOOK_ERROR_OK) {
+ /* XXX we really need a dialog here, but we don't have
+ access to the ESource so we can't use
+ eab_load_error_dialog. fun! */
return;
}
contact = e_contact_new ();
- if (!item_type_name) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UnknownType, NULL);
- }
- else if (!strcmp (item_type_name, "contact")) {
+ if (!strcmp (item_type_name, "contact")) {
eab_show_contact_editor (book, contact, TRUE, TRUE);
}
else if (!strcmp (item_type_name, "contact_list")) {
eab_show_contact_list_editor (book, contact, TRUE, TRUE);
}
- else {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UnknownType, NULL);
- }
g_object_unref (book);
g_object_unref (contact);
+
+ g_free (item_type_name);
+}
+
+static void
+impl_requestCreateItem (PortableServer_Servant servant,
+ const CORBA_char *item_type_name,
+ CORBA_Environment *ev)
+{
+ AddressbookComponent *addressbook_component = ADDRESSBOOK_COMPONENT (bonobo_object_from_servant (servant));
+ AddressbookComponentPrivate *priv;
+
+ priv = addressbook_component->priv;
+
+ if (!item_type_name ||
+ (strcmp (item_type_name, "address_book") &&
+ strcmp (item_type_name, "contact") &&
+ strcmp (item_type_name, "contact_list"))) {
+ CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UnknownType, NULL);
+ return;
+ }
+
+ if (!strcmp (item_type_name, "address_book")) {
+ addressbook_config_create_new_source (NULL);
+ return;
+ }
+
+ e_book_async_get_default_addressbook (book_loaded_cb, g_strdup (item_type_name));
}
static CORBA_boolean