aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/ChangeLog9
-rw-r--r--widgets/misc/e-search-bar.c38
-rw-r--r--widgets/misc/e-search-bar.h3
3 files changed, 48 insertions, 2 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 964e63240f..e17091a210 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,12 @@
+2001-04-15 Federico Mena Quintero <federico@ximian.com>
+
+ * e-search-bar.c (e_search_bar_get_option_choice): New function,
+ because it is ridiculous to have to hunt down object arguments to
+ fetch values.
+ (e_search_bar_get_text): Likewise.
+ (impl_get_arg): Use the functions above so that we have to
+ maintain only one version of the getters.
+
2001-04-04 Kjartan Maraas <kmaraas@gnome.org>
* e-calendar.c: More header fixes.
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c
index 57fd114f8a..3be08f4063 100644
--- a/widgets/misc/e-search-bar.c
+++ b/widgets/misc/e-search-bar.c
@@ -274,11 +274,11 @@ impl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
switch (arg_id) {
case ARG_OPTION_CHOICE:
- GTK_VALUE_ENUM (*arg) = esb->option_choice;
+ GTK_VALUE_ENUM (*arg) = e_search_bar_get_option_choice (esb);
break;
case ARG_TEXT:
- GTK_VALUE_STRING (*arg) = e_utf8_gtk_editable_get_text(GTK_EDITABLE(esb->entry));
+ GTK_VALUE_STRING (*arg) = e_search_bar_get_text (esb);
break;
default:
@@ -475,3 +475,37 @@ e_search_bar_get_type (void)
return type;
}
+/**
+ * e_search_bar_get_option_choice:
+ * @search_bar: A search bar.
+ *
+ * Queries the currently selected item in the options menu of a search bar.
+ *
+ * Return value: Identifier of the selected item in the options menu.
+ **/
+int
+e_search_bar_get_option_choice (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;
+}
+
+/**
+ * e_search_bar_get_text:
+ * @search_bar: A search bar.
+ *
+ * Queries the text of the entry line in a search bar.
+ *
+ * Return value: The text string that is in the entry line of the search bar.
+ * This must be freed using g_free().
+ **/
+char *
+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 e_utf8_gtk_editable_get_text (GTK_EDITABLE (search_bar->entry));
+}
diff --git a/widgets/misc/e-search-bar.h b/widgets/misc/e-search-bar.h
index 254bdc09e7..8b262a0f4f 100644
--- a/widgets/misc/e-search-bar.h
+++ b/widgets/misc/e-search-bar.h
@@ -94,6 +94,9 @@ GtkWidget *e_search_bar_new (ESearchBarItem *menu_items,
void e_search_bar_set_menu_sensitive(ESearchBar *search_bar, int id, gboolean state);
+int e_search_bar_get_option_choice (ESearchBar *search_bar);
+char *e_search_bar_get_text (ESearchBar *search_bar);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */