[empathy] Use gtk_text_iter_[backward/forward]_search for case sensitive searches, keep the custom version for



commit a60052ef99b114614a598bc6fd623ae4bd6b4d52
Author: Thomas Meire <blackskad gmail com>
Date:   Tue Jan 19 15:26:56 2010 +0100

    Use gtk_text_iter_[backward/forward]_search for case sensitive searches, keep
    the custom version for case insensitive searches

 libempathy-gtk/empathy-chat-text-view.c |   46 +++++++++++++++++++++++--------
 1 files changed, 34 insertions(+), 12 deletions(-)
---
diff --git a/libempathy-gtk/empathy-chat-text-view.c b/libempathy-gtk/empathy-chat-text-view.c
index 14c78ce..8d00bf5 100644
--- a/libempathy-gtk/empathy-chat-text-view.c
+++ b/libempathy-gtk/empathy-chat-text-view.c
@@ -892,12 +892,23 @@ chat_text_view_find_previous (EmpathyChatView *view,
 
 	priv->find_last_direction = FALSE;
 
-	/* FIXME: doesn't respect match_case */
-	found = empathy_text_iter_backward_search (&iter_at_mark,
-						   search_criteria,
-						   &iter_match_start,
-						   &iter_match_end,
-						   NULL);
+	/* Use the standard GTK+ method for case sensitive searches. It can't do
+	 * case insensitive searches (see bug #61852), so keep the custom method
+	 * around for case insensitive searches. */
+	if (match_case) {
+		found = gtk_text_iter_backward_search (&iter_at_mark,
+		                                       search_criteria,
+		                                       0, /* no text search flags, we want exact matches */
+		                                       &iter_match_start,
+		                                       &iter_match_end,
+		                                       NULL);
+	} else {
+		found = empathy_text_iter_backward_search (&iter_at_mark,
+		                                           search_criteria,
+		                                           &iter_match_start,
+		                                           &iter_match_end,
+		                                           NULL);
+	}
 
 	if (!found) {
 		gboolean result = FALSE;
@@ -1010,12 +1021,23 @@ chat_text_view_find_next (EmpathyChatView *view,
 
 	priv->find_last_direction = TRUE;
 
-	/* FIXME: doesn't respect match_case */
-	found = empathy_text_iter_forward_search (&iter_at_mark,
-						  search_criteria,
-						  &iter_match_start,
-						  &iter_match_end,
-						  NULL);
+	/* Use the standard GTK+ method for case sensitive searches. It can't do
+	 * case insensitive searches (see bug #61852), so keep the custom method
+	 * around for case insensitive searches. */
+	if (match_case) {
+		found = gtk_text_iter_forward_search (&iter_at_mark,
+		                                      search_criteria,
+		                                      0,
+		                                      &iter_match_start,
+		                                      &iter_match_end,
+		                                      NULL);
+	} else {
+		found = empathy_text_iter_forward_search (&iter_at_mark,
+		                                          search_criteria,
+		                                          &iter_match_start,
+		                                          &iter_match_end,
+		                                          NULL);
+	}
 
 	if (!found) {
 		gboolean result = FALSE;



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