aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/addressbook.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.c
parent4e878bc6d47a427ec06032b5180245dd619678ae (diff)
downloadgsoc2013-evolution-9953071e22306fedaf852d018e0b5416496ababb.tar.gz
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.c')
-rw-r--r--addressbook/gui/component/addressbook.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 027a777621..3e3cf862da 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -510,6 +510,33 @@ get_prop (BonoboPropertyBag *bag,
}
}
+char *
+addressbook_expand_uri (const char *uri)
+{
+ char *new_uri;
+
+ if (!strncmp (uri, "file:", 5)) {
+ if (strlen (uri + 7) > 3
+ && !strcmp (uri + strlen(uri) - 3, ".db")) {
+ /* it's a .db file */
+ new_uri = g_strdup (uri);
+ }
+ else {
+ char *file_name;
+ /* we assume it's a dir and glom addressbook.db onto the end. */
+ file_name = g_concat_dir_and_file(uri + 7, "addressbook.db");
+ new_uri = g_strdup_printf("file://%s", file_name);
+ g_free(file_name);
+ }
+ }
+ else {
+ new_uri = g_strdup (uri);
+ }
+
+ return new_uri;
+}
+
+
static void
set_prop (BonoboPropertyBag *bag,
const BonoboArg *arg,
@@ -538,25 +565,7 @@ set_prop (BonoboPropertyBag *bag,
view->uri = g_strdup(BONOBO_ARG_GET_STRING (arg));
- if (!strncmp (view->uri, "file:", 5)) {
-
- if (strlen (view->uri + 7) > 3
- && !strcmp (view->uri + strlen(view->uri) - 3, ".db")) {
- /* it's a .db file */
- uri_data = g_strdup (view->uri);
- }
- else {
- char *file_name;
- /* we assume it's a dir and glom addressbook.db onto the end. */
- file_name = g_concat_dir_and_file(view->uri + 7, "addressbook.db");
- uri_data = g_strdup_printf("file://%s", file_name);
- g_free(file_name);
- }
-
- }
- else {
- uri_data = g_strdup (view->uri);
- }
+ uri_data = addressbook_expand_uri (view->uri);
if (! e_book_load_uri (book, uri_data, book_open_cb, view))
printf ("error calling load_uri!\n");