Mercurial > pidgin
changeset 11450:b7978afe81d0
[gaim-migrate @ 13689]
Fixed the filter button being sensitive on debug window creation when the expresion is an empty string.
Added the ability to hit enter/return in the expression entry to turn on the filter, if the expression is valid.
committer: Tailor Script <tailor@pidgin.im>
author | Gary Kramlich <grim@reaperworld.com> |
---|---|
date | Mon, 05 Sep 2005 08:14:10 +0000 |
parents | 048f82127b4d |
children | 99548d90257e |
files | src/gtkdebug.c |
diffstat | 1 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkdebug.c Mon Sep 05 06:48:39 2005 +0000 +++ b/src/gtkdebug.c Mon Sep 05 08:14:10 2005 +0000 @@ -560,6 +560,20 @@ } static void +regex_key_release_cb(GtkWidget *w, GdkEventKey *e, DebugWindow *win) { + /** + * GDK_Return is defined in gdkkeysyms.h as 0xFF0D, but this file is not + * included by default, so we just use that value here directly. + */ + if(e->keyval == 0xFF0D && + GTK_WIDGET_IS_SENSITIVE(win->filter) && + !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) + { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), TRUE); + } +} + +static void regex_menu_cb(GtkWidget *item, const gchar *pref) { gboolean active; @@ -713,6 +727,12 @@ NULL, NULL, G_CALLBACK(regex_filter_toggled_cb), win); + /* we purposely disable the toggle button here in case + * /gaim/gtk/debug/expression has an empty string. If it does not have + * an empty string, the change signal will get called and make the + * toggle button sensitive. + */ + gtk_widget_set_sensitive(win->filter, FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), gaim_prefs_get_bool("/gaim/gtk/debug/filter")); gaim_prefs_connect_callback(handle, "/gaim/gtk/debug/filter", @@ -733,6 +753,8 @@ gaim_prefs_get_string("/gaim/gtk/debug/regex")); g_signal_connect(G_OBJECT(win->expression), "populate-popup", G_CALLBACK(regex_popup_cb), win); + g_signal_connect(G_OBJECT(win->expression), "key-release-event", + G_CALLBACK(regex_key_release_cb), win); gaim_prefs_connect_callback(handle, "/gaim/gtk/debug/regex", regex_pref_expression_cb, win);