aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-06-27 08:22:02 +0800
committerChris Lahey <clahey@src.gnome.org>2001-06-27 08:22:02 +0800
commit7728e7dbd26fd0140cf493a190c424105902fd7c (patch)
tree14aca4dc5c002bc13158e267c5442af04f03696a /addressbook
parentabec8da1928f0fb1d20adcd532eeed038b97b71b (diff)
downloadgsoc2013-evolution-7728e7dbd26fd0140cf493a190c424105902fd7c.tar
gsoc2013-evolution-7728e7dbd26fd0140cf493a190c424105902fd7c.tar.gz
gsoc2013-evolution-7728e7dbd26fd0140cf493a190c424105902fd7c.tar.bz2
gsoc2013-evolution-7728e7dbd26fd0140cf493a190c424105902fd7c.tar.lz
gsoc2013-evolution-7728e7dbd26fd0140cf493a190c424105902fd7c.tar.xz
gsoc2013-evolution-7728e7dbd26fd0140cf493a190c424105902fd7c.tar.zst
gsoc2013-evolution-7728e7dbd26fd0140cf493a190c424105902fd7c.zip
Added category searching to the file backend.
2001-06-26 Christopher James Lahey <clahey@ximian.com> * backend/pas/pas-backend-file.c (compare_category): Added category searching to the file backend. * gui/component/addressbook.c (addressbook_query_changed): Added category searching to the search bar. svn path=/trunk/; revision=10520
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog8
-rw-r--r--addressbook/backend/pas/pas-backend-file.c25
-rw-r--r--addressbook/gui/component/addressbook.c6
3 files changed, 39 insertions, 0 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 09c75a89e0..74a723d4fb 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,11 @@
+2001-06-26 Christopher James Lahey <clahey@ximian.com>
+
+ * backend/pas/pas-backend-file.c (compare_category): Added
+ category searching to the file backend.
+
+ * gui/component/addressbook.c (addressbook_query_changed): Added
+ category searching to the search bar.
+
2001-06-25 Peter Williams <peterw@ximian.com>
* conduit/Makefile.am (INCLUDES): Fix for srcdir != builddir.
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index a3f708ce79..e9086aa1ff 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -268,6 +268,30 @@ compare_address (ECardSimple *card, const char *str,
return FALSE;
}
+static gboolean
+compare_category (ECardSimple *card, const char *str,
+ char *(*compare)(const char*, const char*))
+{
+ EList *categories;
+ EIterator *iterator;
+ ECard *ecard;
+ gtk_object_get (GTK_OBJECT (card),
+ "card", &ecard,
+ NULL);
+ gtk_object_get (GTK_OBJECT (ecard),
+ "category_list", &categories,
+ NULL);
+
+ for (iterator = e_list_get_iterator(categories); e_iterator_is_valid (iterator); e_iterator_next (iterator)) {
+ const char *category = e_iterator_get (iterator);
+
+ if (compare(category, str))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static struct prop_info {
ECardSimpleField field_id;
const char *query_prop;
@@ -304,6 +328,7 @@ static struct prop_info {
LIST_PROP ( "email", "email", compare_email ),
LIST_PROP ( "phone", "phone", compare_phone ),
LIST_PROP ( "address", "address", compare_address ),
+ LIST_PROP ( "category", "category", compare_category ),
};
static int num_prop_infos = sizeof(prop_info_table) / sizeof(prop_info_table[0]);
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index bd51a3515e..cb52b6fd5d 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -547,12 +547,14 @@ enum {
ESB_ANY,
ESB_FULL_NAME,
ESB_EMAIL,
+ ESB_CATEGORY,
};
static ESearchBarItem addressbook_search_option_items[] = {
{ N_("Any field contains"), ESB_ANY },
{ N_("Name contains"), ESB_FULL_NAME },
{ N_("Email contains"), ESB_EMAIL },
+ { N_("Category contains"), ESB_CATEGORY },
{ NULL, -1 }
};
@@ -581,6 +583,10 @@ addressbook_query_changed (ESearchBar *esb, AddressbookView *view)
search_query = g_strdup_printf ("(contains \"email\" \"%s\")",
search_word);
break;
+ case ESB_CATEGORY:
+ search_query = g_strdup_printf ("(contains \"category\" \"%s\")",
+ search_word);
+ break;
default:
search_query = g_strdup ("(contains \"full_name\" \"\")");
break;