aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--addressbook/ChangeLog19
-rw-r--r--addressbook/gui/component/addressbook.c65
-rw-r--r--addressbook/gui/component/select-names/e-select-names-bonobo.c1
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.c71
-rw-r--r--calendar/ChangeLog5
-rw-r--r--calendar/gui/cal-search-bar.c20
-rw-r--r--widgets/misc/ChangeLog9
-rw-r--r--widgets/misc/e-filter-bar.c9
-rw-r--r--widgets/misc/e-search-bar.c82
-rw-r--r--widgets/misc/e-search-bar.h16
10 files changed, 161 insertions, 136 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index b2d7c8bc11..2cb8dc355a 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,22 @@
+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-15 Chris Toshok <toshok@ximian.com>
* gui/component/addressbook-config.glade: set title of initial
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);
diff --git a/addressbook/gui/component/select-names/e-select-names-bonobo.c b/addressbook/gui/component/select-names/e-select-names-bonobo.c
index 90b3e477fb..3130d1c9c9 100644
--- a/addressbook/gui/component/select-names/e-select-names-bonobo.c
+++ b/addressbook/gui/component/select-names/e-select-names-bonobo.c
@@ -149,6 +149,7 @@ entry_set_property_fn (BonoboPropertyBag *bag,
g_assert (model != NULL);
e_select_names_model_import_destinationv (model, BONOBO_ARG_GET_STRING (arg));
+ e_select_names_model_cardify_all (model, NULL, 0);
break;
}
diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c
index 8222ae86ad..d91c9e5274 100644
--- a/addressbook/gui/component/select-names/e-select-names-completion.c
+++ b/addressbook/gui/component/select-names/e-select-names-completion.c
@@ -120,33 +120,6 @@ make_match (EDestination *dest, const gchar *menu_form, double score)
return match;
}
-static void
-emailify_match (ECompletionMatch *match)
-{
- EDestination *dest = E_DESTINATION (match->user_data);
- ECard *card = e_destination_get_card (dest);
- const gchar *email = e_destination_get_email (dest);
- const gchar *menu_txt = e_completion_match_get_menu_text (match);
-
- if (card && email && !e_card_evolution_list (card)) {
-
- if (email
- && menu_txt
- && *menu_txt
- && *menu_txt != '<'
- && strstr (menu_txt, email) == NULL
- && menu_txt[strlen(menu_txt)-1] != '>') {
- gchar *tmp = g_strdup_printf ("%s <%s>", menu_txt, email);
- gchar *tmp2 = g_strdup (e_completion_match_get_match_text (match));
- e_completion_match_set_text (match, tmp2, tmp);
- g_free (tmp);
- g_free (tmp2);
- }
-
- match->sort_minor = e_destination_get_email_num (dest);
- }
-}
-
/*
* Nickname query
*/
@@ -169,14 +142,16 @@ match_nickname (ESelectNamesCompletion *comp, EDestination *dest)
if (card->nickname
&& !g_utf8_strncasecmp (comp->priv->query_text, card->nickname, len)) {
ECompletionMatch *match = g_new0 (ECompletionMatch, 1);
- gchar *name = e_card_name_to_string (card->name);
gchar *str;
score = len * 10; /* nickname gives 10 points per matching character */
- str = g_strdup_printf ("(%s) %s", card->nickname, name);
+
+ if (len == strlen (card->nickname)) /* boost score on an exact match */
+ score *= 10;
+
+ str = g_strdup_printf ("(%s) %s <%s>", card->nickname, e_destination_get_name (dest), e_destination_get_email (dest));
match = make_match (dest, str, score);
- g_free (name);
g_free (str);
}
@@ -198,27 +173,25 @@ match_email (ESelectNamesCompletion *comp, EDestination *dest)
{
ECompletionMatch *match;
gint len = strlen (comp->priv->query_text);
- ECard *card = e_destination_get_card (dest);
+ const gchar *name = e_destination_get_name (dest);
const gchar *email = e_destination_get_email (dest);
double score;
if (email
&& !g_utf8_strncasecmp (comp->priv->query_text, email, len)
&& !e_destination_is_evolution_list (dest)) {
-
- gchar *name, *str;
+
+ gchar *str;
score = len * 2; /* 2 points for each matching character */
- name = e_card_name_to_string (card->name);
if (name && *name)
- str = g_strdup_printf ("<%s> %s", email, name);
+ str = g_strdup_printf ("<%s> %s", name, email);
else
str = g_strdup (email);
match = make_match (dest, str, score);
- g_free (name);
g_free (str);
return match;
@@ -303,6 +276,7 @@ match_name (ESelectNamesCompletion *comp, EDestination *dest)
ECompletionMatch *final_match = NULL;
gchar *menu_text = NULL;
ECard *card;
+ const gchar *email;
gchar *cpy, **strv;
gint len, i, match_len = 0;
gint match = 0, first_match = 0;
@@ -314,6 +288,8 @@ match_name (ESelectNamesCompletion *comp, EDestination *dest)
if (card->name == NULL)
return NULL;
+ email = e_destination_get_email (dest);
+
cpy = g_strdup (comp->priv->query_text);
strv = g_strsplit (cpy, " ", 0);
@@ -382,7 +358,7 @@ match_name (ESelectNamesCompletion *comp, EDestination *dest)
} else if (first_match == MATCHED_GIVEN_NAME) {
if (have_family)
- menu_text = g_strdup_printf ("%s %s", card->name->given, card->name->family);
+ menu_text = g_strdup_printf ("%s %s <%s>", card->name->given, card->name->family, email);
else
menu_text = g_strdup_printf (card->name->given);
@@ -390,30 +366,34 @@ match_name (ESelectNamesCompletion *comp, EDestination *dest)
if (have_family) {
- menu_text = g_strdup_printf ("%s, %s%s%s",
+ menu_text = g_strdup_printf ("%s, %s%s%s <%s>",
card->name->family,
have_given ? card->name->given : "",
have_given ? " " : "",
- card->name->additional);
+ card->name->additional,
+ email);
} else {
- menu_text = g_strdup_printf ("%s%s%s",
+ menu_text = g_strdup_printf ("%s%s%s <%s>",
have_given ? card->name->given : "",
have_given ? " " : "",
- card->name->additional);
+ card->name->additional,
+ email);
}
} else if (first_match == MATCHED_FAMILY_NAME) {
if (have_given)
- menu_text = g_strdup_printf ("%s, %s %s",
+ menu_text = g_strdup_printf ("%s, %s%s%s <%s>",
card->name->family,
card->name->given,
- have_additional ? card->name->additional : "");
+ have_additional ? " " : "",
+ have_additional ? card->name->additional : "",
+ email);
else
- menu_text = g_strdup_printf (card->name->family);
+ menu_text = g_strdup_printf ("%s <%s>", card->name->family, email);
}
if (menu_text) {
@@ -536,9 +516,6 @@ book_query_score (ESelectNamesCompletion *comp, EDestination *dest)
}
}
- if (best_match)
- emailify_match (best_match);
-
return best_match;
}
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 99b3d7e9b7..a1af106e76 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,8 @@
+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.
+
2001-08-15 JP Rosevear <jpr@ximian.com>
* gui/dialogs/comp-editor.c (save_comp): only fill the component
diff --git a/calendar/gui/cal-search-bar.c b/calendar/gui/cal-search-bar.c
index b6fde4e6f4..e35ba63181 100644
--- a/calendar/gui/cal-search-bar.c
+++ b/calendar/gui/cal-search-bar.c
@@ -234,25 +234,25 @@ static const char *
get_current_category (CalSearchBar *cal_search)
{
CalSearchBarPrivate *priv;
- int option, suboption;
+ int id, subid;
priv = cal_search->priv;
g_assert (priv->categories != NULL);
- option = e_search_bar_get_option_choice (E_SEARCH_BAR (cal_search));
- if (option != SEARCH_CATEGORY_IS)
+ id = e_search_bar_get_item_id (E_SEARCH_BAR (cal_search));
+ if (id != SEARCH_CATEGORY_IS)
return NULL;
- suboption = e_search_bar_get_suboption_choice (E_SEARCH_BAR (cal_search));
- if (suboption == CATEGORIES_ALL)
+ subid = e_search_bar_get_subitem_id (E_SEARCH_BAR (cal_search));
+ if (subid == CATEGORIES_ALL)
return (const char *) 1;
- else if (suboption == CATEGORIES_UNMATCHED)
+ else if (subid == CATEGORIES_UNMATCHED)
return NULL;
else {
int i;
- i = suboption - CATEGORIES_OFFSET;
+ i = subid - CATEGORIES_OFFSET;
g_assert (i >= 0 && i < priv->categories->len);
return priv->categories->pdata[i];
@@ -317,18 +317,18 @@ static void
regen_query (CalSearchBar *cal_search)
{
CalSearchBarPrivate *priv;
- int item;
+ int id;
const char *category;
priv = cal_search->priv;
/* Fetch the data from the ESearchBar's entry widgets */
- item = e_search_bar_get_option_choice (E_SEARCH_BAR (cal_search));
+ id = e_search_bar_get_item_id (E_SEARCH_BAR (cal_search));
/* Generate the different types of queries */
- switch (item) {
+ switch (id) {
case SEARCH_ANY_FIELD_CONTAINS:
notify_query_contains (cal_search, "any");
break;
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index c5f0b889e9..68e5d3df38 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,12 @@
+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-14 Federico Mena Quintero <federico@ximian.com>
* e-cell-date-edit.c (e_cell_date_edit_destroy): Destroy, do not
diff --git a/widgets/misc/e-filter-bar.c b/widgets/misc/e-filter-bar.c
index 80fcc0b3f7..b2aba149da 100644
--- a/widgets/misc/e-filter-bar.c
+++ b/widgets/misc/e-filter-bar.c
@@ -146,8 +146,8 @@ menubar_activated (ESearchBar *esb, int id, void *data)
case E_FILTERBAR_RESET_ID:
d(printf("Reset menu\n"));
efb->current_query = NULL;
- gtk_object_set (GTK_OBJECT (esb), "option_choice", efb->option_base, NULL);
- gtk_object_set (GTK_OBJECT (esb), "text", NULL, NULL);
+ e_search_bar_set_item_id (esb, efb->option_base);
+ e_search_bar_set_text (esb, NULL);
gtk_widget_set_sensitive (esb->entry, TRUE);
break;
case E_FILTERBAR_EDIT_ID:
@@ -203,7 +203,8 @@ menubar_activated (ESearchBar *esb, int id, void *data)
efb->current_query = (FilterRule *)efb->menu_rules->pdata[id - efb->menu_base];
efb->setquery = TRUE;
- gtk_object_set (GTK_OBJECT (esb), "option_choice", E_FILTERBAR_ADVANCED_ID, NULL);
+
+ e_search_bar_set_item_id (esb, E_FILTERBAR_ADVANCED_ID);
gtk_widget_set_sensitive (esb->entry, FALSE);
} else {
@@ -219,7 +220,7 @@ static void
option_changed (ESearchBar *esb, void *data)
{
EFilterBar *efb = (EFilterBar *)esb;
- int id = esb->option_choice;
+ int id = e_search_bar_get_item_id (esb);
char *query;
d(printf("option changed, id = %d\n", id));
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c
index 5dd7ac1938..f66a42c325 100644
--- a/widgets/misc/e-search-bar.c
+++ b/widgets/misc/e-search-bar.c
@@ -58,8 +58,8 @@ static GtkHBoxClass *parent_class = NULL;
/* The arguments we take */
enum {
ARG_0,
- ARG_OPTION_CHOICE,
- ARG_SUBOPTION_CHOICE,
+ ARG_ITEM_ID,
+ ARG_SUBITEM_ID,
ARG_TEXT,
};
@@ -114,8 +114,8 @@ subitem_activated_cb (GtkWidget *widget, ESearchBar *esb)
id = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), "EsbItemId"));
subid = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), "EsbSubitemId"));
- esb->option_choice = id;
- esb->suboption_choice = subid;
+ esb->item_id = id;
+ esb->subitem_id = subid;
emit_query_changed (esb);
}
@@ -126,7 +126,7 @@ activate_by_subitems (ESearchBar *esb, gint item_id, ESearchBarSubitem *subitems
/* This item uses the entry. */
/* Remove the menu */
- if (esb->suboption && esb->suboption_choice != -1) {
+ if (esb->suboption && esb->subitem_id != -1) {
g_assert (esb->suboption->parent == esb->entry_box);
g_assert (!esb->entry || esb->entry->parent == NULL);
gtk_container_remove (GTK_CONTAINER (esb->entry_box), esb->suboption);
@@ -142,15 +142,15 @@ activate_by_subitems (ESearchBar *esb, gint item_id, ESearchBarSubitem *subitems
gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->entry);
gtk_widget_show(esb->entry);
- esb->suboption_choice = -1;
+ esb->subitem_id = -1;
}
- if (esb->suboption_choice == -1) {
+ if (esb->subitem_id == -1) {
g_assert (esb->entry->parent == esb->entry_box);
g_assert (!esb->suboption || esb->suboption->parent == NULL);
} else {
gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->entry);
- esb->suboption_choice = -1;
+ esb->subitem_id = -1;
}
gtk_entry_set_text (GTK_ENTRY (esb->entry), "");
@@ -161,7 +161,7 @@ activate_by_subitems (ESearchBar *esb, gint item_id, ESearchBarSubitem *subitems
gint i;
/* Remove the entry */
- if (esb->entry && esb->suboption_choice == -1) {
+ if (esb->entry && esb->subitem_id == -1) {
g_assert (esb->entry->parent == esb->entry_box);
g_assert (!esb->suboption || esb->suboption->parent == NULL);
gtk_container_remove (GTK_CONTAINER (esb->entry_box), esb->entry);
@@ -175,15 +175,15 @@ activate_by_subitems (ESearchBar *esb, gint item_id, ESearchBarSubitem *subitems
gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->suboption);
gtk_widget_show (esb->suboption);
- esb->suboption_choice = subitems[0].id;
+ esb->subitem_id = subitems[0].id;
}
- if (esb->suboption_choice != -1) {
+ if (esb->subitem_id != -1) {
g_assert (esb->suboption->parent == esb->entry_box);
g_assert (!esb->entry || esb->entry->parent == NULL);
} else {
gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->suboption);
- esb->suboption_choice = subitems[0].id;
+ esb->subitem_id = subitems[0].id;
}
/* Create the items */
@@ -236,7 +236,7 @@ option_activated_cb (GtkWidget *widget,
activate_by_subitems (esb, id, gtk_object_get_data (GTK_OBJECT (widget), "EsbChoiceSubitems"));
- esb->option_choice = id;
+ esb->item_id = id;
emit_query_changed (esb);
}
@@ -506,12 +506,12 @@ impl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
ESearchBar *esb = E_SEARCH_BAR (object);
switch (arg_id) {
- case ARG_OPTION_CHOICE:
- GTK_VALUE_ENUM (*arg) = e_search_bar_get_option_choice (esb);
+ case ARG_ITEM_ID:
+ GTK_VALUE_ENUM (*arg) = e_search_bar_get_item_id (esb);
break;
- case ARG_SUBOPTION_CHOICE:
- GTK_VALUE_ENUM (*arg) = e_search_bar_get_suboption_choice (esb);
+ case ARG_SUBITEM_ID:
+ GTK_VALUE_ENUM (*arg) = e_search_bar_get_subitem_id (esb);
break;
case ARG_TEXT:
@@ -530,12 +530,12 @@ impl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
ESearchBar *esb = E_SEARCH_BAR(object);
switch (arg_id) {
- case ARG_OPTION_CHOICE:
- e_search_bar_set_option_choice (esb, GTK_VALUE_ENUM (*arg));
+ case ARG_ITEM_ID:
+ e_search_bar_set_item_id (esb, GTK_VALUE_ENUM (*arg));
break;
- case ARG_SUBOPTION_CHOICE:
- e_search_bar_set_suboption_choice (esb, GTK_VALUE_ENUM (*arg));
+ case ARG_SUBITEM_ID:
+ e_search_bar_set_subitem_id (esb, GTK_VALUE_ENUM (*arg));
break;
case ARG_TEXT:
@@ -588,10 +588,10 @@ class_init (ESearchBarClass *klass)
klass->set_menu = set_dropdown;
klass->set_option = set_option;
- gtk_object_add_arg_type ("ESearchBar::option_choice", GTK_TYPE_ENUM,
- GTK_ARG_READWRITE, ARG_OPTION_CHOICE);
- gtk_object_add_arg_type ("ESearchBar::suboption_choice", GTK_TYPE_ENUM,
- GTK_ARG_READWRITE, ARG_SUBOPTION_CHOICE);
+ gtk_object_add_arg_type ("ESearchBar::item_id", GTK_TYPE_ENUM,
+ GTK_ARG_READWRITE, ARG_ITEM_ID);
+ gtk_object_add_arg_type ("ESearchBar::subitem_id", GTK_TYPE_ENUM,
+ GTK_ARG_READWRITE, ARG_SUBITEM_ID);
gtk_object_add_arg_type ("ESearchBar::text", GTK_TYPE_STRING,
GTK_ARG_READWRITE, ARG_TEXT);
@@ -621,8 +621,8 @@ init (ESearchBar *esb)
esb->option = NULL;
esb->entry = NULL;
- esb->option_choice = 0;
- esb->suboption_choice = 0;
+ esb->item_id = 0;
+ esb->subitem_id = 0;
}
@@ -667,7 +667,7 @@ e_search_bar_construct (ESearchBar *search_bar,
* so we can't emit here. Thus we launch a one-shot idle function that will
* emit the changed signal, so that the proper callback will get invoked.
*/
- if (search_bar->suboption_choice >= 0) {
+ if (search_bar->subitem_id >= 0) {
gtk_widget_set_sensitive (search_bar->activate_button, FALSE);
search_bar->pending_change = gtk_idle_add (idle_change_hack, search_bar);
@@ -744,7 +744,7 @@ e_search_bar_set_suboption (ESearchBar *search_bar, int option_id, ESearchBarSub
} else
new_subitems = NULL;
- if (search_bar->option_choice == option_id)
+ if (search_bar->item_id == option_id)
activate_by_subitems (search_bar, option_id, new_subitems);
}
@@ -799,14 +799,14 @@ e_search_bar_get_type (void)
}
/**
- * e_search_bar_set_option_choice:
+ * e_search_bar_set_item_id:
* @search_bar: A search bar.
* @id: Identifier of the item to set.
*
* Sets the active item in the options menu of a search bar.
**/
void
-e_search_bar_set_option_choice (ESearchBar *search_bar, int id)
+e_search_bar_set_item_id (ESearchBar *search_bar, int id)
{
int row;
@@ -816,13 +816,13 @@ e_search_bar_set_option_choice (ESearchBar *search_bar, int id)
row = find_id (search_bar->option_menu, id, "EsbChoiceId", NULL);
g_return_if_fail (row != -1);
- search_bar->option_choice = id;
+ search_bar->item_id = id;
gtk_option_menu_set_history (GTK_OPTION_MENU (search_bar->option), row);
emit_query_changed (search_bar);
}
/**
- * e_search_bar_get_option_choice:
+ * e_search_bar_get_item_id:
* @search_bar: A search bar.
*
* Queries the currently selected item in the options menu of a search bar.
@@ -830,16 +830,16 @@ e_search_bar_set_option_choice (ESearchBar *search_bar, int id)
* Return value: Identifier of the selected item in the options menu.
**/
int
-e_search_bar_get_option_choice (ESearchBar *search_bar)
+e_search_bar_get_item_id (ESearchBar *search_bar)
{
g_return_val_if_fail (search_bar != NULL, -1);
g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), -1);
- return search_bar->option_choice;
+ return search_bar->item_id;
}
void
-e_search_bar_set_suboption_choice (ESearchBar *search_bar, int id)
+e_search_bar_set_subitem_id (ESearchBar *search_bar, int id)
{
int row;
@@ -849,13 +849,13 @@ e_search_bar_set_suboption_choice (ESearchBar *search_bar, int id)
row = find_id (search_bar->suboption_menu, id, "EsbSubitemId", NULL);
g_return_if_fail (row != -1);
- search_bar->suboption_choice = id;
+ search_bar->subitem_id = id;
gtk_option_menu_set_history (GTK_OPTION_MENU (search_bar->suboption), row);
emit_query_changed (search_bar);
}
/**
- * e_search_bar_get_suboption_choice:
+ * e_search_bar_get_subitem_id:
* @search_bar: A search bar.
*
* Queries the currently selected item in the suboptions menu of a search bar.
@@ -865,12 +865,12 @@ e_search_bar_set_suboption_choice (ESearchBar *search_bar, int id)
* a value less than zero is returned.
**/
int
-e_search_bar_get_suboption_choice (ESearchBar *search_bar)
+e_search_bar_get_subitem_id (ESearchBar *search_bar)
{
g_return_val_if_fail (search_bar != NULL, -1);
g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), -1);
- return search_bar->suboption_choice;
+ return search_bar->subitem_id;
}
/**
@@ -906,5 +906,5 @@ e_search_bar_get_text (ESearchBar *search_bar)
g_return_val_if_fail (search_bar != NULL, NULL);
g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), NULL);
- return search_bar->suboption_choice < 0 ? e_utf8_gtk_editable_get_text (GTK_EDITABLE (search_bar->entry)) : NULL;
+ return search_bar->subitem_id < 0 ? e_utf8_gtk_editable_get_text (GTK_EDITABLE (search_bar->entry)) : NULL;
}
diff --git a/widgets/misc/e-search-bar.h b/widgets/misc/e-search-bar.h
index 0694682e02..3842fa8409 100644
--- a/widgets/misc/e-search-bar.h
+++ b/widgets/misc/e-search-bar.h
@@ -34,7 +34,8 @@ extern "C" {
*
* name type read/write description
* ---------------------------------------------------------------------------------
- * option_choice int RW Which option choice is currently selected.
+ * item_id int RW Which option item is currently selected.
+ * subitem_id int RW Which option subitem is currently selected.
* text string RW Text in the entry box.
*/
@@ -79,8 +80,9 @@ struct _ESearchBar
GtkWidget *entry_box;
guint pending_change;
- int option_choice;
- int suboption_choice; /* < 0 if the entry widget is active */
+ /* The currently-selected item & subitem */
+ int item_id;
+ int subitem_id; /* < 0 if the entry widget is active */
};
struct _ESearchBarClass
@@ -111,11 +113,11 @@ GtkWidget *e_search_bar_new (ESearchBarItem *menu_items,
void e_search_bar_set_menu_sensitive(ESearchBar *search_bar, int id, gboolean state);
-void e_search_bar_set_option_choice (ESearchBar *search_bar, int id);
-int e_search_bar_get_option_choice (ESearchBar *search_bar);
+void e_search_bar_set_item_id (ESearchBar *search_bar, int id);
+int e_search_bar_get_item_id (ESearchBar *search_bar);
-void e_search_bar_set_suboption_choice (ESearchBar *search_bar, int id);
-int e_search_bar_get_suboption_choice (ESearchBar *search_bar);
+void e_search_bar_set_subitem_id (ESearchBar *search_bar, int id);
+int e_search_bar_get_subitem_id (ESearchBar *search_bar);
void e_search_bar_set_text (ESearchBar *search_bar, const char *text);
char *e_search_bar_get_text (ESearchBar *search_bar);