From dc0d0ee010319425b19d8d8d493f0bc489d5fd07 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 4 Dec 2008 11:42:49 +0000 Subject: Implement bug #263268 - Contact categories need to be able to be filtered by "not categorized". Also fix a crasher. svn path=/branches/kill-bonobo/; revision=36831 --- addressbook/gui/component/e-book-shell-view-actions.c | 12 +++++++++++- addressbook/gui/component/e-book-shell-view-private.c | 9 +++++++++ addressbook/gui/component/e-book-shell-view-private.h | 3 ++- addressbook/gui/widgets/e-addressbook-view.c | 7 ++++--- 4 files changed, 26 insertions(+), 5 deletions(-) (limited to 'addressbook') diff --git a/addressbook/gui/component/e-book-shell-view-actions.c b/addressbook/gui/component/e-book-shell-view-actions.c index 646715d88a..457f15cf1b 100644 --- a/addressbook/gui/component/e-book-shell-view-actions.c +++ b/addressbook/gui/component/e-book-shell-view-actions.c @@ -753,7 +753,14 @@ static GtkRadioActionEntry contact_filter_entries[] = { N_("Any Category"), NULL, NULL, - CONTACT_FILTER_ANY_CATEGORY } + CONTACT_FILTER_ANY_CATEGORY }, + + { "contact-filter-unmatched", + NULL, + N_("Unmatched"), + NULL, + NULL, + CONTACT_FILTER_UNMATCHED } }; static GtkRadioActionEntry contact_search_entries[] = { @@ -898,4 +905,7 @@ e_book_shell_view_update_search_filter (EBookShellView *book_shell_view) /* Use any action in the group; doesn't matter which. */ e_shell_content_set_filter_action (shell_content, radio_action); + + ii = CONTACT_FILTER_UNMATCHED; + e_shell_content_add_filter_separator_after (shell_content, ii); } diff --git a/addressbook/gui/component/e-book-shell-view-private.c b/addressbook/gui/component/e-book-shell-view-private.c index 521260bdeb..509547c6c0 100644 --- a/addressbook/gui/component/e-book-shell-view-private.c +++ b/addressbook/gui/component/e-book-shell-view-private.c @@ -575,6 +575,15 @@ e_book_shell_view_execute_search (EBookShellView *book_shell_view) case CONTACT_FILTER_ANY_CATEGORY: break; + case CONTACT_FILTER_UNMATCHED: + temp = g_strdup_printf ( + "(and (not (and (exists \"CATEGORIES\") " + "(not (is \"CATEGORIES\" \"\")))) %s)", + query); + g_free (query); + query = temp; + break; + default: { GList *categories; diff --git a/addressbook/gui/component/e-book-shell-view-private.h b/addressbook/gui/component/e-book-shell-view-private.h index 9bb4f91a22..0079ca3ec2 100644 --- a/addressbook/gui/component/e-book-shell-view-private.h +++ b/addressbook/gui/component/e-book-shell-view-private.h @@ -78,7 +78,8 @@ struct _EditorUidClosure { /* List these in the order to be displayed. * Positive values are reserved for categories. */ enum { - CONTACT_FILTER_ANY_CATEGORY = -1 + CONTACT_FILTER_ANY_CATEGORY = -2, + CONTACT_FILTER_UNMATCHED = -1 }; /* List these in the order to be displayed. */ diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 216a7c77a6..a979e5a1cb 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -666,9 +666,10 @@ addressbook_view_class_init (EAddressbookViewClass *class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (EAddressbookViewClass, open_contact), NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - E_TYPE_CONTACT); + e_marshal_VOID__OBJECT_BOOLEAN, + G_TYPE_NONE, 2, + E_TYPE_CONTACT, + G_TYPE_BOOLEAN); signals[POPUP_EVENT] = g_signal_new ( "popup-event", -- cgit