[ 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:

committed by
Chris Toshok

parent
7adf0fe63f
commit
917e520bbe
@ -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>
|
2002-12-16 Ettore Perazzoli <ettore@ximian.com>
|
||||||
|
|
||||||
* gui/component/addressbook-config.c
|
* gui/component/addressbook-config.c
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
#include <e-util/e-config-listener.h>
|
||||||
#include "e-card-compare.h"
|
#include "e-card-compare.h"
|
||||||
|
|
||||||
typedef struct _CommonBookInfo CommonBookInfo;
|
typedef struct _CommonBookInfo CommonBookInfo;
|
||||||
@ -191,9 +192,6 @@ set_default_book_uri_local (void)
|
|||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
if (default_book_uri)
|
|
||||||
g_free (default_book_uri);
|
|
||||||
|
|
||||||
filename = g_build_filename (g_get_home_dir(),
|
filename = g_build_filename (g_get_home_dir(),
|
||||||
"evolution/local/Contacts/addressbook.db",
|
"evolution/local/Contacts/addressbook.db",
|
||||||
NULL);
|
NULL);
|
||||||
@ -201,6 +199,35 @@ set_default_book_uri_local (void)
|
|||||||
g_free (filename);
|
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
|
static void
|
||||||
set_default_book_uri_from_config_db (void)
|
set_default_book_uri_from_config_db (void)
|
||||||
{
|
{
|
||||||
@ -208,13 +235,13 @@ set_default_book_uri_from_config_db (void)
|
|||||||
EConfigListener* config_db;
|
EConfigListener* config_db;
|
||||||
|
|
||||||
config_db = e_book_get_config_database ();
|
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) {
|
g_signal_connect (config_db,
|
||||||
default_book_uri = e_book_expand_uri (val);
|
"key_changed",
|
||||||
g_free (val);
|
G_CALLBACK (default_folder_listener), NULL);
|
||||||
} else
|
|
||||||
set_default_book_uri_local ();
|
set_default_book_uri (val);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Reference in New Issue
Block a user