[empathy] improve behaviour of match_case callback



commit 6e4d8ededbb01dfd7bf5bbbb31fc05d6d6ca161a
Author: Thomas Meire <blackskad gmail com>
Date:   Tue Jan 19 18:39:52 2010 +0100

    improve behaviour of match_case callback

 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 8726333..2526510 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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]