summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Sales de Andrade <qulogic@pidgin.im>2018-06-11 06:14:03 -0400
committerElliott Sales de Andrade <qulogic@pidgin.im>2018-06-11 06:14:03 -0400
commite08e60c9e6cb3b85481b4a286d4001e98e771471 (patch)
tree9ad0f9f36c49b3cff33b9889dca24a4cf030fae0
parent34a7141b0d0f2ec8bc2b4b40e386009d6b0c6594 (diff)
downloadpidgin-e08e60c9e6cb3b85481b4a286d4001e98e771471.tar.gz
Use GtkSearchEntry for debug window.
This has a delay built in to it, plus some icons.
-rw-r--r--pidgin/pidgindebug.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/pidgin/pidgindebug.c b/pidgin/pidgindebug.c
index 612558a42c..b0f5535bac 100644
--- a/pidgin/pidgindebug.c
+++ b/pidgin/pidgindebug.c
@@ -54,7 +54,6 @@ typedef struct
gboolean invert;
gboolean highlight;
- guint timer;
GRegex *regex;
} DebugWindow;
@@ -80,14 +79,6 @@ debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused)
{
purple_prefs_disconnect_by_handle(pidgin_debug_get_handle());
- if(debug_win->timer != 0) {
- const gchar *text;
-
- g_source_remove(debug_win->timer);
-
- text = gtk_entry_get_text(GTK_ENTRY(debug_win->expression));
- purple_prefs_set_string(PIDGIN_PREFS_ROOT "/debug/regex", text);
- }
if (debug_win->regex != NULL)
g_regex_unref(debug_win->regex);
@@ -253,18 +244,6 @@ regex_pref_highlight_cb(const gchar *name, PurplePrefType type,
regex_toggle_filter(win, TRUE);
}
-static gboolean
-regex_timer_cb(DebugWindow *win) {
- const gchar *text;
-
- text = gtk_entry_get_text(GTK_ENTRY(win->expression));
- purple_prefs_set_string(PIDGIN_PREFS_ROOT "/debug/regex", text);
-
- win->timer = 0;
-
- return FALSE;
-}
-
static void
regex_changed_cb(GtkWidget *w, DebugWindow *win) {
const gchar *text;
@@ -274,10 +253,8 @@ regex_changed_cb(GtkWidget *w, DebugWindow *win) {
FALSE);
}
- if (win->timer == 0)
- win->timer = g_timeout_add_seconds(5, (GSourceFunc)regex_timer_cb, win);
-
text = gtk_entry_get_text(GTK_ENTRY(win->expression));
+ purple_prefs_set_string(PIDGIN_PREFS_ROOT "/debug/regex", text);
if (text == NULL || *text == '\0') {
regex_clear_color(win->expression);
@@ -555,7 +532,7 @@ debug_window_new(void)
regex_pref_filter_cb, win);
/* regex entry */
- win->expression = gtk_entry_new();
+ win->expression = gtk_search_entry_new();
item = gtk_tool_item_new();
gtk_widget_set_tooltip_text(win->expression, _("Right click for more options."));
gtk_container_add(GTK_CONTAINER(item), GTK_WIDGET(win->expression));
@@ -571,7 +548,7 @@ debug_window_new(void)
/* this needs to be before the text is set from the pref if we want it
* to colorize a stored expression.
*/
- g_signal_connect(G_OBJECT(win->expression), "changed",
+ g_signal_connect(G_OBJECT(win->expression), "search-changed",
G_CALLBACK(regex_changed_cb), win);
gtk_entry_set_text(GTK_ENTRY(win->expression),
purple_prefs_get_string(PIDGIN_PREFS_ROOT "/debug/regex"));