aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2004-01-24 03:35:02 +0800
committerChris Toshok <toshok@src.gnome.org>2004-01-24 03:35:02 +0800
commita5157a42da8130dbdf50ad0d5053378b13c2b882 (patch)
tree43967072a2b47e9591fd3d2818b81876864f6894 /addressbook/gui
parentc6ba8e9f2d7c34b91e965343c9356d7e2a80e1a7 (diff)
downloadgsoc2013-evolution-a5157a42da8130dbdf50ad0d5053378b13c2b882.tar
gsoc2013-evolution-a5157a42da8130dbdf50ad0d5053378b13c2b882.tar.gz
gsoc2013-evolution-a5157a42da8130dbdf50ad0d5053378b13c2b882.tar.bz2
gsoc2013-evolution-a5157a42da8130dbdf50ad0d5053378b13c2b882.tar.lz
gsoc2013-evolution-a5157a42da8130dbdf50ad0d5053378b13c2b882.tar.xz
gsoc2013-evolution-a5157a42da8130dbdf50ad0d5053378b13c2b882.tar.zst
gsoc2013-evolution-a5157a42da8130dbdf50ad0d5053378b13c2b882.zip
[ fixes bug #52571 ] ugh. name fields that have \" around the name break
2004-01-23 Chris Toshok <toshok@ximian.com> [ fixes bug #52571 ] * util/eab-book-util.c (escape): ugh. name fields that have \" around the name break our queries, because it turns it into (for instance): (contains "full_name" ""Toshok""). so we need to turn that into: (contains "full_name" "\"Toshok\""). (eab_name_and_email_query): escape both the name and email, and use an EBookQuery instead of passing the string to e_book_async_get_contacts. Looks like ross missed a couple of spots. (eab_nickname_query): same. * gui/component/addressbook.c (free_load_source_data): new function, free up the data and unref the source if there is one. (load_source_auth_cb): call free_load_source_data instead of just g_free'ing the struct. (load_source_cb): same. (default_book_cb): new function, we need this so we can fill in the source for the default book. get the source, then call load_source_cb to continue processing as normal. (addressbook_load_default_book): use default_book_cb instead of load_source_cb. svn path=/trunk/; revision=24383
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/addressbook.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 1062e2632d..dcf85d9d79 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -686,12 +686,20 @@ typedef struct {
} LoadSourceData;
static void
+free_load_source_data (LoadSourceData *data)
+{
+ if (data->source)
+ g_object_unref (data->source);
+ g_free (data);
+}
+
+static void
load_source_auth_cb (EBook *book, EBookStatus status, gpointer closure)
{
LoadSourceData *data = closure;
if (data->cancelled) {
- g_free (data);
+ free_load_source_data (data);
return;
}
@@ -707,7 +715,7 @@ load_source_auth_cb (EBook *book, EBookStatus status, gpointer closure)
g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
gtk_widget_show (dialog);
data->cb (book, E_BOOK_ERROR_OK, data->closure);
- g_free (data);
+ free_load_source_data (data);
return;
}
else {
@@ -723,8 +731,7 @@ load_source_auth_cb (EBook *book, EBookStatus status, gpointer closure)
data->cb (book, status, data->closure);
- g_object_unref (data->source);
- g_free (data);
+ free_load_source_data (data);
}
static gboolean
@@ -812,7 +819,7 @@ load_source_cb (EBook *book, EBookStatus status, gpointer closure)
LoadSourceData *load_source_data = closure;
if (load_source_data->cancelled) {
- g_free (load_source_data);
+ free_load_source_data (load_source_data);
return;
}
@@ -832,8 +839,7 @@ load_source_cb (EBook *book, EBookStatus status, gpointer closure)
}
load_source_data->cb (book, status, load_source_data->closure);
- g_object_unref (load_source_data->source);
- g_free (load_source_data);
+ free_load_source_data (load_source_data);
}
guint
@@ -860,17 +866,27 @@ addressbook_load_source_cancel (guint id)
load_source_data->cancelled = TRUE;
}
+static void
+default_book_cb (EBook *book, EBookStatus status, gpointer closure)
+{
+ LoadSourceData *load_source_data = closure;
+
+ if (status == E_BOOK_ERROR_OK)
+ load_source_data->source = g_object_ref (e_book_get_source (book));
+
+ load_source_cb (book, status, closure);
+}
+
void
addressbook_load_default_book (EBookCallback cb, gpointer closure)
{
LoadSourceData *load_source_data = g_new (LoadSourceData, 1);
- /* FIXME: We need to get the source for the default book */
-
load_source_data->cb = cb;
+ load_source_data->source = NULL;
load_source_data->closure = closure;
- e_book_async_get_default_addressbook (load_source_cb, load_source_data);
+ e_book_async_get_default_addressbook (default_book_cb, load_source_data);
}
static void