aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-01-31 05:11:13 +0800
committerChris Toshok <toshok@src.gnome.org>2002-01-31 05:11:13 +0800
commitf41e2fe50e08e52411d104f6e4aa26b31d0a9e86 (patch)
tree8690b51ec6fa6e799101046bb69937444287280e /addressbook
parentcbf51ec6f0b621c0752ed35d9c55a5a7a7e8a93f (diff)
downloadgsoc2013-evolution-f41e2fe50e08e52411d104f6e4aa26b31d0a9e86.tar
gsoc2013-evolution-f41e2fe50e08e52411d104f6e4aa26b31d0a9e86.tar.gz
gsoc2013-evolution-f41e2fe50e08e52411d104f6e4aa26b31d0a9e86.tar.bz2
gsoc2013-evolution-f41e2fe50e08e52411d104f6e4aa26b31d0a9e86.tar.lz
gsoc2013-evolution-f41e2fe50e08e52411d104f6e4aa26b31d0a9e86.tar.xz
gsoc2013-evolution-f41e2fe50e08e52411d104f6e4aa26b31d0a9e86.tar.zst
gsoc2013-evolution-f41e2fe50e08e52411d104f6e4aa26b31d0a9e86.zip
compute the change db filename based on our contact db filename.
2002-01-30 Chris Toshok <toshok@ximian.com> * backend/pas/pas-backend-file.c (pas_backend_file_changes): compute the change db filename based on our contact db filename. (pas_backend_file_load_uri): store the filename in bf->priv->filename. (pas_backend_file_destroy): free the filename, and (!) free bf->priv too. svn path=/trunk/; revision=15529
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog9
-rw-r--r--addressbook/backend/pas/pas-backend-file.c22
2 files changed, 25 insertions, 6 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index dfeb7a70e9..f7b8e5f16f 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,12 @@
+2002-01-30 Chris Toshok <toshok@ximian.com>
+
+ * backend/pas/pas-backend-file.c (pas_backend_file_changes):
+ compute the change db filename based on our contact db filename.
+ (pas_backend_file_load_uri): store the filename in
+ bf->priv->filename.
+ (pas_backend_file_destroy): free the filename, and (!) free
+ bf->priv too.
+
2002-01-28 Jeffrey Stedfast <fejj@ximian.com>
* backend/ebook/e-destination.c (e_destination_is_valid): Revert
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 56c8d545cc..57f9462bb8 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -54,6 +54,7 @@ struct _PASBackendFilePrivate {
GList *clients;
gboolean loaded;
char *uri;
+ char *filename;
DB *file_db;
EList *book_views;
gboolean writable;
@@ -369,6 +370,7 @@ pas_backend_file_changes (PASBackendFile *bf,
DBC *dbc;
PASBackendFileBookView *view = (PASBackendFileBookView *)cnstview;
PASBackendFileChangeContext *ctx = cnstview->change_context;
+ char *dirname, *slash;
memset (&id_dbt, 0, sizeof (id_dbt));
memset (&vcard_dbt, 0, sizeof (vcard_dbt));
@@ -376,11 +378,16 @@ pas_backend_file_changes (PASBackendFile *bf,
if (!bf->priv->loaded)
return;
- /* Find the changed ids - FIX ME, path should not be hard coded */
- filename = g_strdup_printf ("%s/evolution/local/Contacts/%s.db", g_get_home_dir (), view->change_id);
+ /* Find the changed ids */
+ dirname = g_strdup (bf->priv->filename);
+ slash = strrchr (dirname, '/');
+ *slash = '\0';
+
+ filename = g_strdup_printf ("%s/%s.db", dirname, view->change_id);
ehash = e_dbhash_new (filename);
g_free (filename);
-
+ g_free (dirname);
+
db_error = db->cursor (db, NULL, &dbc, 0);
if (db_error != 0) {
@@ -1303,9 +1310,6 @@ pas_backend_file_load_uri (PASBackend *backend,
}
}
- g_free (filename);
-
-
if (db_error != 0) {
bf->priv->file_db = NULL;
return FALSE;
@@ -1325,6 +1329,9 @@ pas_backend_file_load_uri (PASBackend *backend,
g_free(bf->priv->uri);
bf->priv->uri = g_strdup (uri);
+ g_free (bf->priv->filename);
+ bf->priv->filename = filename;
+
return TRUE;
}
@@ -1471,6 +1478,9 @@ pas_backend_file_destroy (GtkObject *object)
gtk_object_unref(GTK_OBJECT(bf->priv->book_views));
g_free (bf->priv->uri);
+ g_free (bf->priv->filename);
+
+ g_free (bf->priv);
GTK_OBJECT_CLASS (pas_backend_file_parent_class)->destroy (object);
}