aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/addressbook-component.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-05-14 08:46:29 +0800
committerChris Toshok <toshok@src.gnome.org>2001-05-14 08:46:29 +0800
commit9953071e22306fedaf852d018e0b5416496ababb (patch)
tree3be223f5b6f6b3f8b92e30ae4271eb0c5bcebcac /addressbook/gui/component/addressbook-component.c
parent4e878bc6d47a427ec06032b5180245dd619678ae (diff)
downloadgsoc2013-evolution-9953071e22306fedaf852d018e0b5416496ababb.tar
gsoc2013-evolution-9953071e22306fedaf852d018e0b5416496ababb.tar.gz
gsoc2013-evolution-9953071e22306fedaf852d018e0b5416496ababb.tar.bz2
gsoc2013-evolution-9953071e22306fedaf852d018e0b5416496ababb.tar.lz
gsoc2013-evolution-9953071e22306fedaf852d018e0b5416496ababb.tar.xz
gsoc2013-evolution-9953071e22306fedaf852d018e0b5416496ababb.tar.zst
gsoc2013-evolution-9953071e22306fedaf852d018e0b5416496ababb.zip
add prototype for addressbook_expand_uri.
2001-05-13 Chris Toshok <toshok@ximian.com> * gui/component/addressbook.h: add prototype for addressbook_expand_uri. * gui/component/addressbook-component.c (destination_folder_handle_drop): create an EBook for @physical_uri. (dnd_drop_book_open_cb): actually add the dropped cards. * gui/component/addressbook.c (addressbook_expand_uri): abstract this code out from the set_prop method so we can use it in the component. (set_prop): call addressbook_expand_uri. * backend/ebook/e-card.c (e_card_load_cards_from_string): new function. * backend/ebook/e-card.h: add prototype for e_card_load_cards_from_string. svn path=/trunk/; revision=9788
Diffstat (limited to 'addressbook/gui/component/addressbook-component.c')
-rw-r--r--addressbook/gui/component/addressbook-component.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index 90a976473e..f27384dd36 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -35,6 +35,9 @@
#include "evolution-shell-component-dnd.h"
#include "evolution-storage.h"
+#include "ebook/e-book.h"
+#include "ebook/e-card.h"
+
#include "addressbook-storage.h"
#include "addressbook-component.h"
#include "addressbook.h"
@@ -273,6 +276,9 @@ owner_unset_cb (EvolutionShellComponent *shell_component,
gtk_main_quit();
}
+
+/* Destination side DnD */
+
static CORBA_boolean
destination_folder_handle_motion (EvolutionShellComponentDndDestinationFolder *folder,
const char *physical_uri,
@@ -285,6 +291,18 @@ destination_folder_handle_motion (EvolutionShellComponentDndDestinationFolder *f
return TRUE;
}
+static void
+dnd_drop_book_open_cb (EBook *book, EBookStatus status, GList *card_list)
+{
+ GList *l;
+
+ for (l = card_list; l; l = l->next) {
+ ECard *card = l->data;
+
+ e_book_add_card (book, card, NULL /* XXX */, NULL);
+ }
+}
+
static CORBA_boolean
destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *folder,
const char *physical_uri,
@@ -293,12 +311,24 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol
const GNOME_Evolution_ShellComponentDnd_Data * data,
gpointer user_data)
{
+ EBook *book;
+ GList *card_list;
+ char *expanded_uri;
+
if (action == GNOME_Evolution_ShellComponentDnd_ACTION_LINK)
return FALSE; /* we can't create links in our addressbook format */
g_print ("in destination_folder_handle_drop (%s)\n", physical_uri);
- g_print ("data = %s\n", data->bytes._buffer);
+ card_list = e_card_load_cards_from_string (data->bytes._buffer);
+
+ expanded_uri = addressbook_expand_uri (physical_uri);
+
+ book = e_book_new ();
+ e_book_load_uri (book, expanded_uri,
+ (EBookCallback)dnd_drop_book_open_cb, card_list);
+
+ g_free (expanded_uri);
return TRUE;
}