Fri, 22 Sep 2017 03:44:07 +0000
Merged in qulogic/pidgin (pull request #258)
Avoid using deprecated menu popup functions
Approved-by: Gary Kramlich <grim@reaperworld.com>
Approved-by: Eion Robb <eionrobb@gmail.com>
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
1 | /* pidgin |
| 5212 | 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 | 4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 5 | * source distribution. | |
|
7152
112d0e52d04b
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
6 | * |
| 5212 | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by | |
| 9 | * the Free Software Foundation; either version 2 of the License, or | |
| 10 | * (at your option) any later version. | |
| 11 | * | |
| 12 | * This program is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 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 | 20 | */ |
| 9791 | 21 | #include "internal.h" |
| 15577 | 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 | 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 | 29 | #include "gtkdebug.h" |
|
9709
2e73f176cc80
[gaim-migrate @ 10570]
Mark Doliner <markdoliner@pidgin.im>
parents:
9504
diff
changeset
|
30 | #include "gtkdialogs.h" |
| 8953 | 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 | |
|
38659
7772f66662f0
Lots of tweaking/wiring
Gary Kramlich <grim@reaperworld.com>
parents:
38658
diff
changeset
|
43 | #include "pidginresources.h" |
|
33922
61f997b47954
Split debug window HTML into a separate file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33921
diff
changeset
|
44 | |
| 5212 | 45 | typedef struct |
| 46 | { | |
| 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 | 52 | |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
53 | gboolean paused; |
| 5212 | 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 | 59 | } DebugWindow; |
| 60 | ||
| 61 | static DebugWindow *debug_win = NULL; | |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
62 | |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
63 | struct _PidginDebugUi |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
64 | { |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
65 | GObject parent; |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
66 | |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
67 | /* Other members, including private data. */ |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
68 | guint debug_enabled_timer; |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
69 | }; |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
70 | |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
71 | static void pidgin_debug_ui_finalize(GObject *gobject); |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
72 | static void pidgin_debug_ui_interface_init(PurpleDebugUiInterface *iface); |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
73 | |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
74 | G_DEFINE_TYPE_WITH_CODE(PidginDebugUi, pidgin_debug_ui, G_TYPE_OBJECT, |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
75 | G_IMPLEMENT_INTERFACE(PURPLE_TYPE_DEBUG_UI, |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
76 | pidgin_debug_ui_interface_init)); |
| 5212 | 77 | |
| 78 | static gint | |
| 79 | debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused) | |
| 80 | { | |
| 15884 | 81 | purple_prefs_disconnect_by_handle(pidgin_debug_get_handle()); |
|
9502
d43f69354213
[gaim-migrate @ 10329]
Mark Doliner <markdoliner@pidgin.im>
parents:
9501
diff
changeset
|
82 | |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
83 | if(debug_win->timer != 0) { |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
84 | const gchar *text; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
85 | |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38378
diff
changeset
|
86 | g_source_remove(debug_win->timer); |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
87 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
88 | 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
|
89 | purple_prefs_set_string(PIDGIN_PREFS_ROOT "/debug/regex", text); |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
90 | } |
|
33539
12e93808f35d
Fix some warnings in debug and conv windows
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33538
diff
changeset
|
91 | if (debug_win->regex != NULL) |
|
12e93808f35d
Fix some warnings in debug and conv windows
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33538
diff
changeset
|
92 | g_regex_unref(debug_win->regex); |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
93 | |
|
9502
d43f69354213
[gaim-migrate @ 10329]
Mark Doliner <markdoliner@pidgin.im>
parents:
9501
diff
changeset
|
94 | /* If the "Save Log" dialog is open then close it */ |
| 15884 | 95 | purple_request_close_with_handle(debug_win); |
|
5704
3170b0bd2b40
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
96 | |
| 5212 | 97 | g_free(debug_win); |
| 98 | debug_win = NULL; | |
| 99 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16045
diff
changeset
|
100 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/enabled", FALSE); |
|
9480
b4d46aa1be7d
[gaim-migrate @ 10305]
Mark Doliner <markdoliner@pidgin.im>
parents:
8953
diff
changeset
|
101 | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
102 | return FALSE; |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
103 | } |
| 5212 | 104 | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
105 | static gboolean |
|
5794
ebdbb7dc6658
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
106 | configure_cb(GtkWidget *w, GdkEventConfigure *event, DebugWindow *win) |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
107 | { |
|
32913
af2c726febce
Fix all deprecated GTK_WIDGET_* macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32912
diff
changeset
|
108 | 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
|
109 | 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
|
110 | 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
|
111 | } |
| 5212 | 112 | |
| 113 | return FALSE; | |
| 114 | } | |
| 115 | ||
| 8953 | 116 | static void |
|
9502
d43f69354213
[gaim-migrate @ 10329]
Mark Doliner <markdoliner@pidgin.im>
parents:
9501
diff
changeset
|
117 | save_writefile_cb(void *user_data, const char *filename) |
| 8953 | 118 | { |
|
9502
d43f69354213
[gaim-migrate @ 10329]
Mark Doliner <markdoliner@pidgin.im>
parents:
9501
diff
changeset
|
119 | DebugWindow *win = (DebugWindow *)user_data; |
|
9489
3ee8fdcdbac9
[gaim-migrate @ 10314]
Mark Doliner <markdoliner@pidgin.im>
parents:
9486
diff
changeset
|
120 | FILE *fp; |
| 8953 | 121 | char *tmp; |
| 122 | ||
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10448
diff
changeset
|
123 | 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
|
124 | purple_notify_error(win, NULL, _("Unable to open file."), NULL, NULL); |
| 8953 | 125 | return; |
|
9480
b4d46aa1be7d
[gaim-migrate @ 10305]
Mark Doliner <markdoliner@pidgin.im>
parents:
8953
diff
changeset
|
126 | } |
| 8953 | 127 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
128 | tmp = pidgin_webview_get_body_text(PIDGIN_WEBVIEW(win->text)); |
| 15884 | 129 | fprintf(fp, "Pidgin Debug Log : %s\n", purple_date_format_full(NULL)); |
| 8953 | 130 | fprintf(fp, "%s", tmp); |
| 131 | g_free(tmp); | |
| 132 | ||
| 133 | fclose(fp); | |
| 134 | } | |
| 135 | ||
| 136 | static void | |
| 137 | save_cb(GtkWidget *w, DebugWindow *win) | |
| 138 | { | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
139 | 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
|
140 | G_CALLBACK(save_writefile_cb), NULL, NULL, win); |
| 8953 | 141 | } |
| 142 | ||
| 143 | static void | |
|
5794
ebdbb7dc6658
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
144 | clear_cb(GtkWidget *w, DebugWindow *win) |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
145 | { |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
146 | pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(win->text), "clear();"); |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
147 | } |
|
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
148 | |
|
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
149 | static void |
|
5794
ebdbb7dc6658
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
150 | pause_cb(GtkWidget *w, DebugWindow *win) |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
151 | { |
|
29746
f7a7722bee2f
Remove GTK_CHECK_VERSION(2,4,0) checks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29745
diff
changeset
|
152 | 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
|
153 | |
|
33920
6a4eaacdd207
Rewrite debug window pausing in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33919
diff
changeset
|
154 | if (win->paused) |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
155 | 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
|
156 | else |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
157 | pidgin_webview_safe_execute_script(PIDGIN_WEBVIEW(win->text), "resumeOutput();"); |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
158 | } |
|
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
159 | |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
160 | /****************************************************************************** |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
161 | * regex stuff |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
162 | *****************************************************************************/ |
| 11033 | 163 | static void |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
164 | 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
|
165 | 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
|
166 | 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
|
167 | gtk_style_context_remove_class(context, "bad-filter"); |
|
11256
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 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
170 | static void |
|
33924
788678d2e035
Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33923
diff
changeset
|
171 | 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
|
172 | GtkStyleContext *context = gtk_widget_get_style_context(w); |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
173 | |
|
33924
788678d2e035
Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33923
diff
changeset
|
174 | if (success) { |
|
788678d2e035
Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33923
diff
changeset
|
175 | 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
|
176 | 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
|
177 | } else { |
|
788678d2e035
Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33923
diff
changeset
|
178 | 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
|
179 | 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
|
180 | } |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
181 | } |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
182 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
183 | static void |
|
33095
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
184 | regex_toggle_filter(DebugWindow *win, gboolean filter) |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
185 | { |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
186 | 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
|
187 | |
|
33095
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
188 | if (filter) { |
|
33923
0fcc5635daba
Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33922
diff
changeset
|
189 | const char *text; |
|
0fcc5635daba
Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33922
diff
changeset
|
190 | char *regex; |
|
0fcc5635daba
Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33922
diff
changeset
|
191 | char *script; |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
192 | |
|
33923
0fcc5635daba
Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33922
diff
changeset
|
193 | 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
|
194 | 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
|
195 | 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
|
196 | regex, |
|
0fcc5635daba
Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33922
diff
changeset
|
197 | win->invert ? "true" : "false", |
|
0fcc5635daba
Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33922
diff
changeset
|
198 | win->highlight ? "true" : "false"); |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
199 | 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
|
200 | g_free(script); |
|
0fcc5635daba
Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33922
diff
changeset
|
201 | g_free(regex); |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
202 | } |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
203 | } |
|
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 | static void |
| 15884 | 206 | regex_pref_filter_cb(const gchar *name, PurplePrefType type, |
|
12816
5f93e09fa9a6
[gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents:
12231
diff
changeset
|
207 | gconstpointer val, gpointer data) |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
208 | { |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
209 | DebugWindow *win = (DebugWindow *)data; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
210 | gboolean active = GPOINTER_TO_INT(val), current; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
211 | |
|
33095
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
212 | if (!win || !win->window) |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
213 | return; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
214 | |
|
29746
f7a7722bee2f
Remove GTK_CHECK_VERSION(2,4,0) checks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29745
diff
changeset
|
215 | 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
|
216 | if (active != current) |
|
29746
f7a7722bee2f
Remove GTK_CHECK_VERSION(2,4,0) checks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29745
diff
changeset
|
217 | 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
|
218 | } |
|
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 | static void |
| 15884 | 221 | regex_pref_expression_cb(const gchar *name, PurplePrefType type, |
|
12816
5f93e09fa9a6
[gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents:
12231
diff
changeset
|
222 | gconstpointer val, gpointer data) |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
223 | { |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
224 | DebugWindow *win = (DebugWindow *)data; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
225 | const gchar *exp = (const gchar *)val; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
226 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
227 | gtk_entry_set_text(GTK_ENTRY(win->expression), exp); |
|
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 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
230 | static void |
| 15884 | 231 | regex_pref_invert_cb(const gchar *name, PurplePrefType type, |
|
12816
5f93e09fa9a6
[gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents:
12231
diff
changeset
|
232 | gconstpointer val, gpointer data) |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
233 | { |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
234 | DebugWindow *win = (DebugWindow *)data; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
235 | gboolean active = GPOINTER_TO_INT(val); |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
236 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
237 | win->invert = active; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
238 | |
|
33095
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
239 | 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
|
240 | regex_toggle_filter(win, TRUE); |
|
11256
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 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
243 | static void |
| 15884 | 244 | regex_pref_highlight_cb(const gchar *name, PurplePrefType type, |
|
12816
5f93e09fa9a6
[gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents:
12231
diff
changeset
|
245 | gconstpointer val, gpointer data) |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
246 | { |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
247 | DebugWindow *win = (DebugWindow *)data; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
248 | gboolean active = GPOINTER_TO_INT(val); |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
249 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
250 | win->highlight = active; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
251 | |
|
33095
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
252 | 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
|
253 | regex_toggle_filter(win, TRUE); |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
254 | } |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
255 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
256 | static gboolean |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
257 | regex_timer_cb(DebugWindow *win) { |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
258 | const gchar *text; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
259 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
260 | 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
|
261 | purple_prefs_set_string(PIDGIN_PREFS_ROOT "/debug/regex", text); |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
262 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
263 | win->timer = 0; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
264 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
265 | return FALSE; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
266 | } |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
267 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
268 | static void |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
269 | 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
|
270 | const gchar *text; |
|
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
271 | |
|
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
272 | 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
|
273 | 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
|
274 | FALSE); |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
275 | } |
| 11033 | 276 | |
|
33095
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
277 | if (win->timer == 0) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38378
diff
changeset
|
278 | 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
|
279 | |
|
33095
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
280 | 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
|
281 | |
|
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
282 | if (text == NULL || *text == '\0') { |
|
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
283 | regex_clear_color(win->expression); |
|
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
284 | 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
|
285 | return; |
|
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
286 | } |
|
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
287 | |
|
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
288 | if (win->regex) |
|
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
289 | g_regex_unref(win->regex); |
|
38045
6e8b223df524
Remove GLIB_CHECK_VERSION <= 2.36 calls
Mike Ruprecht <cmaiku@gmail.com>
parents:
37422
diff
changeset
|
290 | |
|
33923
0fcc5635daba
Rewrite debug window filter in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33922
diff
changeset
|
291 | 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
|
292 | |
|
33095
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
293 | if (win->regex == NULL) { |
|
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
294 | /* 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
|
295 | 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
|
296 | 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
|
297 | } else { |
|
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
298 | /* compiled successfully */ |
|
33924
788678d2e035
Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33923
diff
changeset
|
299 | 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
|
300 | 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
|
301 | } |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
302 | } |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
303 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
304 | static void |
|
11450
52e566659430
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
305 | 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
|
306 | 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
|
307 | 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
|
308 | 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
|
309 | !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
|
310 | { |
|
3ee545012e46
Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35633
diff
changeset
|
311 | 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
|
312 | } |
|
3ee545012e46
Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35633
diff
changeset
|
313 | 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
|
314 | 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
|
315 | { |
|
3ee545012e46
Make keypad Enter enable, and Escape disable, debug filtering.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35633
diff
changeset
|
316 | 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
|
317 | } |
|
11450
52e566659430
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
318 | } |
|
52e566659430
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
319 | } |
|
52e566659430
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
320 | |
|
52e566659430
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
321 | static void |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
322 | regex_menu_cb(GtkWidget *item, const gchar *pref) { |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
323 | gboolean active; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
324 | |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
325 | 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
|
326 | |
| 15884 | 327 | purple_prefs_set_bool(pref, active); |
| 11033 | 328 | } |
| 329 | ||
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
330 | static void |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
331 | regex_popup_cb(GtkEntry *entry, GtkWidget *menu, DebugWindow *win) { |
| 15568 | 332 | pidgin_separator(menu); |
| 333 | pidgin_new_check_item(menu, _("Invert"), | |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
334 | 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
|
335 | PIDGIN_PREFS_ROOT "/debug/invert", win->invert); |
| 15568 | 336 | pidgin_new_check_item(menu, _("Highlight matches"), |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
337 | 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
|
338 | PIDGIN_PREFS_ROOT "/debug/highlight", win->highlight); |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
339 | } |
|
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 | static void |
|
33095
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
342 | 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
|
343 | { |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
344 | gboolean active; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
345 | |
|
29746
f7a7722bee2f
Remove GTK_CHECK_VERSION(2,4,0) checks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29745
diff
changeset
|
346 | active = gtk_toggle_tool_button_get_active(button); |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
347 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16045
diff
changeset
|
348 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/filter", active); |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
349 | |
|
35506
4252b2882889
Fix some remaining GTK_* macros as Elliott noticed
Ankit Vani <a@nevitus.org>
parents:
35500
diff
changeset
|
350 | if (!PIDGIN_IS_WEBVIEW(win->text)) |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
351 | return; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
352 | |
|
33095
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
353 | regex_toggle_filter(win, active); |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
354 | } |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
355 | |
|
14541
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
356 | static void |
| 15884 | 357 | 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
|
358 | { |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
359 | DebugWindow *win = data; |
|
33095
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
360 | 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
|
361 | char *tmp; |
|
14541
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
362 | |
|
33095
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
363 | 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
|
364 | 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
|
365 | |
|
33921
d1e2fdbc3d56
Rewrite debug window filtering in JS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33920
diff
changeset
|
366 | tmp = g_strdup_printf("setFilterLevel('%d');", level); |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
367 | 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
|
368 | g_free(tmp); |
|
14541
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
369 | } |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
370 | |
|
14541
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
371 | static void |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
372 | filter_level_changed_cb(GtkWidget *combo, gpointer null) |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
373 | { |
|
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/filterlevel", |
|
14541
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
375 | gtk_combo_box_get_active(GTK_COMBO_BOX(combo))); |
|
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 | |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
378 | static void |
| 15884 | 379 | 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
|
380 | { |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
381 | 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
|
382 | } |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
383 | |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
384 | static void |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
385 | toolbar_icon_pref_changed(GtkWidget *item, GtkWidget *toolbar) |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
386 | { |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
387 | 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
|
388 | 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
|
389 | } |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
390 | |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
391 | static gboolean |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
392 | toolbar_context(GtkWidget *toolbar, GdkEventButton *event, gpointer null) |
|
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 | GtkWidget *menu, *item; |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
395 | const char *text[3]; |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
396 | GtkToolbarStyle value[3]; |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
397 | int i; |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
398 | |
|
38705
62a7a975251a
Use gdk_event_triggers_context_menu.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38645
diff
changeset
|
399 | if (!gdk_event_triggers_context_menu((GdkEvent *)event)) |
|
14541
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
400 | return FALSE; |
|
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 | text[0] = _("_Icon Only"); value[0] = GTK_TOOLBAR_ICONS; |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
403 | text[1] = _("_Text Only"); value[1] = GTK_TOOLBAR_TEXT; |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
404 | 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
|
405 | |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
406 | menu = gtk_menu_new(); |
|
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 | for (i = 0; i < 3; i++) { |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
409 | item = gtk_check_menu_item_new_with_mnemonic(text[i]); |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
410 | 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
|
411 | 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
|
412 | 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
|
413 | 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
|
414 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
415 | } |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
416 | |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
417 | gtk_widget_show_all(menu); |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
418 | |
|
38707
6f4d3ab2f2ed
Use gtk_menu_popup_at_pointer instead of gtk_menu_popup.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38705
diff
changeset
|
419 | gtk_menu_popup_at_pointer(GTK_MENU(menu), (GdkEvent *)event); |
|
14541
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
420 | return FALSE; |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
421 | } |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
422 | |
| 5212 | 423 | static DebugWindow * |
| 424 | debug_window_new(void) | |
| 425 | { | |
|
38376
d27109ba6626
Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38045
diff
changeset
|
426 | GError *error; |
| 5212 | 427 | DebugWindow *win; |
|
38376
d27109ba6626
Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38045
diff
changeset
|
428 | GResource *resource; |
|
d27109ba6626
Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38045
diff
changeset
|
429 | GBytes *resource_bytes; |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
430 | GtkWidget *vbox; |
|
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
431 | GtkWidget *toolbar; |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10087
diff
changeset
|
432 | GtkWidget *frame; |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
433 | gint width, height; |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
434 | void *handle; |
|
29745
ebf70b1934f1
New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29694
diff
changeset
|
435 | GtkToolItem *item; |
|
33924
788678d2e035
Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33923
diff
changeset
|
436 | GtkStyleContext *context; |
|
788678d2e035
Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33923
diff
changeset
|
437 | GtkCssProvider *filter_css; |
|
788678d2e035
Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33923
diff
changeset
|
438 | 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
|
439 | ".bad-filter {" |
|
788678d2e035
Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33923
diff
changeset
|
440 | "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
|
441 | "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
|
442 | "background-image: none;" |
|
788678d2e035
Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33923
diff
changeset
|
443 | "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
|
444 | "}" |
|
788678d2e035
Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33923
diff
changeset
|
445 | ".good-filter {" |
|
788678d2e035
Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33923
diff
changeset
|
446 | "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
|
447 | "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
|
448 | "background-image: none;" |
|
788678d2e035
Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33923
diff
changeset
|
449 | "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
|
450 | "}"; |
| 5212 | 451 | |
| 452 | win = g_new0(DebugWindow, 1); | |
| 453 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16045
diff
changeset
|
454 | 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
|
455 | height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/height"); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
456 | |
|
29321
c089a3e0092e
De-dialogify the file-transfer and debug windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29287
diff
changeset
|
457 | win->window = pidgin_create_window(_("Debug Window"), 0, "debug", TRUE); |
| 15884 | 458 | purple_debug_info("gtkdebug", "Setting dimensions to %d, %d\n", |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
459 | width, height); |
|
5642
d7b8b62542a3
[gaim-migrate @ 6056]
Christian Hammond <chipx86@chipx86.com>
parents:
5636
diff
changeset
|
460 | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
461 | gtk_window_set_default_size(GTK_WINDOW(win->window), width, height); |
| 5212 | 462 | |
| 463 | g_signal_connect(G_OBJECT(win->window), "delete_event", | |
| 11033 | 464 | G_CALLBACK(debug_window_destroy), NULL); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
465 | g_signal_connect(G_OBJECT(win->window), "configure_event", |
| 11033 | 466 | G_CALLBACK(configure_cb), win); |
| 5212 | 467 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15512
diff
changeset
|
468 | 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
|
469 | |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
470 | /* Setup the vbox */ |
|
35527
707c3c2b2c8a
Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35506
diff
changeset
|
471 | 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
|
472 | gtk_container_add(GTK_CONTAINER(win->window), vbox); |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
473 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16045
diff
changeset
|
474 | if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/toolbar")) { |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
475 | /* Setup our top button bar thingie. */ |
|
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
476 | toolbar = gtk_toolbar_new(); |
|
14541
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
477 | gtk_toolbar_set_show_arrow(GTK_TOOLBAR(toolbar), TRUE); |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
478 | 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
|
479 | |
| 11033 | 480 | 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
|
481 | 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
|
482 | 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
|
483 | toolbar_style_pref_changed_cb, toolbar); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
484 | gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar), |
| 11033 | 485 | GTK_ICON_SIZE_SMALL_TOOLBAR); |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
486 | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
487 | 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
|
488 | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
489 | /* Save */ |
|
29745
ebf70b1934f1
New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29694
diff
changeset
|
490 | 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
|
491 | 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
|
492 | 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
|
493 | 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
|
494 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
495 | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
496 | /* Clear button */ |
|
29745
ebf70b1934f1
New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29694
diff
changeset
|
497 | 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
|
498 | 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
|
499 | 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
|
500 | 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
|
501 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
502 | |
|
29745
ebf70b1934f1
New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29694
diff
changeset
|
503 | 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
|
504 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
505 | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
506 | /* Pause */ |
|
29745
ebf70b1934f1
New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29694
diff
changeset
|
507 | 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
|
508 | 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
|
509 | 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
|
510 | 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
|
511 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
512 | |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
513 | /* regex stuff */ |
|
29745
ebf70b1934f1
New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29694
diff
changeset
|
514 | 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
|
515 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
| 11033 | 516 | |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
517 | /* 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
|
518 | 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
|
519 | 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
|
520 | 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
|
521 | 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
|
522 | 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
|
523 | 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
|
524 | 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
|
525 | |
|
11450
52e566659430
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
526 | /* we purposely disable the toggle button here in case |
| 15884 | 527 | * /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
|
528 | * 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
|
529 | * toggle button sensitive. |
|
52e566659430
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
530 | */ |
|
52e566659430
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
531 | 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
|
532 | 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
|
533 | 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
|
534 | purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/filter", |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
535 | regex_pref_filter_cb, win); |
| 8953 | 536 | |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
537 | /* regex entry */ |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
538 | 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
|
539 | item = gtk_tool_item_new(); |
|
ebf70b1934f1
New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29694
diff
changeset
|
540 | 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
|
541 | 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
|
542 | 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
|
543 | |
|
33924
788678d2e035
Fix background change in IP and debug filter entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33923
diff
changeset
|
544 | 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
|
545 | 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
|
546 | 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
|
547 | 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
|
548 | 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
|
549 | 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
|
550 | |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
551 | /* 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
|
552 | * to colorize a stored expression. |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
553 | */ |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
554 | g_signal_connect(G_OBJECT(win->expression), "changed", |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
555 | G_CALLBACK(regex_changed_cb), win); |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
556 | 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
|
557 | purple_prefs_get_string(PIDGIN_PREFS_ROOT "/debug/regex")); |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
558 | g_signal_connect(G_OBJECT(win->expression), "populate-popup", |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
559 | G_CALLBACK(regex_popup_cb), win); |
|
11450
52e566659430
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
560 | g_signal_connect(G_OBJECT(win->expression), "key-release-event", |
|
52e566659430
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
561 | 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
|
562 | purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/regex", |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
563 | regex_pref_expression_cb, win); |
| 11033 | 564 | |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
565 | /* 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
|
566 | 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
|
567 | purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/invert", |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
568 | regex_pref_invert_cb, win); |
| 11033 | 569 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16045
diff
changeset
|
570 | 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
|
571 | purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/highlight", |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
572 | regex_pref_highlight_cb, win); |
|
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
573 | |
|
29745
ebf70b1934f1
New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29694
diff
changeset
|
574 | 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
|
575 | gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); |
|
14541
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
576 | |
|
29745
ebf70b1934f1
New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29694
diff
changeset
|
577 | item = gtk_tool_item_new(); |
|
ebf70b1934f1
New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29694
diff
changeset
|
578 | 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
|
579 | 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
|
580 | |
|
33133
9a31f084f259
Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33132
diff
changeset
|
581 | 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
|
582 | item = gtk_tool_item_new(); |
|
ebf70b1934f1
New-fangled toolbar code and all that.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
29694
diff
changeset
|
583 | 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
|
584 | 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
|
585 | 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
|
586 | |
|
33133
9a31f084f259
Fix some merge errors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33132
diff
changeset
|
587 | 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
|
588 | 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
|
589 | 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
|
590 | 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
|
591 | 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
|
592 | 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
|
593 | 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
|
594 | 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
|
595 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16045
diff
changeset
|
596 | 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
|
597 | filter_level_pref_changed, win); |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
598 | g_signal_connect(G_OBJECT(win->filterlevel), "changed", |
|
b4b96a041230
[gaim-migrate @ 17198]
Peter McCurdy <cpirate@users.sourceforge.net>
parents:
14253
diff
changeset
|
599 | G_CALLBACK(filter_level_changed_cb), NULL); |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
600 | } |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
601 | |
|
33095
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
602 | /* Add the gtkwebview */ |
|
34274
9169710b5af5
Hide GtkWebViewToolbar stuff within the GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33934
diff
changeset
|
603 | frame = pidgin_create_webview(FALSE, &win->text, NULL); |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
604 | pidgin_webview_set_format_functions(PIDGIN_WEBVIEW(win->text), |
|
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
605 | 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
|
606 | resource = pidgin_get_resource(); |
|
38376
d27109ba6626
Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38045
diff
changeset
|
607 | error = NULL; |
|
d27109ba6626
Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38045
diff
changeset
|
608 | resource_bytes = g_resource_lookup_data(resource, |
|
38658
f3db8eafde9e
re-namespace the gtkdebug.html resource
Gary Kramlich <grim@reaperworld.com>
parents:
38433
diff
changeset
|
609 | "/im/pidgin/Pidgin/Debug/gtkdebug.html", |
|
38377
88e5bd05a57c
Fix small GResource bugs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38376
diff
changeset
|
610 | G_RESOURCE_LOOKUP_FLAGS_NONE, |
|
88e5bd05a57c
Fix small GResource bugs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38376
diff
changeset
|
611 | &error); |
|
38376
d27109ba6626
Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38045
diff
changeset
|
612 | 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
|
613 | 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
|
614 | error ? error->message : "Unknown error"); |
|
d27109ba6626
Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38045
diff
changeset
|
615 | g_clear_error(&error); |
|
d27109ba6626
Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38045
diff
changeset
|
616 | 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
|
617 | g_free(msg); |
|
d27109ba6626
Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38045
diff
changeset
|
618 | } else { |
|
d27109ba6626
Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38045
diff
changeset
|
619 | gconstpointer gtkdebug_html; |
|
d27109ba6626
Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38045
diff
changeset
|
620 | 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
|
621 | 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
|
622 | gtkdebug_html); |
|
d27109ba6626
Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38045
diff
changeset
|
623 | } |
|
d27109ba6626
Move gtkdebug.html into a GResource.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38045
diff
changeset
|
624 | g_bytes_unref(resource_bytes); |
|
10175
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10087
diff
changeset
|
625 | gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
|
2bf5ed145e8a
[gaim-migrate @ 11290]
Mark Doliner <markdoliner@pidgin.im>
parents:
10087
diff
changeset
|
626 | gtk_widget_show(frame); |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
627 | |
|
33111
e05551721abf
Obey the filter level when the Debug Window is first opened.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33110
diff
changeset
|
628 | clear_cb(NULL, win); |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
629 | |
| 5212 | 630 | gtk_widget_show_all(win->window); |
|
5428
5788d3bc050a
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
631 | |
| 5212 | 632 | return win; |
| 633 | } | |
| 634 | ||
|
17232
8593d66c708b
When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents:
17040
diff
changeset
|
635 | static gboolean |
|
8593d66c708b
When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents:
17040
diff
changeset
|
636 | 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
|
637 | { |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
638 | PidginDebugUi *ui = PIDGIN_DEBUG_UI(data); |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
639 | |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
640 | ui->debug_enabled_timer = 0; |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
641 | |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
642 | pidgin_debug_window_show(); |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
643 | |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
644 | return FALSE; |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
645 | } |
|
17232
8593d66c708b
When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents:
17040
diff
changeset
|
646 | |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
647 | static gboolean |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
648 | debug_disabled_timeout_cb(gpointer data) |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
649 | { |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
650 | PidginDebugUi *ui = PIDGIN_DEBUG_UI(data); |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
651 | |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
652 | ui->debug_enabled_timer = 0; |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
653 | |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
654 | pidgin_debug_window_hide(); |
|
17232
8593d66c708b
When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents:
17040
diff
changeset
|
655 | |
|
8593d66c708b
When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents:
17040
diff
changeset
|
656 | return FALSE; |
|
8593d66c708b
When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents:
17040
diff
changeset
|
657 | } |
|
8593d66c708b
When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents:
17040
diff
changeset
|
658 | |
|
5625
ac8c09def58a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
659 | static void |
| 15884 | 660 | debug_enabled_cb(const char *name, PurplePrefType type, |
|
12816
5f93e09fa9a6
[gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents:
12231
diff
changeset
|
661 | gconstpointer value, gpointer data) |
|
5625
ac8c09def58a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
662 | { |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
663 | PidginDebugUi *ui = PIDGIN_DEBUG_UI(data); |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
664 | |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
665 | if (GPOINTER_TO_INT(value)) |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
666 | ui->debug_enabled_timer = g_timeout_add(0, debug_enabled_timeout_cb, data); |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
667 | else |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
668 | ui->debug_enabled_timer = g_timeout_add(0, debug_disabled_timeout_cb, data); |
|
5625
ac8c09def58a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
669 | } |
|
ac8c09def58a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
670 | |
| 7150 | 671 | static void |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15577
diff
changeset
|
672 | pidgin_glib_log_handler(const gchar *domain, GLogLevelFlags flags, |
| 7150 | 673 | const gchar *msg, gpointer user_data) |
| 674 | { | |
| 15884 | 675 | PurpleDebugLevel level; |
| 7150 | 676 | char *new_msg = NULL; |
| 677 | char *new_domain = NULL; | |
| 678 | ||
|
7152
112d0e52d04b
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
679 | if ((flags & G_LOG_LEVEL_ERROR) == G_LOG_LEVEL_ERROR) |
| 15884 | 680 | level = PURPLE_DEBUG_ERROR; |
|
7152
112d0e52d04b
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
681 | else if ((flags & G_LOG_LEVEL_CRITICAL) == G_LOG_LEVEL_CRITICAL) |
| 15884 | 682 | level = PURPLE_DEBUG_FATAL; |
|
7152
112d0e52d04b
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
683 | else if ((flags & G_LOG_LEVEL_WARNING) == G_LOG_LEVEL_WARNING) |
| 15884 | 684 | level = PURPLE_DEBUG_WARNING; |
|
7152
112d0e52d04b
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
685 | else if ((flags & G_LOG_LEVEL_MESSAGE) == G_LOG_LEVEL_MESSAGE) |
| 15884 | 686 | level = PURPLE_DEBUG_INFO; |
|
7152
112d0e52d04b
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
687 | else if ((flags & G_LOG_LEVEL_INFO) == G_LOG_LEVEL_INFO) |
| 15884 | 688 | level = PURPLE_DEBUG_INFO; |
|
7152
112d0e52d04b
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
689 | else if ((flags & G_LOG_LEVEL_DEBUG) == G_LOG_LEVEL_DEBUG) |
| 15884 | 690 | level = PURPLE_DEBUG_MISC; |
|
7152
112d0e52d04b
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
691 | else |
|
112d0e52d04b
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
692 | { |
| 15884 | 693 | purple_debug_warning("gtkdebug", |
| 7150 | 694 | "Unknown glib logging level in %d\n", flags); |
| 695 | ||
| 15884 | 696 | level = PURPLE_DEBUG_MISC; /* This will never happen. */ |
| 7150 | 697 | } |
| 698 | ||
| 699 | if (msg != NULL) | |
| 15884 | 700 | new_msg = purple_utf8_try_convert(msg); |
| 7150 | 701 | |
| 702 | if (domain != NULL) | |
| 15884 | 703 | new_domain = purple_utf8_try_convert(domain); |
| 7150 | 704 | |
|
7152
112d0e52d04b
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
705 | if (new_msg != NULL) |
|
112d0e52d04b
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
706 | { |
|
35633
e4618d775e0d
Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
707 | #ifdef ENABLE_GLIBTRACE |
|
e4618d775e0d
Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
708 | void *bt_buff[20]; |
|
e4618d775e0d
Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
709 | size_t bt_size; |
|
e4618d775e0d
Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
710 | |
|
e4618d775e0d
Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
711 | bt_size = backtrace(bt_buff, 20); |
|
e4618d775e0d
Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
712 | 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
|
713 | new_domain != NULL ? new_domain : "g_log"); |
|
e4618d775e0d
Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
714 | 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
|
715 | fprintf(stderr, "\n"); |
|
e4618d775e0d
Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
716 | #endif |
|
e4618d775e0d
Add --enable-glib-errors-trace configure switch
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35527
diff
changeset
|
717 | |
| 15884 | 718 | purple_debug(level, (new_domain != NULL ? new_domain : "g_log"), |
|
7152
112d0e52d04b
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
719 | "%s\n", new_msg); |
| 7150 | 720 | |
| 721 | g_free(new_msg); | |
| 722 | } | |
| 723 | ||
|
14097
0c340861ab79
[gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents:
13988
diff
changeset
|
724 | g_free(new_domain); |
| 7150 | 725 | } |
| 726 | ||
| 727 | #ifdef _WIN32 | |
| 728 | static void | |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15577
diff
changeset
|
729 | pidgin_glib_dummy_print_handler(const gchar *string) |
| 7150 | 730 | { |
| 731 | } | |
| 732 | #endif | |
| 733 | ||
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
734 | static void |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
735 | pidgin_debug_ui_init(PidginDebugUi *self) |
|
5625
ac8c09def58a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
736 | { |
| 5684 | 737 | /* Debug window preferences. */ |
| 738 | /* | |
| 739 | * NOTE: This must be set before prefs are loaded, and the callbacks | |
| 740 | * set after they are loaded, since prefs sets the enabled | |
| 741 | * 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
|
742 | * configure event, which overrides the width and height! :P |
| 5684 | 743 | */ |
| 744 | ||
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16045
diff
changeset
|
745 | purple_prefs_add_none(PIDGIN_PREFS_ROOT "/debug"); |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
746 | |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
747 | /* 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
|
748 | 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
|
749 | 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
|
750 | 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
|
751 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16045
diff
changeset
|
752 | 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
|
753 | 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
|
754 | purple_prefs_add_int(PIDGIN_PREFS_ROOT "/debug/height", 250); |
| 5684 | 755 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16045
diff
changeset
|
756 | 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
|
757 | 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
|
758 | 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
|
759 | 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
|
760 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/debug/highlight", FALSE); |
|
11256
fe82a0c5e5ec
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
761 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16045
diff
changeset
|
762 | purple_prefs_connect_callback(NULL, PIDGIN_PREFS_ROOT "/debug/enabled", |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
763 | debug_enabled_cb, self); |
| 7150 | 764 | |
| 765 | #define REGISTER_G_LOG_HANDLER(name) \ | |
| 766 | g_log_set_handler((name), G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL \ | |
| 767 | | G_LOG_FLAG_RECURSION, \ | |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15577
diff
changeset
|
768 | pidgin_glib_log_handler, NULL) |
| 7150 | 769 | |
| 770 | /* Register the glib/gtk log handlers. */ | |
| 771 | REGISTER_G_LOG_HANDLER(NULL); | |
| 772 | REGISTER_G_LOG_HANDLER("Gdk"); | |
| 773 | REGISTER_G_LOG_HANDLER("Gtk"); | |
|
7229
0f85b503c030
[gaim-migrate @ 7799]
Herman Bloggs <herman@bluedigits.com>
parents:
7152
diff
changeset
|
774 | REGISTER_G_LOG_HANDLER("GdkPixbuf"); |
| 7150 | 775 | REGISTER_G_LOG_HANDLER("GLib"); |
| 776 | REGISTER_G_LOG_HANDLER("GModule"); | |
| 777 | REGISTER_G_LOG_HANDLER("GLib-GObject"); | |
| 778 | REGISTER_G_LOG_HANDLER("GThread"); | |
|
33532
66962f44ff47
Add JSON debug messages to our log
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33501
diff
changeset
|
779 | REGISTER_G_LOG_HANDLER("Json"); |
|
21743
7a0caaf628ff
applied changes from 10f341962a83e2380243c4e44bb685105e3091a2
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
780 | #ifdef USE_GSTREAMER |
|
7a0caaf628ff
applied changes from 10f341962a83e2380243c4e44bb685105e3091a2
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
781 | REGISTER_G_LOG_HANDLER("GStreamer"); |
|
7a0caaf628ff
applied changes from 10f341962a83e2380243c4e44bb685105e3091a2
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
782 | #endif |
| 7150 | 783 | |
| 784 | #ifdef _WIN32 | |
| 15884 | 785 | if (!purple_debug_is_enabled()) |
|
15880
d275b025481c
More Gaim to Pidgin changes
Sean Egan <seanegan@pidgin.im>
parents:
15577
diff
changeset
|
786 | g_set_print_handler(pidgin_glib_dummy_print_handler); |
| 7150 | 787 | #endif |
|
5625
ac8c09def58a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
788 | } |
|
ac8c09def58a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
789 | |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
790 | static void |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
791 | pidgin_debug_ui_finalize(GObject *gobject) |
| 11033 | 792 | { |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
793 | PidginDebugUi *self = PIDGIN_DEBUG_UI(gobject); |
|
17232
8593d66c708b
When the /pidgin/debug/enabled pref is toggled, wait until the next
Mark Doliner <markdoliner@pidgin.im>
parents:
17040
diff
changeset
|
794 | |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
795 | if (self->debug_enabled_timer != 0) |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
796 | g_source_remove(self->debug_enabled_timer); |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
797 | self->debug_enabled_timer = 0; |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
798 | |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
799 | G_OBJECT_CLASS(pidgin_debug_ui_parent_class)->finalize(gobject); |
| 11033 | 800 | } |
| 801 | ||
| 802 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15512
diff
changeset
|
803 | pidgin_debug_window_show(void) |
| 5212 | 804 | { |
| 805 | if (debug_win == NULL) | |
| 806 | debug_win = debug_window_new(); | |
| 807 | ||
| 808 | gtk_widget_show(debug_win->window); | |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
809 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16045
diff
changeset
|
810 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/enabled", TRUE); |
| 5212 | 811 | } |
| 812 | ||
| 813 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15512
diff
changeset
|
814 | pidgin_debug_window_hide(void) |
| 5212 | 815 | { |
| 816 | if (debug_win != NULL) { | |
| 817 | gtk_widget_destroy(debug_win->window); | |
| 818 | debug_window_destroy(NULL, NULL, NULL); | |
| 819 | } | |
| 820 | } | |
| 821 | ||
| 822 | static void | |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
823 | pidgin_debug_print(PurpleDebugUi *self, |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
824 | PurpleDebugLevel level, const char *category, |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
825 | const char *arg_s) |
| 5212 | 826 | { |
|
33537
4998e86453d0
GTK debug window: append using js, not html
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33532
diff
changeset
|
827 | 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
|
828 | 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
|
829 | time_t mtime; |
|
33537
4998e86453d0
GTK debug window: append using js, not html
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33532
diff
changeset
|
830 | gchar *js; |
|
5530
ba1ad464b56f
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
831 | |
|
33537
4998e86453d0
GTK debug window: append using js, not html
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33532
diff
changeset
|
832 | if (debug_win == NULL) |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
833 | return; |
|
33537
4998e86453d0
GTK debug window: append using js, not html
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33532
diff
changeset
|
834 | 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
|
835 | return; |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
836 | |
|
17040
cb33027a36e4
Force timestamps always on for debug log and debug window. Making this
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16752
diff
changeset
|
837 | 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
|
838 | mdate = purple_utf8_strftime("%H:%M:%S", localtime(&mtime)); |
| 5212 | 839 | |
|
33537
4998e86453d0
GTK debug window: append using js, not html
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33532
diff
changeset
|
840 | esc_s = purple_escape_js(arg_s); |
| 5212 | 841 | |
|
33538
cbeb76707f12
Better implementation of purple_escape_js
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33537
diff
changeset
|
842 | 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
|
843 | level, mdate, category ? category : "", esc_s); |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
10297
diff
changeset
|
844 | g_free(esc_s); |
| 5212 | 845 | |
|
35500
ae6432ea326f
Fixed namespace issues in Pidgin.
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
846 | 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
|
847 | g_free(js); |
| 5212 | 848 | } |
| 849 | ||
|
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
|
850 | static gboolean |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
851 | pidgin_debug_is_enabled(PurpleDebugUi *self, PurpleDebugLevel level, const char *category) |
|
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
|
852 | { |
|
16045
d9add5eda4cd
Check if debug_win is != NULL before checking the preference. This
Mark Doliner <markdoliner@pidgin.im>
parents:
16044
diff
changeset
|
853 | 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
|
854 | 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
|
855 | } |
|
257072807aa8
Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <markdoliner@pidgin.im>
parents:
15931
diff
changeset
|
856 | |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
857 | static void |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
858 | pidgin_debug_ui_interface_init(PurpleDebugUiInterface *iface) |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
859 | { |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
860 | iface->print = pidgin_debug_print; |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
861 | iface->is_enabled = pidgin_debug_is_enabled; |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
862 | } |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
863 | |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
864 | static void |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
865 | pidgin_debug_ui_class_init(PidginDebugUiClass *klass) |
| 5212 | 866 | { |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
867 | GObjectClass *object_class = G_OBJECT_CLASS(klass); |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
868 | |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
869 | object_class->finalize = pidgin_debug_ui_finalize; |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
870 | } |
| 5212 | 871 | |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
872 | PidginDebugUi * |
|
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
873 | pidgin_debug_ui_new(void) |
| 5212 | 874 | { |
|
38645
bf3f91939dc5
Convert PidginDebugUi to a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38433
diff
changeset
|
875 | return g_object_new(PIDGIN_TYPE_DEBUG_UI, NULL); |
| 5212 | 876 | } |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
877 | |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
878 | void * |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15512
diff
changeset
|
879 | pidgin_debug_get_handle() { |
|
10087
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
880 | static int handle; |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
881 | |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
882 | return &handle; |
|
e5b80a38939d
[gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9791
diff
changeset
|
883 | } |
|
33095
1e0b4fac0fed
Convert the Debug Window to a GtkWebView.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33094
diff
changeset
|
884 |