diff options
author | Chris Toshok <toshok@ximian.com> | 2002-12-18 02:26:52 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2002-12-18 02:26:52 +0800 |
commit | 917e520bbe50ce58fb69d33438a580be487e96d8 (patch) | |
tree | 4fd3ed5fc40d91306aae7802a440353c72b1c3b9 /addressbook/backend | |
parent | 7adf0fe63f7f94b66b5d3f87df7b638be0338a96 (diff) | |
download | gsoc2013-evolution-917e520bbe50ce58fb69d33438a580be487e96d8.tar gsoc2013-evolution-917e520bbe50ce58fb69d33438a580be487e96d8.tar.gz gsoc2013-evolution-917e520bbe50ce58fb69d33438a580be487e96d8.tar.bz2 gsoc2013-evolution-917e520bbe50ce58fb69d33438a580be487e96d8.tar.lz gsoc2013-evolution-917e520bbe50ce58fb69d33438a580be487e96d8.tar.xz gsoc2013-evolution-917e520bbe50ce58fb69d33438a580be487e96d8.tar.zst gsoc2013-evolution-917e520bbe50ce58fb69d33438a580be487e96d8.zip |
[ Fixes bug #35135 ] don't free the default_book_uri here, it's done in
2002-12-17 Chris Toshok <toshok@ximian.com>
[ Fixes bug #35135 ]
* backend/ebook/e-book-util.c (set_default_book_uri_local): don't
free the default_book_uri here, it's done in set_default_book_uri.
(set_default_book_uri): break some stuff out from
set_default_book_uri_from_bonobo_conf to here so it can be used
both from that function and the bonobo listener.
(default_folder_listener): set the new default book uri.
(set_default_book_uri_from_bonobo_conf): install the bonobo conf
listener so we'll get updates.
svn path=/trunk/; revision=19148
Diffstat (limited to 'addressbook/backend')
-rw-r--r-- | addressbook/backend/ebook/e-book-util.c | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/addressbook/backend/ebook/e-book-util.c b/addressbook/backend/ebook/e-book-util.c index e84d0a144d..7852a84675 100644 --- a/addressbook/backend/ebook/e-book-util.c +++ b/addressbook/backend/ebook/e-book-util.c @@ -29,6 +29,7 @@ #include <glib.h> #include <glib-object.h> +#include <e-util/e-config-listener.h> #include "e-card-compare.h" typedef struct _CommonBookInfo CommonBookInfo; @@ -191,9 +192,6 @@ set_default_book_uri_local (void) { char *filename; - if (default_book_uri) - g_free (default_book_uri); - filename = g_build_filename (g_get_home_dir(), "evolution/local/Contacts/addressbook.db", NULL); @@ -202,19 +200,48 @@ set_default_book_uri_local (void) } static void +set_default_book_uri (char *val) +{ + if (default_book_uri) + g_free (default_book_uri); + + if (val) { + default_book_uri = e_book_expand_uri (val); + g_free (val); + } + else { + set_default_book_uri_local (); + } +} + +#define DEFAULT_CONTACTS_URI_PATH "/apps/evolution/shell/default_folders/contacts_uri" +static void +default_folder_listener (EConfigListener *cl, const char *key, gpointer data) +{ + char *val; + + if (strcmp (key, DEFAULT_CONTACTS_URI_PATH)) + return; + + val = e_config_listener_get_string (cl, DEFAULT_CONTACTS_URI_PATH); + + set_default_book_uri (val); +} + +static void set_default_book_uri_from_config_db (void) { char *val; EConfigListener* config_db; config_db = e_book_get_config_database (); - val = e_config_listener_get_string_with_default (config_db, "/apps/Evolution/DefaultFolders/contacts_uri", NULL, NULL); + val = e_config_listener_get_string_with_default (config_db, DEFAULT_CONTACTS_URI_PATH, NULL, NULL); - if (val) { - default_book_uri = e_book_expand_uri (val); - g_free (val); - } else - set_default_book_uri_local (); + g_signal_connect (config_db, + "key_changed", + G_CALLBACK (default_folder_listener), NULL); + + set_default_book_uri (val); } typedef struct { |