aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-10-27 12:25:42 +0800
committerChris Toshok <toshok@src.gnome.org>2001-10-27 12:25:42 +0800
commit1d0c3ca25472ab9191be7c01d8d050b8a7a5ba4d (patch)
treea38eedcd6d3bf1b57bc980ea71a1b5210fe28d4c /addressbook/gui/component
parentd08917c280e5297873588cd2aba3d9c2ce89a1a3 (diff)
downloadgsoc2013-evolution-1d0c3ca25472ab9191be7c01d8d050b8a7a5ba4d.tar
gsoc2013-evolution-1d0c3ca25472ab9191be7c01d8d050b8a7a5ba4d.tar.gz
gsoc2013-evolution-1d0c3ca25472ab9191be7c01d8d050b8a7a5ba4d.tar.bz2
gsoc2013-evolution-1d0c3ca25472ab9191be7c01d8d050b8a7a5ba4d.tar.lz
gsoc2013-evolution-1d0c3ca25472ab9191be7c01d8d050b8a7a5ba4d.tar.xz
gsoc2013-evolution-1d0c3ca25472ab9191be7c01d8d050b8a7a5ba4d.tar.zst
gsoc2013-evolution-1d0c3ca25472ab9191be7c01d8d050b8a7a5ba4d.zip
add prototypes for addressbook_config_database, and
2001-10-26 Chris Toshok <toshok@ximian.com> * gui/component/addressbook.h: add prototypes for addressbook_config_database, and addressbook_load_default_book. * gui/component/addressbook.c (addressbook_config_database): new function, so we aren't activating the db everywhere we need to use it. (addressbook_load_default_book): load the default book, after getting the uri from bonobo-config. svn path=/trunk/; revision=14200
Diffstat (limited to 'addressbook/gui/component')
-rw-r--r--addressbook/gui/component/addressbook.c43
-rw-r--r--addressbook/gui/component/addressbook.h6
2 files changed, 49 insertions, 0 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 804154fb88..4cc967276a 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -41,6 +41,7 @@
#include "addressbook/printing/e-contact-print.h"
#include <ebook/e-book.h>
+#include <ebook/e-book-util.h>
#include <widgets/misc/e-search-bar.h>
#include <widgets/misc/e-filter-bar.h>
@@ -664,6 +665,38 @@ addressbook_load_uri (EBook *book, const char *uri,
return rv;
}
+gboolean
+addressbook_load_default_book (EBook *book, EBookCallback open_response, gpointer closure)
+{
+ char *val;
+ gboolean rv;
+ CORBA_Environment ev;
+ Bonobo_ConfigDatabase config_db;
+
+ g_return_val_if_fail (book != NULL, FALSE);
+ g_return_val_if_fail (E_IS_BOOK (book), FALSE);
+ g_return_val_if_fail (open_response != NULL, FALSE);
+
+ CORBA_exception_init (&ev);
+ config_db = addressbook_config_database (&ev);
+ val = bonobo_config_get_string (config_db, "/Addressbook/default_book_uri", &ev);
+ CORBA_exception_free (&ev);
+
+ if (val) {
+ rv = addressbook_load_uri (book, val, open_response, closure);
+ g_free (val);
+ }
+ else {
+ rv = e_book_load_local_address_book (book, open_response, closure);
+ }
+
+ if (!rv) {
+ g_warning ("Couldn't load default addressbook");
+ }
+
+ return rv;
+}
+
static void
set_prop (BonoboPropertyBag *bag,
const BonoboArg *arg,
@@ -920,7 +953,17 @@ set_folder_bar_label (EAddressbookView *eav, const char *message, AddressbookVie
CORBA_exception_free (&ev);
}
+/* Our global singleton config database */
+static Bonobo_ConfigDatabase config_db = NULL;
+Bonobo_ConfigDatabase
+addressbook_config_database (CORBA_Environment *ev)
+{
+ if (config_db == NULL)
+ config_db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", ev);
+
+ return config_db;
+}
BonoboControl *
addressbook_factory_new_control (void)
diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h
index 5cf14dba12..9a99589578 100644
--- a/addressbook/gui/component/addressbook.h
+++ b/addressbook/gui/component/addressbook.h
@@ -2,14 +2,20 @@
#define __ADDRESSBOOK_H__
#include <bonobo/bonobo-control.h>
+#include <bonobo-conf/bonobo-config-database.h>
+#include <bonobo/bonobo-object.h>
+#include <bonobo/bonobo-moniker-util.h>
#include <ebook/e-book.h>
+Bonobo_ConfigDatabase addressbook_config_database (CORBA_Environment *ev);
+
/* expand file:///foo/foo/ to file:///foo/foo/addressbook.db */
char * addressbook_expand_uri (const char *uri);
/* use this instead of e_book_load_uri everywhere where you want the
authentication to be handled for you. */
gboolean addressbook_load_uri (EBook *book, const char *uri, EBookCallback cb, gpointer closure);
+gboolean addressbook_load_default_book (EBook *book, EBookCallback open_response, gpointer closure);
BonoboControl *addressbook_factory_new_control (void);
void addressbook_factory_init (void);