aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2003-04-01 14:58:27 +0800
committerChris Toshok <toshok@src.gnome.org>2003-04-01 14:58:27 +0800
commit9ba2e2d4613f0874ab95cc635139f4ffd090bb24 (patch)
treebf2fb2fb03feecd4888599aedde5de034884653f /addressbook
parent5f2900575a02a587203c98617583537708adee8f (diff)
downloadgsoc2013-evolution-9ba2e2d4613f0874ab95cc635139f4ffd090bb24.tar
gsoc2013-evolution-9ba2e2d4613f0874ab95cc635139f4ffd090bb24.tar.gz
gsoc2013-evolution-9ba2e2d4613f0874ab95cc635139f4ffd090bb24.tar.bz2
gsoc2013-evolution-9ba2e2d4613f0874ab95cc635139f4ffd090bb24.tar.lz
gsoc2013-evolution-9ba2e2d4613f0874ab95cc635139f4ffd090bb24.tar.xz
gsoc2013-evolution-9ba2e2d4613f0874ab95cc635139f4ffd090bb24.tar.zst
gsoc2013-evolution-9ba2e2d4613f0874ab95cc635139f4ffd090bb24.zip
new function, just return the local uri. (set_default_book_uri_local): use
2003-03-31 Chris Toshok <toshok@ximian.com> * backend/ebook/e-book-util.c (get_local_book_uri): new function, just return the local uri. (set_default_book_uri_local): use get_local_book_uri. (e_book_default_book_open): only try and reload the default book if it's not already the local book. svn path=/trunk/; revision=20610
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog8
-rw-r--r--addressbook/backend/ebook/e-book-util.c33
2 files changed, 34 insertions, 7 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 8be281e512..8099c016ac 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,11 @@
+2003-03-31 Chris Toshok <toshok@ximian.com>
+
+ * backend/ebook/e-book-util.c (get_local_book_uri): new function,
+ just return the local uri.
+ (set_default_book_uri_local): use get_local_book_uri.
+ (e_book_default_book_open): only try and reload the default book
+ if it's not already the local book.
+
2003-03-31 JP Rosevear <jpr@ximian.com>
* conduit/address-conduit.c (card_removed): it emits a list now
diff --git a/addressbook/backend/ebook/e-book-util.c b/addressbook/backend/ebook/e-book-util.c
index 0fd50f7d5c..cc00d045f4 100644
--- a/addressbook/backend/ebook/e-book-util.c
+++ b/addressbook/backend/ebook/e-book-util.c
@@ -178,16 +178,28 @@ e_book_use_default_book (EBookCommonCallback cb, gpointer closure)
static char *default_book_uri;
-static void
-set_default_book_uri_local (void)
+static char*
+get_local_book_uri (void)
{
char *filename;
+ char *uri;
filename = g_build_filename (g_get_home_dir(),
"evolution/local/Contacts/addressbook.db",
NULL);
- default_book_uri = g_strdup_printf ("file://%s", filename);
+ uri = g_strdup_printf ("file://%s", filename);
+
g_free (filename);
+
+ return uri;
+}
+
+static void
+set_default_book_uri_local (void)
+{
+ g_free (default_book_uri);
+
+ default_book_uri = get_local_book_uri ();
}
static void
@@ -250,13 +262,20 @@ e_book_default_book_open (EBook *book, EBookStatus status, gpointer closure)
g_free (default_book_closure);
/* If there's a transient error, report it to the caller, but
- * if the old default folder has disappeared, fall back to
- * the local contacts folder instead.
+ * if the old default folder has disappeared, fall back to the
+ * local contacts folder instead, except when the default
+ * folder is also the local folder.
*/
if (status == E_BOOK_STATUS_PROTOCOL_NOT_SUPPORTED ||
status == E_BOOK_STATUS_NO_SUCH_BOOK) {
- set_default_book_uri_local ();
- e_book_load_default_book (book, user_response, user_closure);
+ char *local_uri = get_local_book_uri();
+ if (strcmp (local_uri, default_book_uri)) {
+ set_default_book_uri_local ();
+ e_book_load_default_book (book, user_response, user_closure);
+ }
+ else
+ user_response (book, status, user_closure);
+ g_free (local_uri);
} else {
user_response (book, status, user_closure);
}