aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog6
-rw-r--r--addressbook/gui/component/addressbook-component.c35
2 files changed, 36 insertions, 5 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 3d3089b412..339a9ce750 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,9 @@
+2001-09-25 Christopher James Lahey <clahey@ximian.com>
+
+ * gui/component/addressbook-component.c (user_create_new_item_cb):
+ Handle creating the new contact in the current folder if it's a
+ contacts folder. Fixes Ximian bug #7814.
+
2001-09-24 Chris Toshok <toshok@ximian.com>
* backend/pas/Makefile.am (LDAP_SCHEMA): add
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index 8117ced2cf..3e414f86f9 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -279,6 +279,8 @@ static void
local_addressbook_cb (EBook *book, gpointer closure)
{
gboolean is_list = GPOINTER_TO_INT (closure);
+ if (book == NULL)
+ return;
if (is_list)
e_addressbook_show_contact_list_editor (book, e_card_new(""), TRUE, TRUE);
else
@@ -286,21 +288,44 @@ local_addressbook_cb (EBook *book, gpointer closure)
}
static void
+nonlocal_addressbook_cb (EBook *book, EBookStatus status, gpointer closure)
+{
+ if (status == E_BOOK_STATUS_SUCCESS)
+ local_addressbook_cb (book, closure);
+ else
+ local_addressbook_cb (NULL, closure);
+}
+
+static void
user_create_new_item_cb (EvolutionShellComponent *shell_component,
const char *id,
const char *parent_folder_physical_uri,
const char *parent_folder_type,
gpointer data)
{
+ gboolean is_contact_list;
if (!strcmp (id, "contact")) {
- e_book_use_local_address_book (local_addressbook_cb, GINT_TO_POINTER (0));
- return;
+ is_contact_list = FALSE;
} else if (!strcmp (id, "contact_list")) {
- e_book_use_local_address_book (local_addressbook_cb, GINT_TO_POINTER (1));
+ is_contact_list = TRUE;
+ } else {
+ g_warning ("Don't know how to create item of type \"%s\"", id);
return;
- }
+ }
+ if (IS_CONTACT_TYPE (parent_folder_type)) {
+ EBook *book;
+ gchar *uri;
+
+ book = e_book_new ();
+ uri = g_strdup_printf ("%s/addressbook.db", parent_folder_physical_uri);
- g_warning ("Don't know how to create item of type \"%s\"", id);
+ if (e_book_load_uri (book, uri, nonlocal_addressbook_cb, GINT_TO_POINTER (is_contact_list)) == 0)
+ g_warning ("Couldn't load addressbook %s", uri);
+
+ g_free (uri);
+ } else {
+ e_book_use_local_address_book (local_addressbook_cb, GINT_TO_POINTER (is_contact_list));
+ }
}