From 2d25c8605b4e6a2cb832955de7f6e12080a658e0 Mon Sep 17 00:00:00 2001 From: Vitaly Minko Date: Mon, 18 Oct 2010 15:32:37 +0400 Subject: Add an entry in the View menu to search for contacts (#632024). --- libempathy-gtk/empathy-individual-view.c | 19 +++++++++++++++---- libempathy-gtk/empathy-individual-view.h | 2 ++ src/empathy-main-window.c | 10 ++++++++++ src/empathy-main-window.ui | 7 +++++++ 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c index ebc71a10a..b75e2a1e6 100644 --- a/libempathy-gtk/empathy-individual-view.c +++ b/libempathy-gtk/empathy-individual-view.c @@ -1223,10 +1223,7 @@ individual_view_start_search_cb (EmpathyIndividualView *view, if (priv->search_widget == NULL) return FALSE; - if (gtk_widget_get_visible (GTK_WIDGET (priv->search_widget))) - gtk_widget_grab_focus (GTK_WIDGET (priv->search_widget)); - else - gtk_widget_show (GTK_WIDGET (priv->search_widget)); + empathy_individual_view_start_search (view); return TRUE; } @@ -2579,3 +2576,17 @@ empathy_individual_view_set_store (EmpathyIndividualView *self, G_CALLBACK (individual_view_store_row_deleted_cb), self, 0); } } + +void +empathy_individual_view_start_search (EmpathyIndividualView *self) +{ + EmpathyIndividualViewPriv *priv = GET_PRIV (self); + + g_return_if_fail (EMPATHY_IS_INDIVIDUAL_VIEW (self)); + g_return_if_fail (priv->search_widget != NULL); + + if (gtk_widget_get_visible (GTK_WIDGET (priv->search_widget))) + gtk_widget_grab_focus (GTK_WIDGET (priv->search_widget)); + else + gtk_widget_show (GTK_WIDGET (priv->search_widget)); +} diff --git a/libempathy-gtk/empathy-individual-view.h b/libempathy-gtk/empathy-individual-view.h index 51a487d94..79f279f94 100644 --- a/libempathy-gtk/empathy-individual-view.h +++ b/libempathy-gtk/empathy-individual-view.h @@ -133,5 +133,7 @@ EmpathyIndividualStore *empathy_individual_view_get_store ( void empathy_individual_view_set_store (EmpathyIndividualView *self, EmpathyIndividualStore *store); +void empathy_individual_view_start_search (EmpathyIndividualView *self); + G_END_DECLS #endif /* __EMPATHY_INDIVIDUAL_VIEW_H__ */ diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index 85a64a365..a62c9cd41 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -953,6 +953,15 @@ main_window_notify_contact_list_size_cb (GSettings *gsettings, gtk_radio_action_set_current_value (priv->normal_with_avatars, value); } +static void +main_window_view_search_contacts_cb (GtkCheckMenuItem *item, + EmpathyMainWindow *window) +{ + EmpathyMainWindowPriv *priv = GET_PRIV (window); + + empathy_individual_view_start_search (priv->individual_view); +} + static void main_window_view_show_map_cb (GtkCheckMenuItem *item, EmpathyMainWindow *window) @@ -1601,6 +1610,7 @@ empathy_main_window_init (EmpathyMainWindow *window) "view_show_protocols", "toggled", main_window_view_show_protocols_cb, "view_sort_by_name", "changed", main_window_view_sort_contacts_cb, "view_normal_size_with_avatars", "changed", main_window_view_contacts_list_size_cb, + "view_search_contacts", "activate", main_window_view_search_contacts_cb, "view_show_map", "activate", main_window_view_show_map_cb, "edit", "activate", main_window_edit_cb, "edit_accounts", "activate", main_window_edit_accounts_cb, diff --git a/src/empathy-main-window.ui b/src/empathy-main-window.ui index 1d06b3edd..a328eacfe 100644 --- a/src/empathy-main-window.ui +++ b/src/empathy-main-window.ui @@ -165,6 +165,12 @@ + + + view_search_contacts + Find in Contact _List + + room @@ -248,6 +254,7 @@ + -- cgit v1.2.3