diff options
author | Chris Toshok <toshok@ximian.com> | 2002-02-25 18:56:33 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2002-02-25 18:56:33 +0800 |
commit | 26411433698a528c1b94851a7dcf8a950b4d24f0 (patch) | |
tree | 3a970d4d5aca50d8e869b490790eeea3797bd76d /widgets | |
parent | d1401d65e1f3bfdf0bbe70b52b8164793cc9fbc2 (diff) | |
download | gsoc2013-evolution-26411433698a528c1b94851a7dcf8a950b4d24f0.tar.gz gsoc2013-evolution-26411433698a528c1b94851a7dcf8a950b4d24f0.tar.zst gsoc2013-evolution-26411433698a528c1b94851a7dcf8a950b4d24f0.zip |
preserve behavior - hook search_activated signal to the same function as
2002-02-24 Chris Toshok <toshok@ximian.com>
* e-filter-bar.c (init): preserve behavior - hook search_activated
signal to the same function as query_changed.
* e-search-bar.c (emit_search_activated): new function.
(entry_activated_cb): use emit_search_activated instead of
emit_query_changed.
(subitem_activated_cb): same.
(activate_button_clicked_cb): same.
(class_init): add the search_activated signal.
(idle_activate_hack): rename idle_change_hack to this, and
emit_search_activated.
(e_search_bar_construct): idle_change_hack -> idle_activate_hack.
(e_search_bar_set_subitem_id): emit_search_activated instead of
emit_query_changed.
(e_search_bar_set_text): same.
* e-search-bar.h (struct _ESearchBarClass): add a search_activated
signal.
svn path=/trunk/; revision=15827
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/misc/ChangeLog | 21 | ||||
-rw-r--r-- | widgets/misc/e-filter-bar.c | 1 | ||||
-rw-r--r-- | widgets/misc/e-search-bar.c | 52 | ||||
-rw-r--r-- | widgets/misc/e-search-bar.h | 12 |
4 files changed, 63 insertions, 23 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index e7dd1bffe4..670f34c6aa 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,24 @@ +2002-02-24 Chris Toshok <toshok@ximian.com> + + * e-filter-bar.c (init): preserve behavior - hook search_activated + signal to the same function as query_changed. + + * e-search-bar.c (emit_search_activated): new function. + (entry_activated_cb): use emit_search_activated instead of + emit_query_changed. + (subitem_activated_cb): same. + (activate_button_clicked_cb): same. + (class_init): add the search_activated signal. + (idle_activate_hack): rename idle_change_hack to this, and + emit_search_activated. + (e_search_bar_construct): idle_change_hack -> idle_activate_hack. + (e_search_bar_set_subitem_id): emit_search_activated instead of + emit_query_changed. + (e_search_bar_set_text): same. + + * e-search-bar.h (struct _ESearchBarClass): add a search_activated + signal. + 2002-02-21 Ettore Perazzoli <ettore@ximian.com> * e-combo-button.c (set_icon): gtk_widget_show() the icon_pixmap diff --git a/widgets/misc/e-filter-bar.c b/widgets/misc/e-filter-bar.c index fa0c756df5..9ff4c55aa0 100644 --- a/widgets/misc/e-filter-bar.c +++ b/widgets/misc/e-filter-bar.c @@ -587,6 +587,7 @@ init (EFilterBar *efb) { gtk_signal_connect (GTK_OBJECT (efb), "menu_activated", menubar_activated, NULL); gtk_signal_connect (GTK_OBJECT (efb), "query_changed", option_changed, NULL); + gtk_signal_connect (GTK_OBJECT (efb), "search_activated", option_changed, NULL); efb->menu_rules = g_ptr_array_new (); efb->option_rules = g_ptr_array_new (); diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c index 3524dc7b0f..c07c98fad2 100644 --- a/widgets/misc/e-search-bar.c +++ b/widgets/misc/e-search-bar.c @@ -46,6 +46,7 @@ enum { QUERY_CHANGED, MENU_ACTIVATED, + SEARCH_ACTIVATED, LAST_SIGNAL }; @@ -68,13 +69,20 @@ enum { static void emit_query_changed (ESearchBar *esb) { - if (esb->pending_change) { - gtk_idle_remove (esb->pending_change); - esb->pending_change = 0; + gtk_signal_emit (GTK_OBJECT (esb), + esb_signals [QUERY_CHANGED]); +} + +static void +emit_search_activated (ESearchBar *esb) +{ + if (esb->pending_activate) { + gtk_idle_remove (esb->pending_activate); + esb->pending_activate = 0; } gtk_signal_emit (GTK_OBJECT (esb), - esb_signals [QUERY_CHANGED]); + esb_signals [SEARCH_ACTIVATED]); } static void @@ -102,7 +110,7 @@ static void entry_activated_cb (GtkWidget *widget, ESearchBar *esb) { - emit_query_changed (esb); + emit_search_activated (esb); } static void @@ -115,7 +123,7 @@ subitem_activated_cb (GtkWidget *widget, ESearchBar *esb) esb->item_id = id; esb->subitem_id = subid; - emit_query_changed (esb); + emit_search_activated (esb); } static void @@ -243,7 +251,7 @@ option_activated_cb (GtkWidget *widget, static void activate_button_clicked_cb (GtkWidget *widget, ESearchBar *esb) { - emit_query_changed (esb); + emit_search_activated (esb); } @@ -564,9 +572,9 @@ impl_destroy (GtkObject *object) if (esb->suboption) gtk_object_unref (GTK_OBJECT (esb->suboption)); - if (esb->pending_change) { - gtk_idle_remove (esb->pending_change); - esb->pending_change = 0; + if (esb->pending_activate) { + gtk_idle_remove (esb->pending_activate); + esb->pending_activate = 0; } if (GTK_OBJECT_CLASS (parent_class)->destroy) @@ -612,6 +620,14 @@ class_init (ESearchBarClass *klass) GTK_SIGNAL_OFFSET (ESearchBarClass, menu_activated), gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_INT); + + esb_signals [SEARCH_ACTIVATED] = + gtk_signal_new ("search_activated", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (ESearchBarClass, search_activated), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); gtk_object_class_add_signals (object_class, esb_signals, LAST_SIGNAL); } @@ -631,11 +647,11 @@ init (ESearchBar *esb) /* Object construction. */ static gint -idle_change_hack (gpointer ptr) +idle_activate_hack (gpointer ptr) { ESearchBar *esb = E_SEARCH_BAR (ptr); - esb->pending_change = 0; - emit_query_changed (esb); + esb->pending_activate = 0; + emit_search_activated (esb); return FALSE; } @@ -665,14 +681,14 @@ e_search_bar_construct (ESearchBar *search_bar, /* * If the default choice for the option menu has subitems, then we need to * activate the search immediately. However, the developer won't have - * connected to the changed signal until after the object is constructed, + * connected to the activated signal until after the object is constructed, * 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->subitem_id >= 0) { gtk_widget_set_sensitive (search_bar->activate_button, FALSE); - search_bar->pending_change = gtk_idle_add (idle_change_hack, search_bar); + search_bar->pending_activate = gtk_idle_add (idle_activate_hack, search_bar); } } @@ -853,7 +869,7 @@ e_search_bar_set_subitem_id (ESearchBar *search_bar, int id) search_bar->subitem_id = id; gtk_option_menu_set_history (GTK_OPTION_MENU (search_bar->suboption), row); - emit_query_changed (search_bar); + emit_search_activated (search_bar); } /** @@ -912,7 +928,7 @@ e_search_bar_set_ids (ESearchBar *search_bar, int item_id, int subitem_id) * e_search_bar_set_text: * @search_bar: A search bar. * @text: Text to set in the search bar's entry line. - * + * * Sets the text string inside the entry line of a search bar. **/ void @@ -922,7 +938,7 @@ e_search_bar_set_text (ESearchBar *search_bar, const char *text) g_return_if_fail (E_IS_SEARCH_BAR (search_bar)); e_utf8_gtk_editable_set_text (GTK_EDITABLE (search_bar->entry), text); - emit_query_changed (search_bar); + emit_search_activated (search_bar); } /** diff --git a/widgets/misc/e-search-bar.h b/widgets/misc/e-search-bar.h index 88782cb27b..0787a332da 100644 --- a/widgets/misc/e-search-bar.h +++ b/widgets/misc/e-search-bar.h @@ -77,7 +77,7 @@ struct _ESearchBar GtkWidget *dropdown_menu; GtkWidget *activate_button; GtkWidget *entry_box; - guint pending_change; + guint pending_activate; /* The currently-selected item & subitem */ int item_id; @@ -88,11 +88,13 @@ struct _ESearchBarClass { GtkHBoxClass parent_class; - void (*set_menu) (ESearchBar *, ESearchBarItem *); - void (*set_option) (ESearchBar *, ESearchBarItem *); + void (*set_menu) (ESearchBar *, ESearchBarItem *); + void (*set_option) (ESearchBar *, ESearchBarItem *); - void (*query_changed) (ESearchBar *search); - void (*menu_activated) (ESearchBar *search, int item); + /* signals */ + void (*search_activated) (ESearchBar *search); + void (*query_changed) (ESearchBar *search); + void (*menu_activated) (ESearchBar *search, int item); }; |