aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/addressbook.c
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-08-16 14:17:18 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-08-16 14:17:18 +0800
commitfef28ce070e3d25b8837ca8015936cb6b7ddf08d (patch)
treec4eecca87f2307c89bda29b838a4d7ecdc015945 /addressbook/gui/component/addressbook.c
parentabbdee83ee54fab89c5d6d1dfd61e969be85c16b (diff)
downloadgsoc2013-evolution-fef28ce070e3d25b8837ca8015936cb6b7ddf08d.tar
gsoc2013-evolution-fef28ce070e3d25b8837ca8015936cb6b7ddf08d.tar.gz
gsoc2013-evolution-fef28ce070e3d25b8837ca8015936cb6b7ddf08d.tar.bz2
gsoc2013-evolution-fef28ce070e3d25b8837ca8015936cb6b7ddf08d.tar.lz
gsoc2013-evolution-fef28ce070e3d25b8837ca8015936cb6b7ddf08d.tar.xz
gsoc2013-evolution-fef28ce070e3d25b8837ca8015936cb6b7ddf08d.tar.zst
gsoc2013-evolution-fef28ce070e3d25b8837ca8015936cb6b7ddf08d.zip
Boost scoring on an exact nickname match. Manually addressify match.
2001-08-16 Jon Trowbridge <trow@ximian.com> * gui/component/select-names/e-select-names-completion.c (match_nickname): Boost scoring on an exact nickname match. Manually addressify match. (match_name): Manually addressify matches. (book_query_score): Remove automatic addressification. * gui/component/addressbook.c (addressbook_query_changed): Minor tweak to avoid a crash if we have a negative subid with id ESB_CATEGORY. This should never happen. (addressbook_menu_activated): Reset the entry/option when we select "Clear". Some changes to reflect renaming in ESearchBar. * gui/component/select-names/e-select-names-bonobo.c (entry_set_property_fn): Cardify after importing destinations. This might fix a problem that Damon is having. 2001-08-16 Jon Trowbridge <trow@ximian.com> * e-filter-bar.c (option_changed): Adjusted for renamed ESearchBar functions. (menubar_activated): Adjusted for renamed ESearchBar functions. * e-search-bar.c: Renames some of the horrible function names: s/option_choice/item_id/, s/suboption_choice/subitem_id/. 2001-08-16 Jon Trowbridge <trow@ximian.com> * gui/cal-search-bar.c: Changed to reflect my renaming of some of the more hideously-named functions in the ESearchBar API. svn path=/trunk/; revision=12081
Diffstat (limited to 'addressbook/gui/component/addressbook.c')
-rw-r--r--addressbook/gui/component/addressbook.c65
1 files changed, 38 insertions, 27 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index c0acf414ad..e73a01164b 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -616,16 +616,6 @@ static ESearchBarItem addressbook_search_menu_items[] = {
{ NULL, -1, NULL },
};
-static void
-addressbook_menu_activated (ESearchBar *esb, int id, AddressbookView *view)
-{
- switch (id) {
- case E_FILTERBAR_RESET_ID:
- e_addressbook_view_show_all(view->view);
- break;
- }
-}
-
enum {
ESB_ANY,
ESB_FULL_NAME,
@@ -643,11 +633,33 @@ static ESearchBarItem addressbook_search_option_items[] = {
{ NULL, -1, NULL }
};
-static ECategoriesMasterList *category_list = NULL;
+static void
+addressbook_menu_activated (ESearchBar *esb, int id, AddressbookView *view)
+{
+ switch (id) {
+ case E_FILTERBAR_RESET_ID:
+ /* e_addressbook_view_show_all(view->view); */
+
+ /* Fix option menu if we are using "Category is" */
+ if (e_search_bar_get_item_id (esb) == ESB_CATEGORY) {
+
+ e_search_bar_set_subitem_id (esb, G_MAXINT);
+
+ } else {
+
+ e_search_bar_set_text (esb, "");
+
+ }
+
+ break;
+ }
+}
static ECategoriesMasterList *
get_master_list (void)
{
+ static ECategoriesMasterList *category_list = NULL;
+
if (category_list == NULL)
category_list = e_categories_master_list_wombat_new ();
return category_list;
@@ -659,11 +671,11 @@ addressbook_query_changed (ESearchBar *esb, AddressbookView *view)
ECategoriesMasterList *master_list;
char *search_word, *search_query;
const char *category_name;
- int search_type, subopt;
+ int search_type, subid;
gtk_object_get(GTK_OBJECT(esb),
"text", &search_word,
- "option_choice", &search_type,
+ "item_id", &search_type,
NULL);
if (search_type == ESB_ADVANCED) {
@@ -685,17 +697,15 @@ addressbook_query_changed (ESearchBar *esb, AddressbookView *view)
search_word);
break;
case ESB_CATEGORY:
- subopt = e_search_bar_get_suboption_choice (esb);
- g_message ("subopt: %d", subopt);
- if (subopt >= 0) {
- if (subopt == G_MAXINT) {
- /* match everything */
- search_query = g_strdup ("(contains \"full_name\" \"\")");
- } else {
- master_list = get_master_list ();
- category_name = e_categories_master_list_nth (master_list, subopt);
- search_query = g_strdup_printf ("(contains \"category\" \"%s\")", category_name);
- }
+ subid = e_search_bar_get_subitem_id (esb);
+
+ if (subid < 0 || subid == G_MAXINT) {
+ /* match everything */
+ search_query = g_strdup ("(contains \"full_name\" \"\")");
+ } else {
+ master_list = get_master_list ();
+ category_name = e_categories_master_list_nth (master_list, subid);
+ search_query = g_strdup_printf ("(contains \"category\" \"%s\")", category_name);
}
break;
default:
@@ -705,9 +715,10 @@ addressbook_query_changed (ESearchBar *esb, AddressbookView *view)
} else
search_query = g_strdup ("(contains \"full_name\" \"\")");
- gtk_object_set (GTK_OBJECT(view->view),
- "query", search_query,
- NULL);
+ if (search_query)
+ gtk_object_set (GTK_OBJECT(view->view),
+ "query", search_query,
+ NULL);
g_free (search_query);
g_free (search_word);