diff options
author | Thomas Meire <blackskad@gmail.com> | 2010-01-20 00:25:36 +0800 |
---|---|---|
committer | Thomas Meire <blackskad@gmail.com> | 2010-01-21 08:20:08 +0800 |
commit | ba2326210afd63d1ae622c57b76b3b1f56ab4e9e (patch) | |
tree | 0b77cf03eb841925a3238b0be30027d18b212b2f /libempathy-gtk | |
parent | 0f812eb93730b84b7cbb60aaacf803aabdd6f9c5 (diff) | |
download | gsoc2013-empathy-ba2326210afd63d1ae622c57b76b3b1f56ab4e9e.tar gsoc2013-empathy-ba2326210afd63d1ae622c57b76b3b1f56ab4e9e.tar.gz gsoc2013-empathy-ba2326210afd63d1ae622c57b76b3b1f56ab4e9e.tar.bz2 gsoc2013-empathy-ba2326210afd63d1ae622c57b76b3b1f56ab4e9e.tar.lz gsoc2013-empathy-ba2326210afd63d1ae622c57b76b3b1f56ab4e9e.tar.xz gsoc2013-empathy-ba2326210afd63d1ae622c57b76b3b1f56ab4e9e.tar.zst gsoc2013-empathy-ba2326210afd63d1ae622c57b76b3b1f56ab4e9e.zip |
add match_case option to find_abilities
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-chat-text-view.c | 49 | ||||
-rw-r--r-- | libempathy-gtk/empathy-chat-view.c | 2 | ||||
-rw-r--r-- | libempathy-gtk/empathy-chat-view.h | 2 | ||||
-rw-r--r-- | libempathy-gtk/empathy-log-window.c | 3 | ||||
-rw-r--r-- | libempathy-gtk/empathy-search-bar.c | 11 | ||||
-rw-r--r-- | libempathy-gtk/empathy-theme-adium.c | 1 |
6 files changed, 49 insertions, 19 deletions
diff --git a/libempathy-gtk/empathy-chat-text-view.c b/libempathy-gtk/empathy-chat-text-view.c index ea8b1937e..07f8f6cb9 100644 --- a/libempathy-gtk/empathy-chat-text-view.c +++ b/libempathy-gtk/empathy-chat-text-view.c @@ -1096,6 +1096,7 @@ chat_text_view_find_next (EmpathyChatView *view, static void chat_text_view_find_abilities (EmpathyChatView *view, const gchar *search_criteria, + gboolean match_case, gboolean *can_do_previous, gboolean *can_do_next) { @@ -1122,11 +1123,20 @@ chat_text_view_find_abilities (EmpathyChatView *view, gtk_text_buffer_get_start_iter (buffer, &iter_at_mark); } - *can_do_previous = empathy_text_iter_backward_search (&iter_at_mark, - search_criteria, - &iter_match_start, - &iter_match_end, - NULL); + if (match_case) { + *can_do_previous = gtk_text_iter_backward_search (&iter_at_mark, + search_criteria, + 0, + &iter_match_start, + &iter_match_end, + NULL); + } else { + *can_do_previous = empathy_text_iter_backward_search (&iter_at_mark, + search_criteria, + &iter_match_start, + &iter_match_end, + NULL); + } } if (can_do_next) { @@ -1138,11 +1148,20 @@ chat_text_view_find_abilities (EmpathyChatView *view, gtk_text_buffer_get_start_iter (buffer, &iter_at_mark); } - *can_do_next = empathy_text_iter_forward_search (&iter_at_mark, - search_criteria, - &iter_match_start, - &iter_match_end, - NULL); + if (match_case) { + *can_do_next = gtk_text_iter_forward_search (&iter_at_mark, + search_criteria, + 0, + &iter_match_start, + &iter_match_end, + NULL); + } else { + *can_do_next = empathy_text_iter_forward_search (&iter_at_mark, + search_criteria, + &iter_match_start, + &iter_match_end, + NULL); + } } } @@ -1177,11 +1196,11 @@ chat_text_view_highlight (EmpathyChatView *view, while (1) { if (match_case) { found = gtk_text_iter_forward_search (&iter, - text, - 0, - &iter_match_start, - &iter_match_end, - NULL); + text, + 0, + &iter_match_start, + &iter_match_end, + NULL); } else { found = empathy_text_iter_forward_search (&iter, text, diff --git a/libempathy-gtk/empathy-chat-view.c b/libempathy-gtk/empathy-chat-view.c index e68839635..ada669885 100644 --- a/libempathy-gtk/empathy-chat-view.c +++ b/libempathy-gtk/empathy-chat-view.c @@ -164,6 +164,7 @@ empathy_chat_view_find_next (EmpathyChatView *view, void empathy_chat_view_find_abilities (EmpathyChatView *view, const gchar *search_criteria, + gboolean match_case, gboolean *can_do_previous, gboolean *can_do_next) { @@ -172,6 +173,7 @@ empathy_chat_view_find_abilities (EmpathyChatView *view, if (EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_abilities) { EMPATHY_TYPE_CHAT_VIEW_GET_IFACE (view)->find_abilities (view, search_criteria, + match_case, can_do_previous, can_do_next); } diff --git a/libempathy-gtk/empathy-chat-view.h b/libempathy-gtk/empathy-chat-view.h index 11010c45b..96365a618 100644 --- a/libempathy-gtk/empathy-chat-view.h +++ b/libempathy-gtk/empathy-chat-view.h @@ -61,6 +61,7 @@ struct _EmpathyChatViewIface { gboolean match_case); void (*find_abilities) (EmpathyChatView *view, const gchar *search_criteria, + gboolean match_case, gboolean *can_do_previous, gboolean *can_do_next); void (*highlight) (EmpathyChatView *view, @@ -89,6 +90,7 @@ gboolean empathy_chat_view_find_next (EmpathyChatView *view, gboolean match_case); void empathy_chat_view_find_abilities (EmpathyChatView *view, const gchar *search_criteria, + gboolean match_case, gboolean *can_do_previous, gboolean *can_do_next); void empathy_chat_view_highlight (EmpathyChatView *view, diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index dba887780..f12abf374 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -414,6 +414,7 @@ log_window_find_changed_cb (GtkTreeSelection *selection, FALSE); empathy_chat_view_find_abilities (window->chatview_find, window->last_find, + FALSE, &can_do_previous, &can_do_next); gtk_widget_set_sensitive (window->button_previous, can_do_previous); @@ -610,6 +611,7 @@ log_window_button_next_clicked_cb (GtkWidget *widget, FALSE); empathy_chat_view_find_abilities (window->chatview_find, window->last_find, + FALSE, &can_do_previous, &can_do_next); gtk_widget_set_sensitive (window->button_previous, can_do_previous); @@ -631,6 +633,7 @@ log_window_button_previous_clicked_cb (GtkWidget *widget, FALSE); empathy_chat_view_find_abilities (window->chatview_find, window->last_find, + FALSE, &can_do_previous, &can_do_next); gtk_widget_set_sensitive (window->button_previous, can_do_previous); diff --git a/libempathy-gtk/empathy-search-bar.c b/libempathy-gtk/empathy-search-bar.c index dfd680ca5..87263338c 100644 --- a/libempathy-gtk/empathy-search-bar.c +++ b/libempathy-gtk/empathy-search-bar.c @@ -103,7 +103,8 @@ empathy_search_bar_size_allocate (GtkWidget *widget, static void empathy_search_bar_update_buttons (EmpathySearchBar *self, - gchar *search) + gchar *search, + gboolean match_case) { gboolean can_go_forward = FALSE; gboolean can_go_backward = FALSE; @@ -111,7 +112,7 @@ empathy_search_bar_update_buttons (EmpathySearchBar *self, EmpathySearchBarPriv* priv = GET_PRIV (self); /* update previous / next buttons */ - empathy_chat_view_find_abilities (priv->chat_view, search, + empathy_chat_view_find_abilities (priv->chat_view, search, match_case, &can_go_backward, &can_go_forward); gtk_widget_set_sensitive (priv->search_previous, @@ -124,11 +125,13 @@ void empathy_search_bar_show (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); - empathy_search_bar_update_buttons (self, search); + empathy_search_bar_update_buttons (self, search, match_case); /* grab the focus to the search entry */ gtk_widget_grab_focus (priv->search_entry); @@ -188,7 +191,7 @@ empathy_search_bar_search (EmpathySearchBar *self, !(found || EMP_STR_EMPTY (search))); /* update the buttons */ - empathy_search_bar_update_buttons (self, search); + empathy_search_bar_update_buttons (self, search, match_case); g_free (search); } diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index f57fe9531..62734ff93 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -730,6 +730,7 @@ theme_adium_find_next (EmpathyChatView *view, static void theme_adium_find_abilities (EmpathyChatView *view, const gchar *search_criteria, + gboolean match_case, gboolean *can_do_previous, gboolean *can_do_next) { |