aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2004-05-26 01:35:44 +0800
committerChris Toshok <toshok@src.gnome.org>2004-05-26 01:35:44 +0800
commitd49714cc98da1c7cabb99fe38436e5af398229a1 (patch)
tree4d27da9074f76e37a17489843f4f8546494d2a76
parenta1b9b50fef1f74538f4165fce7b95bb3385ac4d7 (diff)
downloadgsoc2013-evolution-d49714cc98da1c7cabb99fe38436e5af398229a1.tar
gsoc2013-evolution-d49714cc98da1c7cabb99fe38436e5af398229a1.tar.gz
gsoc2013-evolution-d49714cc98da1c7cabb99fe38436e5af398229a1.tar.bz2
gsoc2013-evolution-d49714cc98da1c7cabb99fe38436e5af398229a1.tar.lz
gsoc2013-evolution-d49714cc98da1c7cabb99fe38436e5af398229a1.tar.xz
gsoc2013-evolution-d49714cc98da1c7cabb99fe38436e5af398229a1.tar.zst
gsoc2013-evolution-d49714cc98da1c7cabb99fe38436e5af398229a1.zip
[ fixes #58654 ]
2004-05-25 Chris Toshok <toshok@ximian.com> [ fixes #58654 ] * gui/component/select-names/e-select-names.c (update_query): build up the query using e_book_query calls so we're insulated from field name changes. also, conjoin if we have more than 1 query element, not more than 2 (i *hope* this was an off by 1 error...) svn path=/trunk/; revision=26081
-rw-r--r--addressbook/ChangeLog10
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c45
2 files changed, 30 insertions, 25 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 5f53981e14..38e7f7301b 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,13 @@
+2004-05-25 Chris Toshok <toshok@ximian.com>
+
+ [ fixes #58654 ]
+
+ * gui/component/select-names/e-select-names.c (update_query):
+ build up the query using e_book_query calls so we're insulated
+ from field name changes. also, conjoin if we have more than 1
+ query element, not more than 2 (i *hope* this was an off by 1
+ error...)
+
2004-05-25 Sivaiah Nallagatla <snallagatla@novell.com>
* gui/component/addressbook.c (load_source_auth_cb )
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
index 894d5e9847..cdf5628caa 100644
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ b/addressbook/gui/component/select-names/e-select-names.c
@@ -347,10 +347,10 @@ update_query (GtkWidget *widget, ESelectNames *e_select_names)
{
char *category = "";
const char *search = "";
- char *query;
- char *q_array[4];
+ EBookQuery *query;
+ EBookQuery *q_array[4];
+ char *query_str;
int i;
- GString *s = g_string_new ("");
if (e_select_names->categories) {
category = e_categories_master_list_option_menu_get_category (E_CATEGORIES_MASTER_LIST_OPTION_MENU (e_select_names->categories));
@@ -359,34 +359,29 @@ update_query (GtkWidget *widget, ESelectNames *e_select_names)
search = gtk_entry_get_text (GTK_ENTRY (e_select_names->select_entry));
}
- e_sexp_encode_string (s, search);
-
i = 0;
- q_array[i++] = "(contains \"email\" \"\")";
+ q_array[i++] = e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_CONTAINS, "");
if (category && *category)
- q_array[i++] = g_strdup_printf ("(is \"category\" \"%s\")", category);
+ q_array[i++] = e_book_query_field_test (E_CONTACT_CATEGORY_LIST, E_BOOK_QUERY_IS, category);
if (search && *search)
- q_array[i++] = g_strdup_printf ("(or (beginswith \"email\" %s) "
- " (beginswith \"full_name\" %s) "
- " (beginswith \"nickname\" %s)"
- " (beginswith \"file_as\" %s))",
- s->str, s->str, s->str, s->str);
- q_array[i++] = NULL;
- if (i > 2) {
- char *temp = g_strjoinv (" ", q_array);
- query = g_strdup_printf ("(and %s)", temp);
- g_free (temp);
- } else {
- query = g_strdup (q_array[0]);
+ q_array[i++] = e_book_query_orv (e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_BEGINS_WITH, search),
+ e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_BEGINS_WITH, search),
+ e_book_query_field_test (E_CONTACT_NICKNAME, E_BOOK_QUERY_BEGINS_WITH, search),
+ e_book_query_field_test (E_CONTACT_FILE_AS, E_BOOK_QUERY_BEGINS_WITH, search),
+ NULL);
+ if (i > 1) {
+ query = e_book_query_and (i, q_array, TRUE);
+ }
+ else {
+ query = q_array[0];
}
+ query_str = e_book_query_to_string (query);
+ printf ("query_str = %s\n", query_str);
g_object_set (e_select_names->model,
- "query", query,
+ "query", query_str,
NULL);
- for (i = 1; q_array[i]; i++) {
- g_free (q_array[i]);
- }
- g_free (query);
- g_string_free (s, TRUE);
+ g_free (query_str);
+ e_book_query_unref (query);
}
static void