[ 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
This commit is contained in:
Chris Toshok
2002-12-17 18:26:52 +00:00
committed by Chris Toshok
parent 7adf0fe63f
commit 917e520bbe
2 changed files with 48 additions and 9 deletions

View File

@ -1,3 +1,15 @@
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.
2002-12-16 Ettore Perazzoli <ettore@ximian.com>
* gui/component/addressbook-config.c

View File

@ -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);
@ -201,6 +199,35 @@ set_default_book_uri_local (void)
g_free (filename);
}
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)
{
@ -208,13 +235,13 @@ set_default_book_uri_from_config_db (void)
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 {