comparison src/gtkdebug.c @ 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 a546498f7adc
children 171c34a04a9f
comparison
equal deleted inserted replaced
11449:048f82127b4d 11450:b7978afe81d0
558 558
559 regex_compile(win); 559 regex_compile(win);
560 } 560 }
561 561
562 static void 562 static void
563 regex_key_release_cb(GtkWidget *w, GdkEventKey *e, DebugWindow *win) {
564 /**
565 * GDK_Return is defined in gdkkeysyms.h as 0xFF0D, but this file is not
566 * included by default, so we just use that value here directly.
567 */
568 if(e->keyval == 0xFF0D &&
569 GTK_WIDGET_IS_SENSITIVE(win->filter) &&
570 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter)))
571 {
572 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), TRUE);
573 }
574 }
575
576 static void
563 regex_menu_cb(GtkWidget *item, const gchar *pref) { 577 regex_menu_cb(GtkWidget *item, const gchar *pref) {
564 gboolean active; 578 gboolean active;
565 579
566 active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)); 580 active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item));
567 581
711 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, 725 GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
712 NULL, _("Filter"), _("Filter"), 726 NULL, _("Filter"), _("Filter"),
713 NULL, NULL, 727 NULL, NULL,
714 G_CALLBACK(regex_filter_toggled_cb), 728 G_CALLBACK(regex_filter_toggled_cb),
715 win); 729 win);
730 /* we purposely disable the toggle button here in case
731 * /gaim/gtk/debug/expression has an empty string. If it does not have
732 * an empty string, the change signal will get called and make the
733 * toggle button sensitive.
734 */
735 gtk_widget_set_sensitive(win->filter, FALSE);
716 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), 736 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter),
717 gaim_prefs_get_bool("/gaim/gtk/debug/filter")); 737 gaim_prefs_get_bool("/gaim/gtk/debug/filter"));
718 gaim_prefs_connect_callback(handle, "/gaim/gtk/debug/filter", 738 gaim_prefs_connect_callback(handle, "/gaim/gtk/debug/filter",
719 regex_pref_filter_cb, win); 739 regex_pref_filter_cb, win);
720 740
731 G_CALLBACK(regex_changed_cb), win); 751 G_CALLBACK(regex_changed_cb), win);
732 gtk_entry_set_text(GTK_ENTRY(win->expression), 752 gtk_entry_set_text(GTK_ENTRY(win->expression),
733 gaim_prefs_get_string("/gaim/gtk/debug/regex")); 753 gaim_prefs_get_string("/gaim/gtk/debug/regex"));
734 g_signal_connect(G_OBJECT(win->expression), "populate-popup", 754 g_signal_connect(G_OBJECT(win->expression), "populate-popup",
735 G_CALLBACK(regex_popup_cb), win); 755 G_CALLBACK(regex_popup_cb), win);
756 g_signal_connect(G_OBJECT(win->expression), "key-release-event",
757 G_CALLBACK(regex_key_release_cb), win);
736 gaim_prefs_connect_callback(handle, "/gaim/gtk/debug/regex", 758 gaim_prefs_connect_callback(handle, "/gaim/gtk/debug/regex",
737 regex_pref_expression_cb, win); 759 regex_pref_expression_cb, win);
738 760
739 /* connect the rest of our pref callbacks */ 761 /* connect the rest of our pref callbacks */
740 win->invert = gaim_prefs_get_bool("/gaim/gtk/debug/invert"); 762 win->invert = gaim_prefs_get_bool("/gaim/gtk/debug/invert");