diff options
Diffstat (limited to 'libempathy-gtk/empathy-search-bar.c')
-rw-r--r-- | libempathy-gtk/empathy-search-bar.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/libempathy-gtk/empathy-search-bar.c b/libempathy-gtk/empathy-search-bar.c index 87263338c..2526510b2 100644 --- a/libempathy-gtk/empathy-search-bar.c +++ b/libempathy-gtk/empathy-search-bar.c @@ -121,18 +121,34 @@ empathy_search_bar_update_buttons (EmpathySearchBar *self, can_go_forward && !EMP_STR_EMPTY (search)); } -void -empathy_search_bar_show (EmpathySearchBar *self) +static void +empathy_search_bar_update (EmpathySearchBar *self) { gchar *search; gboolean match_case; EmpathySearchBarPriv *priv = GET_PRIV (self); - search = gtk_editable_get_chars (GTK_EDITABLE (priv->search_entry), 0, -1); - match_case = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->search_match_case)); - empathy_chat_view_highlight (priv->chat_view, search, TRUE); + search = gtk_editable_get_chars (GTK_EDITABLE(priv->search_entry), 0, -1); + match_case = gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON (priv->search_match_case)); + + /* highlight & search */ + empathy_chat_view_highlight (priv->chat_view, search, match_case); + + /* update the buttons */ empathy_search_bar_update_buttons (self, search, match_case); + g_free (search); +} + +void +empathy_search_bar_show (EmpathySearchBar *self) +{ + EmpathySearchBarPriv *priv = GET_PRIV (self); + + /* update the highlighting and buttons */ + empathy_search_bar_update (self); + /* grab the focus to the search entry */ gtk_widget_grab_focus (priv->search_entry); @@ -221,7 +237,7 @@ static void empathy_search_bar_match_case_toggled (GtkButton *button, gpointer user_data) { - empathy_search_bar_search (EMPATHY_SEARCH_BAR (user_data), TRUE, FALSE); + empathy_search_bar_update (EMPATHY_SEARCH_BAR (user_data)); } static void |