aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-06-11 05:13:11 +0800
committerChris Lahey <clahey@src.gnome.org>2002-06-11 05:13:11 +0800
commit524e3509c4a17958387308b3674548f7166610d6 (patch)
tree569904a6b6969ebf6927b792c4755db53fc0c5ae /addressbook
parentb17c20520eb4b1c6a8ad6acd227a4ba08b29a8c2 (diff)
downloadgsoc2013-evolution-524e3509c4a17958387308b3674548f7166610d6.tar
gsoc2013-evolution-524e3509c4a17958387308b3674548f7166610d6.tar.gz
gsoc2013-evolution-524e3509c4a17958387308b3674548f7166610d6.tar.bz2
gsoc2013-evolution-524e3509c4a17958387308b3674548f7166610d6.tar.lz
gsoc2013-evolution-524e3509c4a17958387308b3674548f7166610d6.tar.xz
gsoc2013-evolution-524e3509c4a17958387308b3674548f7166610d6.tar.zst
gsoc2013-evolution-524e3509c4a17958387308b3674548f7166610d6.zip
Made expand_uri a bit more robust and readable.
2002-06-10 Christopher James Lahey <clahey@ximian.com> * backend/ebook/e-book-util.c (e_book_expand_uri): Made expand_uri a bit more robust and readable. (e_book_get_default_book_uri): Made e_book_get_default_book_uri use e_book_expand_uri if using the bonobo_config value. * gui/component/e-address-popup.c (start_query): Handle the failure state here by acting as if there are no matches. svn path=/trunk/; revision=17159
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog10
-rw-r--r--addressbook/backend/ebook/e-book-util.c36
-rw-r--r--addressbook/gui/component/e-address-popup.c5
3 files changed, 33 insertions, 18 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 7244a91562..2015c0af47 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,13 @@
+2002-06-10 Christopher James Lahey <clahey@ximian.com>
+
+ * backend/ebook/e-book-util.c (e_book_expand_uri): Made expand_uri
+ a bit more robust and readable.
+ (e_book_get_default_book_uri): Made e_book_get_default_book_uri
+ use e_book_expand_uri if using the bonobo_config value.
+
+ * gui/component/e-address-popup.c (start_query): Handle the
+ failure state here by acting as if there are no matches.
+
2002-06-05 Christopher James Lahey <clahey@ximian.com>
* gui/widgets/e-minicard.c (e_minicard_event): Call
diff --git a/addressbook/backend/ebook/e-book-util.c b/addressbook/backend/ebook/e-book-util.c
index 62694a8563..ff388105f0 100644
--- a/addressbook/backend/ebook/e-book-util.c
+++ b/addressbook/backend/ebook/e-book-util.c
@@ -42,27 +42,27 @@ struct _CommonBookInfo {
char *
e_book_expand_uri (const char *uri)
{
- char *new_uri;
-
if (!strncmp (uri, "file:", 5)) {
- if (strlen (uri + 7) > 3
- && !strcmp (uri + strlen(uri) - 3, ".db")) {
- /* it's a .db file */
- new_uri = g_strdup (uri);
- }
- else {
- char *file_name;
+ int length = strlen (uri);
+ int offset = 5;
+
+ if (!strncmp (uri, "file://", 7))
+ offset = 7;
+
+ if (length < 3 || strcmp (uri + length - 3, ".db")) {
/* we assume it's a dir and glom addressbook.db onto the end. */
- file_name = g_concat_dir_and_file(uri + 7, "addressbook.db");
- new_uri = g_strdup_printf("file://%s", file_name);
+
+ char *ret_val;
+ char *file_name;
+
+ file_name = g_concat_dir_and_file(uri + offset, "addressbook.db");
+ ret_val = g_strdup_printf("file://%s", file_name);
g_free(file_name);
+ return ret_val;
}
}
- else {
- new_uri = g_strdup (uri);
- }
- return new_uri;
+ return g_strdup (uri);
}
static void
@@ -281,9 +281,9 @@ e_book_get_default_book_uri ()
CORBA_exception_free (&ev);
if (val) {
- uri = val;
- }
- else {
+ uri = e_book_expand_uri (val);
+ g_free (val);
+ } else {
char *filename;
filename = gnome_util_prepend_user_home ("evolution/local/Contacts/addressbook.db");
uri = g_strdup_printf ("file://%s", filename);
diff --git a/addressbook/gui/component/e-address-popup.c b/addressbook/gui/component/e-address-popup.c
index 7c04cc0130..553ba642c8 100644
--- a/addressbook/gui/component/e-address-popup.c
+++ b/addressbook/gui/component/e-address-popup.c
@@ -1131,6 +1131,11 @@ static void
start_query (EBook *book, EBookStatus status, gpointer closure)
{
EAddressPopup *pop = E_ADDRESS_POPUP (closure);
+
+ if (status != E_BOOK_STATUS_SUCCESS) {
+ e_address_popup_no_matches (pop);
+ return;
+ }
if (pop->query_tag)
e_book_simple_query_cancel (book, pop->query_tag);