pidgin/gtkdebug.c

Fri, 30 Jun 2017 13:13:13 -0500

author
Mike Ruprecht <cmaiku@gmail.com>
date
Fri, 30 Jun 2017 13:13:13 -0500
changeset 38547
1772a0f0f77c
parent 38433
361c801c4536
child 38645
bf3f91939dc5
child 38658
f3db8eafde9e
permissions
-rw-r--r--

tls-certificate: Fix docstring function references

Several function references in the documentation of PurpleTlsCertificate
were using the wrong function names or just the wrong function. This
patch fixes those references.

20147
66f05a854eee applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents: 19859
diff changeset
1 /* pidgin
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 *
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
3 * Pidgin is the legal property of its developers, whose names are too numerous
8046
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 8002
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 8002
diff changeset
5 * source distribution.
7152
112d0e52d04b [gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents: 7150
diff changeset
6 *
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * (at your option) any later version.
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 *
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * GNU General Public License for more details.
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 *
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19065
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 */
9791
f5c5bda0b96b [gaim-migrate @ 10659]
Gary Kramlich <grim@pidgin.im>
parents: 9709
diff changeset
21 #include "internal.h"
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15571
diff changeset
22 #include "pidgin.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
23
9480
b4d46aa1be7d [gaim-migrate @ 10305]
Mark Doliner <markdoliner@pidgin.im>
parents: 8953
diff changeset
24 #include "notify.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
25 #include "prefs.h"
8953
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
26 #include "request.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
27 #include "util.h"
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
28
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 #include "gtkdebug.h"
9709
2e73f176cc80 [gaim-migrate @ 10570]
Mark Doliner <markdoliner@pidgin.im>
parents: 9504
diff changeset
30 #include "gtkdialogs.h"
8953
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
31 #include "gtkutils.h"
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
32 #include "gtkwebview.h"
15883
969b74a3e27a According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
33 #include "pidginstock.h"
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5818
diff changeset
34
35633
e4618d775e0d Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
35 #ifdef ENABLE_GLIBTRACE
e4618d775e0d Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
36 #include <execinfo.h>
30795
4fc1b7cc2e06 Use GRegex where available. Fixes #12601.
Eion Robb <eion@robbmob.com>
parents: 29747
diff changeset
37 #endif
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
38
11473
38b35dc600ce [gaim-migrate @ 13714]
Gary Kramlich <grim@reaperworld.com>
parents: 11450
diff changeset
39 #include <gdk/gdkkeysyms.h>
38b35dc600ce [gaim-migrate @ 13714]
Gary Kramlich <grim@reaperworld.com>
parents: 11450
diff changeset
40
33170
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33167
diff changeset
41 #include "gtk3compat.h"
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33167
diff changeset
42
38378
7fed48292d93 Rename resource file to be more generic.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38377
diff changeset
43 #include "pidgin.gresource.h"
33922
61f997b47954 Split debug window HTML into a separate file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33921
diff changeset
44
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 typedef struct
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 {
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 GtkWidget *window;
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
48 GtkWidget *text;
33092
a68f8b2b6873 Always use GRegex in the Debug Window.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33091
diff changeset
49 GtkWidget *filter;
a68f8b2b6873 Always use GRegex in the Debug Window.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33091
diff changeset
50 GtkWidget *expression;
a68f8b2b6873 Always use GRegex in the Debug Window.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33091
diff changeset
51 GtkWidget *filterlevel;
11033
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
52
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
53 gboolean paused;
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
55 gboolean invert;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
56 gboolean highlight;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
57 guint timer;
30795
4fc1b7cc2e06 Use GRegex where available. Fixes #12601.
Eion Robb <eion@robbmob.com>
parents: 29747
diff changeset
58 GRegex *regex;
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 } DebugWindow;
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 static DebugWindow *debug_win = NULL;
17232
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
62 static guint debug_enabled_timer = 0;
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 static gint
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused)
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
67 purple_prefs_disconnect_by_handle(pidgin_debug_get_handle());
9502
d43f69354213 [gaim-migrate @ 10329]
Mark Doliner <markdoliner@pidgin.im>
parents: 9501
diff changeset
68
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
69 if(debug_win->timer != 0) {
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
70 const gchar *text;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
71
38433
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 38378
diff changeset
72 g_source_remove(debug_win->timer);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
73
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
74 text = gtk_entry_get_text(GTK_ENTRY(debug_win->expression));
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
75 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/debug/regex", text);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
76 }
33539
12e93808f35d Fix some warnings in debug and conv windows
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33538
diff changeset
77 if (debug_win->regex != NULL)
12e93808f35d Fix some warnings in debug and conv windows
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33538
diff changeset
78 g_regex_unref(debug_win->regex);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
79
9502
d43f69354213 [gaim-migrate @ 10329]
Mark Doliner <markdoliner@pidgin.im>
parents: 9501
diff changeset
80 /* If the "Save Log" dialog is open then close it */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
81 purple_request_close_with_handle(debug_win);
5704
3170b0bd2b40 [gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
82
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 g_free(debug_win);
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 debug_win = NULL;
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
86 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/enabled", FALSE);
9480
b4d46aa1be7d [gaim-migrate @ 10305]
Mark Doliner <markdoliner@pidgin.im>
parents: 8953
diff changeset
87
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
88 return FALSE;
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
89 }
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
91 static gboolean
5794
ebdbb7dc6658 [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5738
diff changeset
92 configure_cb(GtkWidget *w, GdkEventConfigure *event, DebugWindow *win)
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
93 {
32913
af2c726febce Fix all deprecated GTK_WIDGET_* macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32912
diff changeset
94 if (gtk_widget_get_visible(w)) {
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
95 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/debug/width", event->width);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
96 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/debug/height", event->height);
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
97 }
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 return FALSE;
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100 }
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101
8953
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
102 static void
9502
d43f69354213 [gaim-migrate @ 10329]
Mark Doliner <markdoliner@pidgin.im>
parents: 9501
diff changeset
103 save_writefile_cb(void *user_data, const char *filename)
8953
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
104 {
9502
d43f69354213 [gaim-migrate @ 10329]
Mark Doliner <markdoliner@pidgin.im>
parents: 9501
diff changeset
105 DebugWindow *win = (DebugWindow *)user_data;
9489
3ee8fdcdbac9 [gaim-migrate @ 10314]
Mark Doliner <markdoliner@pidgin.im>
parents: 9486
diff changeset
106 FILE *fp;
8953
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
107 char *tmp;
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
108
10589
4e10236e06d4 [gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents: 10448
diff changeset
109 if ((fp = g_fopen(filename, "w+")) == NULL) {
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34333
diff changeset
110 purple_notify_error(win, NULL, _("Unable to open file."), NULL, NULL);
8953
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
111 return;
9480
b4d46aa1be7d [gaim-migrate @ 10305]
Mark Doliner <markdoliner@pidgin.im>
parents: 8953
diff changeset
112 }
8953
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
113
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
114 tmp = pidgin_webview_get_body_text(PIDGIN_WEBVIEW(win->text));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
115 fprintf(fp, "Pidgin Debug Log : %s\n", purple_date_format_full(NULL));
8953
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
116 fprintf(fp, "%s", tmp);
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
117 g_free(tmp);
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
118
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
119 fclose(fp);
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
120 }
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
121
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
122 static void
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
123 save_cb(GtkWidget *w, DebugWindow *win)
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
124 {
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
125 purple_request_file(win, _("Save Debug Log"), "purple-debug.log", TRUE,
34333
b92698241603 Request API refactoring: switch purple_request_file to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34308
diff changeset
126 G_CALLBACK(save_writefile_cb), NULL, NULL, win);
8953
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
127 }
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
128
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
129 static void
5794
ebdbb7dc6658 [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5738
diff changeset
130 clear_cb(GtkWidget *w, DebugWindow *win)
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
131 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
132 pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(win->text), "clear();");
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
133 }
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
134
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
135 static void
5794
ebdbb7dc6658 [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5738
diff changeset
136 pause_cb(GtkWidget *w, DebugWindow *win)
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
137 {
29746
f7a7722bee2f Remove GTK_CHECK_VERSION(2,4,0) checks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29745
diff changeset
138 win->paused = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(w));
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
139
33920
6a4eaacdd207 Rewrite debug window pausing in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33919
diff changeset
140 if (win->paused)
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
141 pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(win->text), "pauseOutput();");
33920
6a4eaacdd207 Rewrite debug window pausing in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33919
diff changeset
142 else
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
143 pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(win->text), "resumeOutput();");
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
144 }
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
145
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
146 /******************************************************************************
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
147 * regex stuff
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
148 *****************************************************************************/
11033
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
149 static void
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
150 regex_clear_color(GtkWidget *w) {
33924
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
151 GtkStyleContext *context = gtk_widget_get_style_context(w);
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
152 gtk_style_context_remove_class(context, "good-filter");
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
153 gtk_style_context_remove_class(context, "bad-filter");
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
154 }
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
155
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
156 static void
33924
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
157 regex_change_color(GtkWidget *w, gboolean success) {
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
158 GtkStyleContext *context = gtk_widget_get_style_context(w);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
159
33924
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
160 if (success) {
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
161 gtk_style_context_add_class(context, "good-filter");
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
162 gtk_style_context_remove_class(context, "bad-filter");
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
163 } else {
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
164 gtk_style_context_add_class(context, "bad-filter");
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
165 gtk_style_context_remove_class(context, "good-filter");
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
166 }
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
167 }
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
168
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
169 static void
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
170 regex_toggle_filter(DebugWindow *win, gboolean filter)
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
171 {
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
172 pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(win->text), "regex.clear();");
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
173
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
174 if (filter) {
33923
0fcc5635daba Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33922
diff changeset
175 const char *text;
0fcc5635daba Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33922
diff changeset
176 char *regex;
0fcc5635daba Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33922
diff changeset
177 char *script;
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
178
33923
0fcc5635daba Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33922
diff changeset
179 text = gtk_entry_get_text(GTK_ENTRY(win->expression));
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
180 regex = pidgin_webview_quote_js_string(text);
33923
0fcc5635daba Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33922
diff changeset
181 script = g_strdup_printf("regex.filterAll(%s, %s, %s);",
0fcc5635daba Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33922
diff changeset
182 regex,
0fcc5635daba Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33922
diff changeset
183 win->invert ? "true" : "false",
0fcc5635daba Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33922
diff changeset
184 win->highlight ? "true" : "false");
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
185 pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(win->text), script);
33923
0fcc5635daba Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33922
diff changeset
186 g_free(script);
0fcc5635daba Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33922
diff changeset
187 g_free(regex);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
188 }
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
189 }
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
190
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
191 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
192 regex_pref_filter_cb(const gchar *name, PurplePrefType type,
12816
5f93e09fa9a6 [gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents: 12231
diff changeset
193 gconstpointer val, gpointer data)
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
194 {
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
195 DebugWindow *win = (DebugWindow *)data;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
196 gboolean active = GPOINTER_TO_INT(val), current;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
197
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
198 if (!win || !win->window)
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
199 return;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
200
29746
f7a7722bee2f Remove GTK_CHECK_VERSION(2,4,0) checks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29745
diff changeset
201 current = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter));
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
202 if (active != current)
29746
f7a7722bee2f Remove GTK_CHECK_VERSION(2,4,0) checks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29745
diff changeset
203 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter), active);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
204 }
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
205
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
206 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
207 regex_pref_expression_cb(const gchar *name, PurplePrefType type,
12816
5f93e09fa9a6 [gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents: 12231
diff changeset
208 gconstpointer val, gpointer data)
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
209 {
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
210 DebugWindow *win = (DebugWindow *)data;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
211 const gchar *exp = (const gchar *)val;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
212
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
213 gtk_entry_set_text(GTK_ENTRY(win->expression), exp);
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
214 }
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
215
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
216 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
217 regex_pref_invert_cb(const gchar *name, PurplePrefType type,
12816
5f93e09fa9a6 [gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents: 12231
diff changeset
218 gconstpointer val, gpointer data)
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
219 {
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
220 DebugWindow *win = (DebugWindow *)data;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
221 gboolean active = GPOINTER_TO_INT(val);
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
222
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
223 win->invert = active;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
224
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
225 if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)))
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
226 regex_toggle_filter(win, TRUE);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
227 }
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
228
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
229 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
230 regex_pref_highlight_cb(const gchar *name, PurplePrefType type,
12816
5f93e09fa9a6 [gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents: 12231
diff changeset
231 gconstpointer val, gpointer data)
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
232 {
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
233 DebugWindow *win = (DebugWindow *)data;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
234 gboolean active = GPOINTER_TO_INT(val);
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
235
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
236 win->highlight = active;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
237
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
238 if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)))
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
239 regex_toggle_filter(win, TRUE);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
240 }
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
241
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
242 static gboolean
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
243 regex_timer_cb(DebugWindow *win) {
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
244 const gchar *text;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
245
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
246 text = gtk_entry_get_text(GTK_ENTRY(win->expression));
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
247 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/debug/regex", text);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
248
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
249 win->timer = 0;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
250
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
251 return FALSE;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
252 }
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
253
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
254 static void
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
255 regex_changed_cb(GtkWidget *w, DebugWindow *win) {
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
256 const gchar *text;
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
257
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
258 if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) {
29746
f7a7722bee2f Remove GTK_CHECK_VERSION(2,4,0) checks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29745
diff changeset
259 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter),
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
260 FALSE);
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
261 }
11033
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
262
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
263 if (win->timer == 0)
38433
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 38378
diff changeset
264 win->timer = g_timeout_add_seconds(5, (GSourceFunc)regex_timer_cb, win);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
265
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
266 text = gtk_entry_get_text(GTK_ENTRY(win->expression));
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
267
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
268 if (text == NULL || *text == '\0') {
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
269 regex_clear_color(win->expression);
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
270 gtk_widget_set_sensitive(win->filter, FALSE);
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
271 return;
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
272 }
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
273
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
274 if (win->regex)
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
275 g_regex_unref(win->regex);
38045
6e8b223df524 Remove GLIB_CHECK_VERSION <= 2.36 calls
Mike Ruprecht <cmaiku@gmail.com>
parents: 37422
diff changeset
276
33923
0fcc5635daba Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33922
diff changeset
277 win->regex = g_regex_new(text, G_REGEX_CASELESS|G_REGEX_JAVASCRIPT_COMPAT, 0, NULL);
38045
6e8b223df524 Remove GLIB_CHECK_VERSION <= 2.36 calls
Mike Ruprecht <cmaiku@gmail.com>
parents: 37422
diff changeset
278
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
279 if (win->regex == NULL) {
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
280 /* failed to compile */
33924
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
281 regex_change_color(win->expression, FALSE);
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
282 gtk_widget_set_sensitive(win->filter, FALSE);
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
283 } else {
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
284 /* compiled successfully */
33924
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
285 regex_change_color(win->expression, TRUE);
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
286 gtk_widget_set_sensitive(win->filter, TRUE);
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
287 }
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
288 }
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
289
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
290 static void
11450
52e566659430 [gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents: 11312
diff changeset
291 regex_key_release_cb(GtkWidget *w, GdkEventKey *e, DebugWindow *win) {
36254
3ee545012e46 Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35633
diff changeset
292 if (gtk_widget_is_sensitive(win->filter)) {
3ee545012e46 Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35633
diff changeset
293 GtkToggleToolButton *tb = GTK_TOGGLE_TOOL_BUTTON(win->filter);
3ee545012e46 Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35633
diff changeset
294 if ((e->keyval == GDK_KEY_Return || e->keyval == GDK_KEY_KP_Enter) &&
3ee545012e46 Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35633
diff changeset
295 !gtk_toggle_tool_button_get_active(tb))
3ee545012e46 Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35633
diff changeset
296 {
3ee545012e46 Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35633
diff changeset
297 gtk_toggle_tool_button_set_active(tb, TRUE);
3ee545012e46 Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35633
diff changeset
298 }
3ee545012e46 Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35633
diff changeset
299 if (e->keyval == GDK_KEY_Escape &&
3ee545012e46 Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35633
diff changeset
300 gtk_toggle_tool_button_get_active(tb))
3ee545012e46 Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35633
diff changeset
301 {
3ee545012e46 Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35633
diff changeset
302 gtk_toggle_tool_button_set_active(tb, FALSE);
3ee545012e46 Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35633
diff changeset
303 }
11450
52e566659430 [gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents: 11312
diff changeset
304 }
52e566659430 [gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents: 11312
diff changeset
305 }
52e566659430 [gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents: 11312
diff changeset
306
52e566659430 [gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents: 11312
diff changeset
307 static void
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
308 regex_menu_cb(GtkWidget *item, const gchar *pref) {
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
309 gboolean active;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
310
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
311 active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item));
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
312
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
313 purple_prefs_set_bool(pref, active);
11033
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
314 }
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
315
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
316 static void
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
317 regex_popup_cb(GtkEntry *entry, GtkWidget *menu, DebugWindow *win) {
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
318 pidgin_separator(menu);
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
319 pidgin_new_check_item(menu, _("Invert"),
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
320 G_CALLBACK(regex_menu_cb),
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
321 PIDGIN_PREFS_ROOT "/debug/invert", win->invert);
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15562
diff changeset
322 pidgin_new_check_item(menu, _("Highlight matches"),
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
323 G_CALLBACK(regex_menu_cb),
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
324 PIDGIN_PREFS_ROOT "/debug/highlight", win->highlight);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
325 }
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
326
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
327 static void
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
328 regex_filter_toggled_cb(GtkToggleToolButton *button, DebugWindow *win)
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
329 {
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
330 gboolean active;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
331
29746
f7a7722bee2f Remove GTK_CHECK_VERSION(2,4,0) checks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29745
diff changeset
332 active = gtk_toggle_tool_button_get_active(button);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
333
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
334 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/filter", active);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
335
35506
4252b2882889 Fix some remaining GTK_* macros as Elliott noticed
Ankit Vani <a@nevitus.org>
parents: 35500
diff changeset
336 if (!PIDGIN_IS_WEBVIEW(win->text))
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
337 return;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
338
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
339 regex_toggle_filter(win, active);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
340 }
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
341
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
342 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
343 filter_level_pref_changed(const char *name, PurplePrefType type, gconstpointer value, gpointer data)
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
344 {
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
345 DebugWindow *win = data;
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
346 int level = GPOINTER_TO_INT(value);
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
347 char *tmp;
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
348
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
349 if (level != gtk_combo_box_get_active(GTK_COMBO_BOX(win->filterlevel)))
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
350 gtk_combo_box_set_active(GTK_COMBO_BOX(win->filterlevel), level);
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
351
33921
d1e2fdbc3d56 Rewrite debug window filtering in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33920
diff changeset
352 tmp = g_strdup_printf("setFilterLevel('%d');", level);
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
353 pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(win->text), tmp);
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
354 g_free(tmp);
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
355 }
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
356
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
357 static void
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
358 filter_level_changed_cb(GtkWidget *combo, gpointer null)
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
359 {
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
360 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/debug/filterlevel",
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
361 gtk_combo_box_get_active(GTK_COMBO_BOX(combo)));
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
362 }
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
363
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
364 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
365 toolbar_style_pref_changed_cb(const char *name, PurplePrefType type, gconstpointer value, gpointer data)
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
366 {
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
367 gtk_toolbar_set_style(GTK_TOOLBAR(data), GPOINTER_TO_INT(value));
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
368 }
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
369
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
370 static void
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
371 toolbar_icon_pref_changed(GtkWidget *item, GtkWidget *toolbar)
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
372 {
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
373 int style = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(item), "user_data"));
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
374 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/debug/style", style);
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
375 }
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
376
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
377 static gboolean
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
378 toolbar_context(GtkWidget *toolbar, GdkEventButton *event, gpointer null)
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
379 {
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
380 GtkWidget *menu, *item;
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
381 const char *text[3];
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
382 GtkToolbarStyle value[3];
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
383 int i;
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
384
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
385 if (!(event->button == 3 && event->type == GDK_BUTTON_PRESS))
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
386 return FALSE;
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
387
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
388 text[0] = _("_Icon Only"); value[0] = GTK_TOOLBAR_ICONS;
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
389 text[1] = _("_Text Only"); value[1] = GTK_TOOLBAR_TEXT;
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
390 text[2] = _("_Both Icon & Text"); value[2] = GTK_TOOLBAR_BOTH_HORIZ;
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
391
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
392 menu = gtk_menu_new();
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
393
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
394 for (i = 0; i < 3; i++) {
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
395 item = gtk_check_menu_item_new_with_mnemonic(text[i]);
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
396 g_object_set_data(G_OBJECT(item), "user_data", GINT_TO_POINTER(value[i]));
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
397 g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(toolbar_icon_pref_changed), toolbar);
36256
a437550a9308 Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
398 if (value[i] == (GtkToolbarStyle)purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/style"))
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
399 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
400 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
401 }
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
402
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
403 gtk_widget_show_all(menu);
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
404
33110
a2923f41d05a We have the exact button and event time to use here.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33095
diff changeset
405 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time);
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
406 return FALSE;
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
407 }
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
408
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
409 static DebugWindow *
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
410 debug_window_new(void)
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
411 {
38376
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
412 GError *error;
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
413 DebugWindow *win;
38376
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
414 GResource *resource;
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
415 GBytes *resource_bytes;
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
416 GtkWidget *vbox;
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
417 GtkWidget *toolbar;
10175
2bf5ed145e8a [gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents: 10087
diff changeset
418 GtkWidget *frame;
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
419 gint width, height;
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
420 void *handle;
29745
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
421 GtkToolItem *item;
33924
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
422 GtkStyleContext *context;
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
423 GtkCssProvider *filter_css;
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
424 const gchar filter_style[] =
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
425 ".bad-filter {"
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
426 "color: @error_fg_color;"
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
427 "text-shadow: 0 1px @error_text_shadow;"
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
428 "background-image: none;"
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
429 "background-color: @error_bg_color;"
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
430 "}"
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
431 ".good-filter {"
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
432 "color: @question_fg_color;"
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
433 "text-shadow: 0 1px @question_text_shadow;"
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
434 "background-image: none;"
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
435 "background-color: @success_color;"
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
436 "}";
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
438 win = g_new0(DebugWindow, 1);
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
440 width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/width");
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
441 height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/height");
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
442
29321
c089a3e0092e De-dialogify the file-transfer and debug windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29287
diff changeset
443 win->window = pidgin_create_window(_("Debug Window"), 0, "debug", TRUE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
444 purple_debug_info("gtkdebug", "Setting dimensions to %d, %d\n",
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
445 width, height);
5642
d7b8b62542a3 [gaim-migrate @ 6056]
Christian Hammond <chipx86@chipx86.com>
parents: 5636
diff changeset
446
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
447 gtk_window_set_default_size(GTK_WINDOW(win->window), width, height);
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
448
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449 g_signal_connect(G_OBJECT(win->window), "delete_event",
11033
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
450 G_CALLBACK(debug_window_destroy), NULL);
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
451 g_signal_connect(G_OBJECT(win->window), "configure_event",
11033
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
452 G_CALLBACK(configure_cb), win);
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15512
diff changeset
454 handle = pidgin_debug_get_handle();
22099
8e70e3ba6096 Modified patch from Gabriel (Sylar?) Schulof to deprecate PIDGIN_DIALOG. Closes #4535. (PS: I am aware of --author).
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21743
diff changeset
455
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
456 /* Setup the vbox */
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35506
diff changeset
457 vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
29321
c089a3e0092e De-dialogify the file-transfer and debug windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29287
diff changeset
458 gtk_container_add(GTK_CONTAINER(win->window), vbox);
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
459
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
460 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/toolbar")) {
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
461 /* Setup our top button bar thingie. */
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
462 toolbar = gtk_toolbar_new();
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
463 gtk_toolbar_set_show_arrow(GTK_TOOLBAR(toolbar), TRUE);
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
464 g_signal_connect(G_OBJECT(toolbar), "button-press-event", G_CALLBACK(toolbar_context), win);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
465
11033
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
466 gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
467 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/style"));
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
468 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/style",
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
469 toolbar_style_pref_changed_cb, toolbar);
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
470 gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar),
11033
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
471 GTK_ICON_SIZE_SMALL_TOOLBAR);
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
472
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
473 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
474
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
475 /* Save */
29745
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
476 item = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE);
29747
4256b05bd720 Set debug window tool items to be "important" so that they show text when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29746
diff changeset
477 gtk_tool_item_set_is_important(item, TRUE);
29745
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
478 gtk_tool_item_set_tooltip_text(item, _("Save"));
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
479 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(save_cb), win);
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
480 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
481
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
482 /* Clear button */
29745
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
483 item = gtk_tool_button_new_from_stock(GTK_STOCK_CLEAR);
29747
4256b05bd720 Set debug window tool items to be "important" so that they show text when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29746
diff changeset
484 gtk_tool_item_set_is_important(item, TRUE);
29745
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
485 gtk_tool_item_set_tooltip_text(item, _("Clear"));
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
486 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(clear_cb), win);
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
487 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
488
29745
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
489 item = gtk_separator_tool_item_new();
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
490 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
491
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
492 /* Pause */
29745
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
493 item = gtk_toggle_tool_button_new_from_stock(PIDGIN_STOCK_PAUSE);
29747
4256b05bd720 Set debug window tool items to be "important" so that they show text when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29746
diff changeset
494 gtk_tool_item_set_is_important(item, TRUE);
29745
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
495 gtk_tool_item_set_tooltip_text(item, _("Pause"));
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
496 g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(pause_cb), win);
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
497 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
498
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
499 /* regex stuff */
29745
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
500 item = gtk_separator_tool_item_new();
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
501 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
11033
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
502
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
503 /* regex toggle button */
29747
4256b05bd720 Set debug window tool items to be "important" so that they show text when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29746
diff changeset
504 item = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_FIND);
4256b05bd720 Set debug window tool items to be "important" so that they show text when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29746
diff changeset
505 gtk_tool_item_set_is_important(item, TRUE);
4256b05bd720 Set debug window tool items to be "important" so that they show text when
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29746
diff changeset
506 win->filter = GTK_WIDGET(item);
29745
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
507 gtk_tool_button_set_label(GTK_TOOL_BUTTON(win->filter), _("Filter"));
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
508 gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(win->filter), _("Filter"));
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
509 g_signal_connect(G_OBJECT(win->filter), "clicked", G_CALLBACK(regex_filter_toggled_cb), win);
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
510 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(win->filter));
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
511
11450
52e566659430 [gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents: 11312
diff changeset
512 /* we purposely disable the toggle button here in case
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
513 * /purple/gtk/debug/expression has an empty string. If it does not have
11450
52e566659430 [gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents: 11312
diff changeset
514 * an empty string, the change signal will get called and make the
52e566659430 [gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents: 11312
diff changeset
515 * toggle button sensitive.
52e566659430 [gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents: 11312
diff changeset
516 */
52e566659430 [gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents: 11312
diff changeset
517 gtk_widget_set_sensitive(win->filter, FALSE);
29746
f7a7722bee2f Remove GTK_CHECK_VERSION(2,4,0) checks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29745
diff changeset
518 gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter),
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
519 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/filter"));
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
520 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/filter",
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
521 regex_pref_filter_cb, win);
8953
6705ad4595b0 [gaim-migrate @ 9726]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8735
diff changeset
522
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
523 /* regex entry */
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
524 win->expression = gtk_entry_new();
29745
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
525 item = gtk_tool_item_new();
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
526 gtk_widget_set_tooltip_text(win->expression, _("Right click for more options."));
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
527 gtk_container_add(GTK_CONTAINER(item), GTK_WIDGET(win->expression));
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
528 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
29746
f7a7722bee2f Remove GTK_CHECK_VERSION(2,4,0) checks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29745
diff changeset
529
33924
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
530 filter_css = gtk_css_provider_new();
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
531 gtk_css_provider_load_from_data(filter_css, filter_style, -1, NULL);
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
532 context = gtk_widget_get_style_context(win->expression);
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
533 gtk_style_context_add_provider(context,
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
534 GTK_STYLE_PROVIDER(filter_css),
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
535 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
788678d2e035 Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33923
diff changeset
536
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
537 /* this needs to be before the text is set from the pref if we want it
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
538 * to colorize a stored expression.
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
539 */
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
540 g_signal_connect(G_OBJECT(win->expression), "changed",
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
541 G_CALLBACK(regex_changed_cb), win);
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
542 gtk_entry_set_text(GTK_ENTRY(win->expression),
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
543 purple_prefs_get_string(PIDGIN_PREFS_ROOT "/debug/regex"));
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
544 g_signal_connect(G_OBJECT(win->expression), "populate-popup",
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
545 G_CALLBACK(regex_popup_cb), win);
11450
52e566659430 [gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents: 11312
diff changeset
546 g_signal_connect(G_OBJECT(win->expression), "key-release-event",
52e566659430 [gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents: 11312
diff changeset
547 G_CALLBACK(regex_key_release_cb), win);
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
548 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/regex",
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
549 regex_pref_expression_cb, win);
11033
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
550
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
551 /* connect the rest of our pref callbacks */
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
552 win->invert = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/invert");
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
553 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/invert",
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
554 regex_pref_invert_cb, win);
11033
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
555
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
556 win->highlight = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/highlight");
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
557 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/highlight",
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
558 regex_pref_highlight_cb, win);
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
559
29745
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
560 item = gtk_separator_tool_item_new();
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
561 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
562
29745
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
563 item = gtk_tool_item_new();
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
564 gtk_container_add(GTK_CONTAINER(item), gtk_label_new(_("Level ")));
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
565 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
29746
f7a7722bee2f Remove GTK_CHECK_VERSION(2,4,0) checks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29745
diff changeset
566
33133
9a31f084f259 Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
567 win->filterlevel = gtk_combo_box_text_new();
29745
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
568 item = gtk_tool_item_new();
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
569 gtk_widget_set_tooltip_text(win->filterlevel, _("Select the debug filter level."));
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
570 gtk_container_add(GTK_CONTAINER(item), win->filterlevel);
ebf70b1934f1 New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29694
diff changeset
571 gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
29746
f7a7722bee2f Remove GTK_CHECK_VERSION(2,4,0) checks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29745
diff changeset
572
33133
9a31f084f259 Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
573 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("All"));
9a31f084f259 Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
574 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Misc"));
9a31f084f259 Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
575 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Info"));
9a31f084f259 Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
576 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Warning"));
9a31f084f259 Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
577 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Error "));
9a31f084f259 Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33132
diff changeset
578 gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(win->filterlevel), _("Fatal Error"));
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
579 gtk_combo_box_set_active(GTK_COMBO_BOX(win->filterlevel),
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
580 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel"));
33092
a68f8b2b6873 Always use GRegex in the Debug Window.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33091
diff changeset
581
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
582 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/filterlevel",
14541
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
583 filter_level_pref_changed, win);
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
584 g_signal_connect(G_OBJECT(win->filterlevel), "changed",
b4b96a041230 [gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents: 14253
diff changeset
585 G_CALLBACK(filter_level_changed_cb), NULL);
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
586 }
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
587
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
588 /* Add the gtkwebview */
34274
9169710b5af5 Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33934
diff changeset
589 frame = pidgin_create_webview(FALSE, &win->text, NULL);
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
590 pidgin_webview_set_format_functions(PIDGIN_WEBVIEW(win->text),
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
591 PIDGIN_WEBVIEW_ALL ^ PIDGIN_WEBVIEW_SMILEY ^ PIDGIN_WEBVIEW_IMAGE);
38378
7fed48292d93 Rename resource file to be more generic.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38377
diff changeset
592 resource = pidgin_get_resource();
38376
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
593 error = NULL;
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
594 resource_bytes = g_resource_lookup_data(resource,
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
595 "/im/pidgin/Pidgin/gtkdebug.html",
38377
88e5bd05a57c Fix small GResource bugs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38376
diff changeset
596 G_RESOURCE_LOOKUP_FLAGS_NONE,
88e5bd05a57c Fix small GResource bugs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38376
diff changeset
597 &error);
38376
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
598 if (G_UNLIKELY(resource_bytes == NULL || error != NULL)) {
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
599 gchar *msg = g_strdup_printf("Unable to load debug window HTML: %s\n",
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
600 error ? error->message : "Unknown error");
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
601 g_clear_error(&error);
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
602 pidgin_webview_load_html_string(PIDGIN_WEBVIEW(win->text), msg);
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
603 g_free(msg);
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
604 } else {
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
605 gconstpointer gtkdebug_html;
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
606 gtkdebug_html = g_bytes_get_data(resource_bytes, NULL);
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
607 pidgin_webview_load_html_string(PIDGIN_WEBVIEW(win->text),
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
608 gtkdebug_html);
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
609 }
d27109ba6626 Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38045
diff changeset
610 g_bytes_unref(resource_bytes);
10175
2bf5ed145e8a [gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents: 10087
diff changeset
611 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
2bf5ed145e8a [gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents: 10087
diff changeset
612 gtk_widget_show(frame);
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
613
33111
e05551721abf Obey the filter level when the Debug Window is first opened.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33110
diff changeset
614 clear_cb(NULL, win);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
615
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
616 gtk_widget_show_all(win->window);
5428
5788d3bc050a [gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents: 5314
diff changeset
617
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
618 return win;
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
619 }
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
620
17232
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
621 static gboolean
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
622 debug_enabled_timeout_cb(gpointer data)
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
623 {
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
624 debug_enabled_timer = 0;
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
625
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
626 if (data)
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
627 pidgin_debug_window_show();
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
628 else
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
629 pidgin_debug_window_hide();
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
630
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
631 return FALSE;
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
632 }
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
633
5625
ac8c09def58a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
634 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
635 debug_enabled_cb(const char *name, PurplePrefType type,
12816
5f93e09fa9a6 [gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents: 12231
diff changeset
636 gconstpointer value, gpointer data)
5625
ac8c09def58a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
637 {
17232
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
638 debug_enabled_timer = g_timeout_add(0, debug_enabled_timeout_cb, GINT_TO_POINTER(GPOINTER_TO_INT(value)));
5625
ac8c09def58a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
639 }
ac8c09def58a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
640
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
641 static void
15880
d275b025481c More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
642 pidgin_glib_log_handler(const gchar *domain, GLogLevelFlags flags,
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
643 const gchar *msg, gpointer user_data)
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
644 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
645 PurpleDebugLevel level;
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
646 char *new_msg = NULL;
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
647 char *new_domain = NULL;
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
648
7152
112d0e52d04b [gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents: 7150
diff changeset
649 if ((flags & G_LOG_LEVEL_ERROR) == G_LOG_LEVEL_ERROR)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
650 level = PURPLE_DEBUG_ERROR;
7152
112d0e52d04b [gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents: 7150
diff changeset
651 else if ((flags & G_LOG_LEVEL_CRITICAL) == G_LOG_LEVEL_CRITICAL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
652 level = PURPLE_DEBUG_FATAL;
7152
112d0e52d04b [gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents: 7150
diff changeset
653 else if ((flags & G_LOG_LEVEL_WARNING) == G_LOG_LEVEL_WARNING)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
654 level = PURPLE_DEBUG_WARNING;
7152
112d0e52d04b [gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents: 7150
diff changeset
655 else if ((flags & G_LOG_LEVEL_MESSAGE) == G_LOG_LEVEL_MESSAGE)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
656 level = PURPLE_DEBUG_INFO;
7152
112d0e52d04b [gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents: 7150
diff changeset
657 else if ((flags & G_LOG_LEVEL_INFO) == G_LOG_LEVEL_INFO)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
658 level = PURPLE_DEBUG_INFO;
7152
112d0e52d04b [gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents: 7150
diff changeset
659 else if ((flags & G_LOG_LEVEL_DEBUG) == G_LOG_LEVEL_DEBUG)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
660 level = PURPLE_DEBUG_MISC;
7152
112d0e52d04b [gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents: 7150
diff changeset
661 else
112d0e52d04b [gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents: 7150
diff changeset
662 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
663 purple_debug_warning("gtkdebug",
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
664 "Unknown glib logging level in %d\n", flags);
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
665
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
666 level = PURPLE_DEBUG_MISC; /* This will never happen. */
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
667 }
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
668
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
669 if (msg != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
670 new_msg = purple_utf8_try_convert(msg);
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
671
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
672 if (domain != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
673 new_domain = purple_utf8_try_convert(domain);
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
674
7152
112d0e52d04b [gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents: 7150
diff changeset
675 if (new_msg != NULL)
112d0e52d04b [gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents: 7150
diff changeset
676 {
35633
e4618d775e0d Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
677 #ifdef ENABLE_GLIBTRACE
e4618d775e0d Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
678 void *bt_buff[20];
e4618d775e0d Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
679 size_t bt_size;
e4618d775e0d Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
680
e4618d775e0d Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
681 bt_size = backtrace(bt_buff, 20);
e4618d775e0d Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
682 fprintf(stderr, "\nBacktrace for \"%s\" (%s):\n", new_msg,
e4618d775e0d Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
683 new_domain != NULL ? new_domain : "g_log");
e4618d775e0d Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
684 backtrace_symbols_fd(bt_buff, bt_size, STDERR_FILENO);
e4618d775e0d Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
685 fprintf(stderr, "\n");
e4618d775e0d Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
686 #endif
e4618d775e0d Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
687
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
688 purple_debug(level, (new_domain != NULL ? new_domain : "g_log"),
7152
112d0e52d04b [gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents: 7150
diff changeset
689 "%s\n", new_msg);
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
690
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
691 g_free(new_msg);
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
692 }
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
693
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 13988
diff changeset
694 g_free(new_domain);
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
695 }
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
696
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
697 #ifdef _WIN32
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
698 static void
15880
d275b025481c More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
699 pidgin_glib_dummy_print_handler(const gchar *string)
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
700 {
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
701 }
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
702 #endif
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
703
5625
ac8c09def58a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
704 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15512
diff changeset
705 pidgin_debug_init(void)
5625
ac8c09def58a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
706 {
5684
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
707 /* Debug window preferences. */
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
708 /*
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
709 * NOTE: This must be set before prefs are loaded, and the callbacks
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
710 * set after they are loaded, since prefs sets the enabled
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
711 * preference here and that loads the window, which calls the
8735
01248ea222d3 [gaim-migrate @ 9490]
Jonathan Champ <royanee@users.sourceforge.net>
parents: 8046
diff changeset
712 * configure event, which overrides the width and height! :P
5684
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
713 */
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
714
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
715 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/debug");
10307
f3ba80364053 [gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents: 10297
diff changeset
716
f3ba80364053 [gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents: 10297
diff changeset
717 /* Controls printing to the debug window */
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
718 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/enabled", FALSE);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
719 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/debug/filterlevel", PURPLE_DEBUG_ALL);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
720 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/debug/style", GTK_TOOLBAR_BOTH_HORIZ);
10307
f3ba80364053 [gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents: 10297
diff changeset
721
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
722 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/toolbar", TRUE);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
723 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/debug/width", 450);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
724 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/debug/height", 250);
5684
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5642
diff changeset
725
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
726 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/debug/regex", "");
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
727 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/filter", FALSE);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
728 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/invert", FALSE);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
729 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/case_insensitive", FALSE);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
730 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/highlight", FALSE);
11256
fe82a0c5e5ec [gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents: 11243
diff changeset
731
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
732 purple_prefs_connect_callback(NULL, PIDGIN_PREFS_ROOT "/debug/enabled",
5794
ebdbb7dc6658 [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5738
diff changeset
733 debug_enabled_cb, NULL);
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
734
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
735 #define REGISTER_G_LOG_HANDLER(name) \
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
736 g_log_set_handler((name), G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL \
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
737 | G_LOG_FLAG_RECURSION, \
15880
d275b025481c More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
738 pidgin_glib_log_handler, NULL)
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
739
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
740 /* Register the glib/gtk log handlers. */
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
741 REGISTER_G_LOG_HANDLER(NULL);
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
742 REGISTER_G_LOG_HANDLER("Gdk");
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
743 REGISTER_G_LOG_HANDLER("Gtk");
7229
0f85b503c030 [gaim-migrate @ 7799]
Herman Bloggs <herman@bluedigits.com>
parents: 7152
diff changeset
744 REGISTER_G_LOG_HANDLER("GdkPixbuf");
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
745 REGISTER_G_LOG_HANDLER("GLib");
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
746 REGISTER_G_LOG_HANDLER("GModule");
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
747 REGISTER_G_LOG_HANDLER("GLib-GObject");
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
748 REGISTER_G_LOG_HANDLER("GThread");
33532
66962f44ff47 Add JSON debug messages to our log
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33501
diff changeset
749 REGISTER_G_LOG_HANDLER("Json");
21743
7a0caaf628ff applied changes from 10f341962a83e2380243c4e44bb685105e3091a2
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
750 #ifdef USE_GSTREAMER
7a0caaf628ff applied changes from 10f341962a83e2380243c4e44bb685105e3091a2
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
751 REGISTER_G_LOG_HANDLER("GStreamer");
7a0caaf628ff applied changes from 10f341962a83e2380243c4e44bb685105e3091a2
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
752 #endif
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
753
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
754 #ifdef _WIN32
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
755 if (!purple_debug_is_enabled())
15880
d275b025481c More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
756 g_set_print_handler(pidgin_glib_dummy_print_handler);
7150
25deb3b41da3 [gaim-migrate @ 7717]
Sean Egan <seanegan@pidgin.im>
parents: 7108
diff changeset
757 #endif
5625
ac8c09def58a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
758 }
ac8c09def58a [gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents: 5535
diff changeset
759
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
760 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15512
diff changeset
761 pidgin_debug_uninit(void)
11033
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
762 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
763 purple_debug_set_ui_ops(NULL);
17232
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
764
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
765 if (debug_enabled_timer != 0)
8593d66c708b When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents: 17040
diff changeset
766 g_source_remove(debug_enabled_timer);
11033
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
767 }
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
768
dc68e074f10d [gaim-migrate @ 12919]
Etan Reisner <deryni@pidgin.im>
parents: 10739
diff changeset
769 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15512
diff changeset
770 pidgin_debug_window_show(void)
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
771 {
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
772 if (debug_win == NULL)
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
773 debug_win = debug_window_new();
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
774
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
775 gtk_widget_show(debug_win->window);
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
776
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
777 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/enabled", TRUE);
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
778 }
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
779
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
780 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15512
diff changeset
781 pidgin_debug_window_hide(void)
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
782 {
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
783 if (debug_win != NULL) {
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
784 gtk_widget_destroy(debug_win->window);
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
785 debug_window_destroy(NULL, NULL, NULL);
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
786 }
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
787 }
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
788
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
789 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
790 pidgin_debug_print(PurpleDebugLevel level, const char *category,
33537
4998e86453d0 GTK debug window: append using js, not html
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33532
diff changeset
791 const char *arg_s)
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
792 {
33537
4998e86453d0 GTK debug window: append using js, not html
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33532
diff changeset
793 gchar *esc_s;
17040
cb33027a36e4 Force timestamps always on for debug log and debug window. Making this
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16752
diff changeset
794 const char *mdate;
cb33027a36e4 Force timestamps always on for debug log and debug window. Making this
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16752
diff changeset
795 time_t mtime;
33537
4998e86453d0 GTK debug window: append using js, not html
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33532
diff changeset
796 gchar *js;
5530
ba1ad464b56f [gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents: 5430
diff changeset
797
33537
4998e86453d0 GTK debug window: append using js, not html
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33532
diff changeset
798 if (debug_win == NULL)
10307
f3ba80364053 [gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents: 10297
diff changeset
799 return;
33537
4998e86453d0 GTK debug window: append using js, not html
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33532
diff changeset
800 if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled"))
4998e86453d0 GTK debug window: append using js, not html
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33532
diff changeset
801 return;
10307
f3ba80364053 [gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents: 10297
diff changeset
802
17040
cb33027a36e4 Force timestamps always on for debug log and debug window. Making this
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16752
diff changeset
803 mtime = time(NULL);
cb33027a36e4 Force timestamps always on for debug log and debug window. Making this
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16752
diff changeset
804 mdate = purple_utf8_strftime("%H:%M:%S", localtime(&mtime));
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
805
33537
4998e86453d0 GTK debug window: append using js, not html
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33532
diff changeset
806 esc_s = purple_escape_js(arg_s);
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
807
33538
cbeb76707f12 Better implementation of purple_escape_js
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33537
diff changeset
808 js = g_strdup_printf("append(%d, '%s', '%s', %s);",
33537
4998e86453d0 GTK debug window: append using js, not html
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33532
diff changeset
809 level, mdate, category ? category : "", esc_s);
10307
f3ba80364053 [gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents: 10297
diff changeset
810 g_free(esc_s);
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
811
35500
ae6432ea326f Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents: 35454
diff changeset
812 pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(debug_win->text), js);
33537
4998e86453d0 GTK debug window: append using js, not html
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33532
diff changeset
813 g_free(js);
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
814 }
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
815
16044
257072807aa8 Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <markdoliner@pidgin.im>
parents: 15931
diff changeset
816 static gboolean
257072807aa8 Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <markdoliner@pidgin.im>
parents: 15931
diff changeset
817 pidgin_debug_is_enabled(PurpleDebugLevel level, const char *category)
257072807aa8 Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <markdoliner@pidgin.im>
parents: 15931
diff changeset
818 {
16045
d9add5eda4cd Check if debug_win is != NULL before checking the preference. This
Mark Doliner <markdoliner@pidgin.im>
parents: 16044
diff changeset
819 return (debug_win != NULL &&
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16045
diff changeset
820 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled"));
16044
257072807aa8 Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <markdoliner@pidgin.im>
parents: 15931
diff changeset
821 }
257072807aa8 Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <markdoliner@pidgin.im>
parents: 15931
diff changeset
822
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
823 static PurpleDebugUiOps ops =
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
824 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15512
diff changeset
825 pidgin_debug_print,
16752
e6bcb1628c57 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
826 pidgin_debug_is_enabled,
e6bcb1628c57 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
827 NULL,
e6bcb1628c57 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
828 NULL,
e6bcb1628c57 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
829 NULL,
e6bcb1628c57 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16490
diff changeset
830 NULL
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
831 };
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
832
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
833 PurpleDebugUiOps *
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15512
diff changeset
834 pidgin_debug_get_ui_ops(void)
5212
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
835 {
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
836 return &ops;
ad90ea13028b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
837 }
10087
e5b80a38939d [gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9791
diff changeset
838
e5b80a38939d [gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9791
diff changeset
839 void *
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15512
diff changeset
840 pidgin_debug_get_handle() {
10087
e5b80a38939d [gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9791
diff changeset
841 static int handle;
e5b80a38939d [gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9791
diff changeset
842
e5b80a38939d [gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9791
diff changeset
843 return &handle;
e5b80a38939d [gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9791
diff changeset
844 }
33095
1e0b4fac0fed Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33094
diff changeset
845

mercurial