commit f4711fa5d39fe11f158e11d6499a352d824715df Author: Vitaly Minko Date: Thu Apr 7 07:29:23 2011 +0000 Base the search bar on GtkToolbar instead of GtkHBox in order not to resize the chat window when we activate it (#614319). diff --git a/libempathy-gtk/empathy-search-bar.c b/libempathy-gtk/empathy-search-bar.c index 51a7909..fe5f167 100644 --- a/libempathy-gtk/empathy-search-bar.c +++ b/libempathy-gtk/empathy-search-bar.c @@ -17,8 +17,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.h" + #include #include +#include #include #include @@ -41,6 +44,8 @@ struct _EmpathySearchBarPriv GtkWidget *search_match_case; + GtkWidget *search_match_case_toolitem; + GtkWidget *search_close; GtkWidget *search_previous; GtkWidget *search_next; @@ -254,6 +259,42 @@ empathy_search_bar_match_case_toggled (GtkButton *button, } static void +empathy_search_bar_match_case_menu_toggled (GtkWidget *check, + gpointer user_data) +{ + EmpathySearchBarPriv* priv = GET_PRIV ( EMPATHY_SEARCH_BAR (user_data)); + gboolean match_case; + + match_case = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (check)); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->search_match_case), + match_case); +} + +static gboolean +empathy_searchbar_create_menu_proxy_cb (GtkToolItem *toolitem, + gpointer user_data) +{ + EmpathySearchBarPriv* priv = GET_PRIV ( EMPATHY_SEARCH_BAR (user_data)); + GtkWidget *checkbox_menu; + gboolean match_case; + + checkbox_menu = gtk_check_menu_item_new_with_mnemonic (_("_Match case")); + match_case = gtk_toggle_button_get_active ( + GTK_TOGGLE_BUTTON (priv->search_match_case)); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (checkbox_menu), + match_case); + + g_signal_connect (checkbox_menu, "toggled", + G_CALLBACK (empathy_search_bar_match_case_menu_toggled), user_data); + + gtk_tool_item_set_proxy_menu_item (toolitem, "menu-proxy", + checkbox_menu); + + return TRUE; +} + +static void empathy_search_bar_init (EmpathySearchBar * self) { gchar *filename; @@ -285,6 +326,7 @@ empathy_search_bar_init (EmpathySearchBar * self) "search_previous", "clicked", empathy_search_bar_previous_cb, "search_next", "clicked", empathy_search_bar_next_cb, "search_match_case", "toggled", empathy_search_bar_match_case_toggled, + "search_match_case_toolitem", "create-menu-proxy", empathy_searchbar_create_menu_proxy_cb, NULL); g_signal_connect (G_OBJECT (self), "key-press-event", diff --git a/libempathy-gtk/empathy-search-bar.ui b/libempathy-gtk/empathy-search-bar.ui index b07bda3..7d42594 100644 --- a/libempathy-gtk/empathy-search-bar.ui +++ b/libempathy-gtk/empathy-search-bar.ui @@ -2,120 +2,122 @@ - + True - 6 + 2 + GTK_TOOLBAR_BOTH_HORIZ - + True - True + True True - image1 + gtk-close False - False - 0 + True - + True - Find: - - - False - False - 1 - - - - - True - True + + + True + + + True + 6 + + + True + Find: + + + + + True + True + + + + + + - - False - 2 - - + Find Previous True - True - True - image3 + True + gtk-go-back-ltr - False - 3 + True - + Find Next True - True - True - image4 + True + gtk-go-forward-ltr - False - 4 + True - - Match case + True - True - False - True + True + + + Match case + True + True + True + + - 6 + True - - 6 - - - True - gtk-dialog-error - - - 0 - - + + True - + True - Phrase not found + 6 + + + 6 + + + True + gtk-dialog-error + + + 0 + + + + + True + Phrase not found + + + 1 + + + + - - 1 - - - False - end - 5 - - - True - gtk-close - - - True - gtk-go-back - - - True - gtk-go-forward -