aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-12-04 19:06:37 +0800
committerMilan Crha <mcrha@src.gnome.org>2008-12-04 19:06:37 +0800
commita3b8881d09c0a6854b12551dcee89c87c28739fe (patch)
tree7a933e163fb78253d0cb949824e19ae54778e2cc /addressbook
parent19b21da74a879a86f1172376bd45c070ac1db80b (diff)
downloadgsoc2013-evolution-a3b8881d09c0a6854b12551dcee89c87c28739fe.tar.gz
gsoc2013-evolution-a3b8881d09c0a6854b12551dcee89c87c28739fe.tar.zst
gsoc2013-evolution-a3b8881d09c0a6854b12551dcee89c87c28739fe.zip
** Fix for bug #263268
2008-12-04 Milan Crha <mcrha@redhat.com> ** Fix for bug #263268 * gui/widgets/e-addressbook-view.c: (search_activated), (make_suboptions): Be able to search for contacts without category. svn path=/trunk/; revision=36830
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog7
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c32
2 files changed, 29 insertions, 10 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index bb0cdeb755..0465a19384 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,10 @@
+2008-12-04 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #263268
+
+ * gui/widgets/e-addressbook-view.c: (search_activated),
+ (make_suboptions): Be able to search for contacts without category.
+
2008-12-02 Matthew Barnes <mbarnes@redhat.com>
** Fixes part of bug #348299
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index cda3922a87..cc5558324e 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -1403,8 +1403,12 @@ search_activated (ESearchBar *esb, EABView *v)
if (subid) {
master_list = get_master_list (FALSE);
- category_name = g_list_nth_data (master_list, subid-1);
- view_sexp = g_strdup_printf ("(is \"category_list\" \"%s\")", category_name);
+ if (subid < 3) {
+ view_sexp = g_strdup ("(not (and (exists \"CATEGORIES\") (not (is \"CATEGORIES\" \"\"))))");
+ } else {
+ category_name = g_list_nth_data (master_list, subid-3);
+ view_sexp = g_strdup_printf ("(is \"category_list\" \"%s\")", category_name);
+ }
search_query = g_strconcat ("(and ", view_sexp, search_query, ")", NULL);
g_free (view_sexp);
}
@@ -1518,24 +1522,32 @@ make_suboptions (EABView *view)
master_list = get_master_list (FALSE);
N = g_list_length (master_list);
- subitems = g_new (EABSearchBarItem, N+2);
+ subitems = g_new (EABSearchBarItem, N+4);
subitems[0].search.id = 0;
subitems[0].search.text = g_strdup (_("Any Category"));
subitems[0].image = NULL;
+ subitems[1].search.text = g_strdup (_("Unmatched"));
+ subitems[1].search.id = 1;
+ subitems[1].image = NULL;
+
+ subitems[2].search.text = NULL;
+ subitems[2].search.id = 0;
+ subitems[2].image = NULL;
+
for (i=0; i<N; ++i) {
const char *category = g_list_nth_data (master_list, i);
- subitems[i+1].search.id = i+1;
- subitems[i+1].search.text = g_strdup (category);
- subitems[i+1].image = (char *)e_categories_get_icon_file_for (category);
+ subitems[i+3].search.id = i+3;
+ subitems[i+3].search.text = g_strdup (category);
+ subitems[i+3].image = (char *)e_categories_get_icon_file_for (category);
}
- subitems[N+1].search.id = -1;
- subitems[N+1].search.text = NULL;
- subitems[N+1].image = NULL;
+ subitems[N+3].search.id = -1;
+ subitems[N+3].search.text = NULL;
+ subitems[N+3].image = NULL;
- qsort (subitems + 1, N, sizeof (subitems[0]), compare_subitems);
+ qsort (subitems + 3, N, sizeof (subitems[0]), compare_subitems);
menu = generate_viewoption_menu (subitems);
e_search_bar_set_viewoption_menu ((ESearchBar *)view->search, menu);