Mercurial > pidgin
annotate src/gtkdebug.c @ 11454:201617d49573
[gaim-migrate @ 13693]
This commit includes a number of changes:
1. Aliases are now used consistently in chats. If the prpl uses unique screen names for chats (e.g. Jabber), then aliases are not used at all.
2. The chat list is now colorized to match the colors used in the chat itself.
3. Buddies are bolded in the chat user list.
4. Buddies are sorted above non-buddies in the chat user list.
5. The chat user list is ellipsized when possible (i.e. on GTK+ 2.6.0 or above).
6. I've accepted patch #1178248, by Matt Amato to add "buddy-added" and "buddy-removed" signals. These were used in my implementation of #3 and #4, to update the GUI when users are added or removed from the buddy list.
7. I've added a "blist-node-aliased" signal that is emitted when a buddy, contact, or chat is aliased.
8. Since it was hard to separate and I need it at some point, I'm letting it slip in... I've changed GaimConversation.log to be a GList named logs. This way, we can have multiple logs for a single conversation. This will be necessary to implement unnamed chat logging in some reasonable fasion (see my notes in the TODO file).
committer: Tailor Script <tailor@pidgin.im>
| author | Richard Laager <rlaager@wiktel.com> |
|---|---|
| date | Tue, 06 Sep 2005 03:04:07 +0000 |
| parents | b7978afe81d0 |
| children | 171c34a04a9f |
| rev | line source |
|---|---|
| 5212 | 1 /** |
| 2 * @file gtkdebug.c GTK+ Debug API | |
| 3 * @ingroup gtkui | |
| 4 * | |
| 5 * gaim | |
| 6 * | |
| 8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
| 8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 9 * source distribution. | |
|
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
10 * |
| 5212 | 11 * This program is free software; you can redistribute it and/or modify |
| 12 * it under the terms of the GNU General Public License as published by | |
| 13 * the Free Software Foundation; either version 2 of the License, or | |
| 14 * (at your option) any later version. | |
| 15 * | |
| 16 * This program is distributed in the hope that it will be useful, | |
| 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 * GNU General Public License for more details. | |
| 20 * | |
| 21 * You should have received a copy of the GNU General Public License | |
| 22 * along with this program; if not, write to the Free Software | |
| 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 24 */ | |
| 9791 | 25 #include "internal.h" |
| 26 #include "gtkgaim.h" | |
|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5818
diff
changeset
|
27 |
| 9480 | 28 #include "notify.h" |
|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5818
diff
changeset
|
29 #include "prefs.h" |
| 8953 | 30 #include "request.h" |
|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5818
diff
changeset
|
31 #include "util.h" |
|
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5818
diff
changeset
|
32 |
| 5212 | 33 #include "gtkdebug.h" |
| 9709 | 34 #include "gtkdialogs.h" |
| 5212 | 35 #include "gtkimhtml.h" |
| 8953 | 36 #include "gtkutils.h" |
|
10297
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10175
diff
changeset
|
37 #include "gtkstock.h" |
|
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5818
diff
changeset
|
38 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
39 #ifdef HAVE_REGEX_H |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
40 # include <regex.h> |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
41 #endif /* HAVE_REGEX_H */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
42 |
| 5212 | 43 typedef struct |
| 44 { | |
| 45 GtkWidget *window; | |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
46 GtkWidget *text; |
|
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
47 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
48 GtkListStore *store; |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
49 |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
50 gboolean timestamps; |
|
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
51 gboolean paused; |
| 5212 | 52 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
53 #ifdef HAVE_REGEX_H |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
54 GtkWidget *filter; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
55 GtkWidget *expression; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
56 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
57 gboolean invert; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
58 gboolean highlight; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
59 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
60 guint timer; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
61 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
62 regex_t regex; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
63 #else |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
64 GtkWidget *find; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
65 #endif /* HAVE_REGEX_H */ |
| 5212 | 66 } DebugWindow; |
| 67 | |
| 68 static char debug_fg_colors[][8] = { | |
| 69 "#000000", /**< All debug levels. */ | |
| 7150 | 70 "#666666", /**< Misc. */ |
| 5212 | 71 "#000000", /**< Information. */ |
| 72 "#660000", /**< Warnings. */ | |
| 73 "#FF0000", /**< Errors. */ | |
| 74 "#FF0000", /**< Fatal errors. */ | |
| 75 }; | |
| 76 | |
| 77 static DebugWindow *debug_win = NULL; | |
| 78 | |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
79 #ifdef HAVE_REGEX_H |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
80 static void regex_filter_all(DebugWindow *win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
81 static void regex_show_all(DebugWindow *win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
82 #endif /* HAVE_REGEX_H */ |
| 8953 | 83 |
| 5212 | 84 static gint |
| 85 debug_window_destroy(GtkWidget *w, GdkEvent *event, void *unused) | |
| 86 { | |
| 10087 | 87 gaim_prefs_disconnect_by_handle(gaim_gtk_debug_get_handle()); |
| 9502 | 88 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
89 #ifdef HAVE_REGEX_H |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
90 if(debug_win->timer != 0) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
91 const gchar *text; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
92 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
93 g_source_remove(debug_win->timer); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
94 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
95 text = gtk_entry_get_text(GTK_ENTRY(debug_win->expression)); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
96 gaim_prefs_set_string("/gaim/gtk/debug/regex", text); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
97 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
98 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
99 regfree(&debug_win->regex); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
100 #endif |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
101 |
| 9502 | 102 /* If the "Save Log" dialog is open then close it */ |
| 103 gaim_request_close_with_handle(debug_win); | |
|
5704
aa8dbb7e0a4d
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
104 |
| 5212 | 105 g_free(debug_win); |
| 106 debug_win = NULL; | |
| 107 | |
| 9480 | 108 gaim_prefs_set_bool("/gaim/gtk/debug/enabled", FALSE); |
| 109 | |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
110 return FALSE; |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
111 } |
| 5212 | 112 |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
113 static gboolean |
|
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
114 configure_cb(GtkWidget *w, GdkEventConfigure *event, DebugWindow *win) |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
115 { |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
116 if (GTK_WIDGET_VISIBLE(w)) { |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
117 gaim_prefs_set_int("/gaim/gtk/debug/width", event->width); |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
118 gaim_prefs_set_int("/gaim/gtk/debug/height", event->height); |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
119 } |
| 5212 | 120 |
| 121 return FALSE; | |
| 122 } | |
| 123 | |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
124 #ifndef HAVE_REGEX_H |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
125 struct _find { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
126 DebugWindow *window; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
127 GtkWidget *entry; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
128 }; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
129 |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
130 static void |
| 9482 | 131 do_find_cb(GtkWidget *widget, gint response, struct _find *f) |
| 8953 | 132 { |
| 9482 | 133 switch (response) { |
| 8953 | 134 case GTK_RESPONSE_OK: |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
135 gtk_imhtml_search_find(GTK_IMHTML(f->window->text), |
| 8953 | 136 gtk_entry_get_text(GTK_ENTRY(f->entry))); |
| 137 break; | |
| 138 | |
| 139 case GTK_RESPONSE_DELETE_EVENT: | |
| 140 case GTK_RESPONSE_CLOSE: | |
| 141 gtk_imhtml_search_clear(GTK_IMHTML(f->window->text)); | |
| 142 gtk_widget_destroy(f->window->find); | |
| 143 f->window->find = NULL; | |
| 144 g_free(f); | |
| 145 break; | |
| 146 } | |
| 147 } | |
| 148 | |
| 149 static void | |
| 150 find_cb(GtkWidget *w, DebugWindow *win) | |
| 151 { | |
| 152 GtkWidget *hbox, *img, *label; | |
| 153 struct _find *f; | |
| 154 | |
| 155 if(win->find) | |
| 156 { | |
| 157 gtk_window_present(GTK_WINDOW(win->find)); | |
| 158 return; | |
| 159 } | |
| 160 | |
| 161 f = g_malloc(sizeof(struct _find)); | |
| 162 f->window = win; | |
| 163 win->find = gtk_dialog_new_with_buttons(_("Find"), | |
| 164 GTK_WINDOW(win->window), GTK_DIALOG_DESTROY_WITH_PARENT, | |
| 165 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | |
| 166 GTK_STOCK_FIND, GTK_RESPONSE_OK, NULL); | |
| 167 gtk_dialog_set_default_response(GTK_DIALOG(win->find), | |
| 168 GTK_RESPONSE_OK); | |
| 169 g_signal_connect(G_OBJECT(win->find), "response", | |
| 170 G_CALLBACK(do_find_cb), f); | |
| 171 | |
| 11243 | 172 gtk_container_set_border_width(GTK_CONTAINER(win->find), GAIM_HIG_BOX_SPACE); |
| 8953 | 173 gtk_window_set_resizable(GTK_WINDOW(win->find), FALSE); |
| 174 gtk_dialog_set_has_separator(GTK_DIALOG(win->find), FALSE); | |
| 11243 | 175 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(win->find)->vbox), GAIM_HIG_BORDER); |
| 8953 | 176 gtk_container_set_border_width( |
| 11243 | 177 GTK_CONTAINER(GTK_DIALOG(win->find)->vbox), GAIM_HIG_BOX_SPACE); |
| 8953 | 178 |
| 11243 | 179 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER); |
| 8953 | 180 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(win->find)->vbox), |
| 181 hbox); | |
| 182 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, | |
| 183 GTK_ICON_SIZE_DIALOG); | |
| 184 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
| 185 | |
| 186 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
| 187 gtk_dialog_set_response_sensitive(GTK_DIALOG(win->find), | |
| 188 GTK_RESPONSE_OK, FALSE); | |
| 189 | |
| 190 label = gtk_label_new(NULL); | |
| 191 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), _("_Search for:")); | |
| 192 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
| 193 | |
| 194 f->entry = gtk_entry_new(); | |
| 195 gtk_entry_set_activates_default(GTK_ENTRY(f->entry), TRUE); | |
| 196 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(f->entry)); | |
| 197 g_signal_connect(G_OBJECT(f->entry), "changed", | |
| 198 G_CALLBACK(gaim_gtk_set_sensitive_if_input), | |
| 199 win->find); | |
| 200 gtk_box_pack_start(GTK_BOX(hbox), f->entry, FALSE, FALSE, 0); | |
| 201 | |
| 202 gtk_widget_show_all(win->find); | |
| 203 gtk_widget_grab_focus(f->entry); | |
| 204 } | |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
205 #endif /* HAVE_REGEX_H */ |
| 8953 | 206 |
| 207 static void | |
| 9502 | 208 save_writefile_cb(void *user_data, const char *filename) |
| 8953 | 209 { |
| 9502 | 210 DebugWindow *win = (DebugWindow *)user_data; |
| 9489 | 211 FILE *fp; |
| 8953 | 212 char *tmp; |
| 213 | |
|
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10448
diff
changeset
|
214 if ((fp = g_fopen(filename, "w+")) == NULL) { |
| 9502 | 215 gaim_notify_error(win, NULL, _("Unable to open file."), NULL); |
| 8953 | 216 return; |
| 9480 | 217 } |
| 8953 | 218 |
| 9489 | 219 tmp = gtk_imhtml_get_text(GTK_IMHTML(win->text), NULL, NULL); |
| 8953 | 220 fprintf(fp, "Gaim Debug log : %s\n", gaim_date_full()); |
| 221 fprintf(fp, "%s", tmp); | |
| 222 g_free(tmp); | |
| 223 | |
| 224 fclose(fp); | |
| 225 } | |
| 226 | |
| 227 static void | |
| 228 save_cb(GtkWidget *w, DebugWindow *win) | |
| 229 { | |
| 9502 | 230 gaim_request_file(win, _("Save Debug Log"), "gaim-debug.log", TRUE, |
| 231 G_CALLBACK(save_writefile_cb), NULL, win); | |
| 8953 | 232 } |
| 233 | |
| 234 static void | |
|
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
235 clear_cb(GtkWidget *w, DebugWindow *win) |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
236 { |
|
6280
d330afe3ccf0
[gaim-migrate @ 6779]
Christian Hammond <chipx86@chipx86.com>
parents:
6094
diff
changeset
|
237 gtk_imhtml_clear(GTK_IMHTML(win->text)); |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
238 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
239 #ifdef HAVE_REGEX_H |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
240 gtk_list_store_clear(win->store); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
241 #endif /* HAVE_REGEX_H */ |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
242 } |
|
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
243 |
|
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
244 static void |
|
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
245 pause_cb(GtkWidget *w, DebugWindow *win) |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
246 { |
|
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
247 win->paused = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
248 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
249 #ifdef HAVE_REGEX_H |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
250 if(!win->paused) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
251 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
252 regex_filter_all(win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
253 else |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
254 regex_show_all(win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
255 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
256 #endif /* HAVE_REGEX_H */ |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
257 } |
|
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
258 |
|
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
259 static void |
|
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
260 timestamps_cb(GtkWidget *w, DebugWindow *win) |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
261 { |
|
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
262 win->timestamps = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
263 |
| 10307 | 264 gaim_prefs_set_bool("/core/debug/timestamps", win->timestamps); |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
265 } |
|
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
266 |
|
5704
aa8dbb7e0a4d
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
267 static void |
|
aa8dbb7e0a4d
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
268 timestamps_pref_cb(const char *name, GaimPrefType type, gpointer value, |
|
aa8dbb7e0a4d
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
269 gpointer data) |
|
aa8dbb7e0a4d
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
270 { |
|
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
271 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data), GPOINTER_TO_INT(value)); |
|
5704
aa8dbb7e0a4d
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
272 } |
|
aa8dbb7e0a4d
[gaim-migrate @ 6125]
Christian Hammond <chipx86@chipx86.com>
parents:
5684
diff
changeset
|
273 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
274 /****************************************************************************** |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
275 * regex stuff |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
276 *****************************************************************************/ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
277 #ifdef HAVE_REGEX_H |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
278 static void |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
279 regex_clear_color(GtkWidget *w) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
280 gtk_widget_modify_base(w, GTK_STATE_NORMAL, NULL); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
281 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
282 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
283 static void |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
284 regex_change_color(GtkWidget *w, guint16 r, guint16 g, guint16 b) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
285 GdkColor color; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
286 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
287 color.red = r; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
288 color.green = g; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
289 color.blue = b; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
290 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
291 gtk_widget_modify_base(w, GTK_STATE_NORMAL, &color); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
292 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
293 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
294 static void |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
295 regex_highlight_clear(DebugWindow *win) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
296 GtkIMHtml *imhtml = GTK_IMHTML(win->text); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
297 GtkTextIter s, e; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
298 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
299 gtk_text_buffer_get_start_iter(imhtml->text_buffer, &s); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
300 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &e); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
301 gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "regex", &s, &e); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
302 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
303 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
304 static void |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
305 regex_match(DebugWindow *win, const gchar *text) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
306 GtkIMHtml *imhtml = GTK_IMHTML(win->text); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
307 regmatch_t matches[4]; /* adjust if necessary */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
308 size_t n_matches = sizeof(matches) / sizeof(matches[0]); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
309 gchar *plaintext; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
310 gint inverted; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
311 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
312 if(!text) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
313 return; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
314 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
315 inverted = (win->invert) ? REG_NOMATCH : 0; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
316 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
317 /* I don't like having to do this, but we need it for highlighting. Plus |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
318 * it makes the ^ and $ operators work :) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
319 */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
320 plaintext = gaim_markup_strip_html(text); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
321 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
322 /* we do a first pass to see if it matches at all. If it does we append |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
323 * it, and work out the offsets to highlight. |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
324 */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
325 if(regexec(&win->regex, plaintext, n_matches, matches, 0) == inverted) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
326 GtkTextIter ins; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
327 gchar *p = plaintext; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
328 gint i, offset = 0; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
329 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
330 gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &ins, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
331 gtk_text_buffer_get_insert(imhtml->text_buffer)); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
332 i = gtk_text_iter_get_offset(&ins); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
333 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
334 gtk_imhtml_append_text(imhtml, text, 0); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
335 |
|
11312
a546498f7adc
[gaim-migrate @ 13512]
Gary Kramlich <grim@reaperworld.com>
parents:
11311
diff
changeset
|
336 /* If we're not highlighting or the expression is inverted, we're |
|
11311
674abdc2b9be
[gaim-migrate @ 13511]
Gary Kramlich <grim@reaperworld.com>
parents:
11310
diff
changeset
|
337 * done and move on. |
|
11310
0058b0737e76
[gaim-migrate @ 13510]
Gary Kramlich <grim@reaperworld.com>
parents:
11262
diff
changeset
|
338 */ |
|
0058b0737e76
[gaim-migrate @ 13510]
Gary Kramlich <grim@reaperworld.com>
parents:
11262
diff
changeset
|
339 if(!win->highlight || inverted == REG_NOMATCH) { |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
340 g_free(plaintext); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
341 return; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
342 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
343 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
344 /* we use a do-while to highlight the first match, and then continue |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
345 * if necessary... |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
346 */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
347 do { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
348 gint m; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
349 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
350 for(m = 0; m < n_matches; m++) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
351 GtkTextIter ms, me; |
|
11310
0058b0737e76
[gaim-migrate @ 13510]
Gary Kramlich <grim@reaperworld.com>
parents:
11262
diff
changeset
|
352 |
|
0058b0737e76
[gaim-migrate @ 13510]
Gary Kramlich <grim@reaperworld.com>
parents:
11262
diff
changeset
|
353 if(matches[m].rm_eo == -1) |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
354 break; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
355 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
356 i += offset; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
357 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
358 gtk_text_buffer_get_iter_at_offset(imhtml->text_buffer, &ms, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
359 i + matches[m].rm_so); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
360 gtk_text_buffer_get_iter_at_offset(imhtml->text_buffer, &me, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
361 i + matches[m].rm_eo); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
362 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "regex", |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
363 &ms, &me); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
364 offset = matches[m].rm_eo; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
365 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
366 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
367 p += offset; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
368 } while(regexec(&win->regex, p, n_matches, matches, REG_NOTBOL) == inverted); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
369 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
370 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
371 g_free(plaintext); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
372 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
373 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
374 static gboolean |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
375 regex_filter_all_cb(GtkTreeModel *m, GtkTreePath *p, GtkTreeIter *iter, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
376 gpointer data) |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
377 { |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
378 DebugWindow *win = (DebugWindow *)data; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
379 gchar *text; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
380 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
381 gtk_tree_model_get(m, iter, 0, &text, -1); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
382 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
383 regex_match(win, text); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
384 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
385 g_free(text); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
386 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
387 return FALSE; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
388 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
389 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
390 static void |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
391 regex_filter_all(DebugWindow *win) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
392 gtk_imhtml_clear(GTK_IMHTML(win->text)); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
393 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
394 if(win->highlight) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
395 regex_highlight_clear(win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
396 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
397 gtk_tree_model_foreach(GTK_TREE_MODEL(win->store), regex_filter_all_cb, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
398 win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
399 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
400 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
401 static gboolean |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
402 regex_show_all_cb(GtkTreeModel *m, GtkTreePath *p, GtkTreeIter *iter, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
403 gpointer data) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
404 { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
405 DebugWindow *win = (DebugWindow *)data; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
406 gchar *text; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
407 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
408 gtk_tree_model_get(m, iter, 0, &text, -1); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
409 gtk_imhtml_append_text(GTK_IMHTML(win->text), text, 0); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
410 g_free(text); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
411 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
412 return FALSE; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
413 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
414 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
415 static void |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
416 regex_show_all(DebugWindow *win) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
417 gtk_imhtml_clear(GTK_IMHTML(win->text)); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
418 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
419 if(win->highlight) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
420 regex_highlight_clear(win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
421 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
422 gtk_tree_model_foreach(GTK_TREE_MODEL(win->store), regex_show_all_cb, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
423 win); |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
424 } |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
425 |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
426 static void |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
427 regex_compile(DebugWindow *win) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
428 const gchar *text; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
429 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
430 text = gtk_entry_get_text(GTK_ENTRY(win->expression)); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
431 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
432 if(text == NULL || *text == '\0') { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
433 regex_clear_color(win->expression); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
434 gtk_widget_set_sensitive(win->filter, FALSE); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
435 return; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
436 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
437 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
438 regfree(&win->regex); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
439 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
440 if(regcomp(&win->regex, text, REG_EXTENDED | REG_ICASE) != 0) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
441 /* failed to compile */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
442 regex_change_color(win->expression, 0xFFFF, 0xAFFF, 0xAFFF); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
443 gtk_widget_set_sensitive(win->filter, FALSE); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
444 } else { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
445 /* compiled successfully */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
446 regex_change_color(win->expression, 0xAFFF, 0xFFFF, 0xAFFF); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
447 gtk_widget_set_sensitive(win->filter, TRUE); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
448 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
449 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
450 /* we check if the filter is on in case it was only of the options that |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
451 * got changed, and not the expression. |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
452 */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
453 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
454 regex_filter_all(win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
455 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
456 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
457 static void |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
458 regex_pref_filter_cb(const gchar *name, GaimPrefType type, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
459 gpointer val, gpointer data) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
460 { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
461 DebugWindow *win = (DebugWindow *)data; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
462 gboolean active = GPOINTER_TO_INT(val), current; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
463 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
464 if(!win || !win->window) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
465 return; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
466 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
467 current = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter)); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
468 if(active != current) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
469 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), active); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
470 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
471 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
472 static void |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
473 regex_pref_expression_cb(const gchar *name, GaimPrefType type, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
474 gpointer val, gpointer data) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
475 { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
476 DebugWindow *win = (DebugWindow *)data; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
477 const gchar *exp = (const gchar *)val; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
478 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
479 gtk_entry_set_text(GTK_ENTRY(win->expression), exp); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
480 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
481 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
482 static void |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
483 regex_pref_invert_cb(const gchar *name, GaimPrefType type, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
484 gpointer val, gpointer data) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
485 { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
486 DebugWindow *win = (DebugWindow *)data; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
487 gboolean active = GPOINTER_TO_INT(val); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
488 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
489 win->invert = active; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
490 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
491 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
492 regex_filter_all(win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
493 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
494 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
495 static void |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
496 regex_pref_highlight_cb(const gchar *name, GaimPrefType type, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
497 gpointer val, gpointer data) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
498 { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
499 DebugWindow *win = (DebugWindow *)data; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
500 gboolean active = GPOINTER_TO_INT(val); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
501 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
502 win->highlight = active; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
503 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
504 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
505 regex_filter_all(win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
506 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
507 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
508 static void |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
509 regex_row_changed_cb(GtkTreeModel *model, GtkTreePath *path, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
510 GtkTreeIter *iter, DebugWindow *win) |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
511 { |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
512 gchar *text; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
513 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
514 if(!win || !win->window) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
515 return; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
516 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
517 /* If the debug window is paused, we just return since it's in the store. |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
518 * We don't call regex_match because it doesn't make sense to check the |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
519 * string if it's paused. When we unpause we clear the imhtml and |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
520 * reiterate over the store to handle matches that were outputted when |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
521 * we were paused. |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
522 */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
523 if(win->paused) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
524 return; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
525 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
526 gtk_tree_model_get(model, iter, 0, &text, -1); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
527 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
528 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
529 regex_match(win, text); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
530 } else { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
531 gtk_imhtml_append_text(GTK_IMHTML(win->text), text, 0); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
532 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
533 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
534 g_free(text); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
535 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
536 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
537 static gboolean |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
538 regex_timer_cb(DebugWindow *win) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
539 const gchar *text; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
540 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
541 text = gtk_entry_get_text(GTK_ENTRY(win->expression)); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
542 gaim_prefs_set_string("/gaim/gtk/debug/regex", text); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
543 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
544 win->timer = 0; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
545 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
546 return FALSE; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
547 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
548 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
549 static void |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
550 regex_changed_cb(GtkWidget *w, DebugWindow *win) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
551 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
552 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
553 FALSE); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
554 } |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
555 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
556 if(win->timer == 0) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
557 win->timer = gaim_timeout_add(5000, (GSourceFunc)regex_timer_cb, win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
558 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
559 regex_compile(win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
560 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
561 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
562 static void |
|
11450
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
563 regex_key_release_cb(GtkWidget *w, GdkEventKey *e, DebugWindow *win) { |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
564 /** |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
565 * GDK_Return is defined in gdkkeysyms.h as 0xFF0D, but this file is not |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
566 * included by default, so we just use that value here directly. |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
567 */ |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
568 if(e->keyval == 0xFF0D && |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
569 GTK_WIDGET_IS_SENSITIVE(win->filter) && |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
570 !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
571 { |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
572 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), TRUE); |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
573 } |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
574 } |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
575 |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
576 static void |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
577 regex_menu_cb(GtkWidget *item, const gchar *pref) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
578 gboolean active; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
579 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
580 active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
581 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
582 gaim_prefs_set_bool(pref, active); |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
583 } |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
584 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
585 static void |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
586 regex_popup_cb(GtkEntry *entry, GtkWidget *menu, DebugWindow *win) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
587 gaim_separator(menu); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
588 gaim_new_check_item(menu, _("Invert"), |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
589 G_CALLBACK(regex_menu_cb), |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
590 "/gaim/gtk/debug/invert", win->invert); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
591 gaim_new_check_item(menu, _("Highlight matches"), |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
592 G_CALLBACK(regex_menu_cb), |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
593 "/gaim/gtk/debug/highlight", win->highlight); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
594 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
595 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
596 static void |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
597 regex_filter_toggled_cb(GtkToggleButton *button, DebugWindow *win) { |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
598 gboolean active; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
599 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
600 active = gtk_toggle_button_get_active(button); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
601 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
602 gaim_prefs_set_bool("/gaim/gtk/debug/filter", active); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
603 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
604 if(!GTK_IS_IMHTML(win->text)) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
605 return; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
606 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
607 if(active) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
608 regex_filter_all(win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
609 else |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
610 regex_show_all(win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
611 } |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
612 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
613 #endif /* HAVE_REGEX_H */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
614 |
| 5212 | 615 static DebugWindow * |
| 616 debug_window_new(void) | |
| 617 { | |
| 618 DebugWindow *win; | |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
619 GtkWidget *vbox; |
|
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
620 GtkWidget *toolbar; |
| 10175 | 621 GtkWidget *frame; |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
622 GtkWidget *button; |
|
6094
538c522e36e1
[gaim-migrate @ 6553]
Christian Hammond <chipx86@chipx86.com>
parents:
6009
diff
changeset
|
623 GtkWidget *image; |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
624 gint width, height; |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
625 void *handle; |
| 5212 | 626 |
| 627 win = g_new0(DebugWindow, 1); | |
| 628 | |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
629 width = gaim_prefs_get_int("/gaim/gtk/debug/width"); |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
630 height = gaim_prefs_get_int("/gaim/gtk/debug/height"); |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
631 |
| 5212 | 632 GAIM_DIALOG(win->window); |
| 10309 | 633 gaim_debug_info("gtkdebug", "Setting dimensions to %d, %d\n", |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
634 width, height); |
|
5642
1693a3027dc8
[gaim-migrate @ 6056]
Christian Hammond <chipx86@chipx86.com>
parents:
5636
diff
changeset
|
635 |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
636 gtk_window_set_default_size(GTK_WINDOW(win->window), width, height); |
| 5212 | 637 gtk_window_set_role(GTK_WINDOW(win->window), "debug"); |
| 638 gtk_window_set_title(GTK_WINDOW(win->window), _("Debug Window")); | |
| 639 | |
| 640 g_signal_connect(G_OBJECT(win->window), "delete_event", | |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
641 G_CALLBACK(debug_window_destroy), NULL); |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
642 g_signal_connect(G_OBJECT(win->window), "configure_event", |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
643 G_CALLBACK(configure_cb), win); |
| 5212 | 644 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
645 handle = gaim_gtk_debug_get_handle(); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
646 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
647 #ifdef HAVE_REGEX_H |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
648 /* the list store for all the messages */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
649 win->store = gtk_list_store_new(1, G_TYPE_STRING); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
650 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
651 /* row-changed gets called when we do gtk_list_store_set, and row-inserted |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
652 * gets called with gtk_list_store_append, which is a |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
653 * completely empty row. So we just ignore row-inserted, and deal with row |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
654 * changed. -Gary |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
655 */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
656 g_signal_connect(G_OBJECT(win->store), "row-changed", |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
657 G_CALLBACK(regex_row_changed_cb), win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
658 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
659 #endif /* HAVE_REGEX_H */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
660 |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
661 /* Setup the vbox */ |
|
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
662 vbox = gtk_vbox_new(FALSE, 0); |
|
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
663 gtk_container_add(GTK_CONTAINER(win->window), vbox); |
|
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
664 |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
665 if (gaim_prefs_get_bool("/gaim/gtk/debug/toolbar")) { |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
666 /* Setup our top button bar thingie. */ |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
667 toolbar = gtk_toolbar_new(); |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
668 gtk_toolbar_set_tooltips(GTK_TOOLBAR(toolbar), TRUE); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
669 |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
670 gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
671 GTK_TOOLBAR_BOTH_HORIZ); |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
672 gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar), |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
673 GTK_ICON_SIZE_SMALL_TOOLBAR); |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
674 |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
675 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
676 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
677 #ifndef HAVE_REGEX_H |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
678 /* Find button */ |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
679 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_FIND, |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
680 _("Find"), NULL, G_CALLBACK(find_cb), |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
681 win, -1); |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
682 #endif /* HAVE_REGEX_H */ |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
683 |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
684 /* Save */ |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
685 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_SAVE, |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
686 _("Save"), NULL, G_CALLBACK(save_cb), |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
687 win, -1); |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
688 |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
689 /* Clear button */ |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
690 gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_CLEAR, |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
691 _("Clear"), NULL, G_CALLBACK(clear_cb), |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
692 win, -1); |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
693 |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
694 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
695 |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
696 /* Pause */ |
|
6094
538c522e36e1
[gaim-migrate @ 6553]
Christian Hammond <chipx86@chipx86.com>
parents:
6009
diff
changeset
|
697 image = gtk_image_new_from_stock(GAIM_STOCK_PAUSE, GTK_ICON_SIZE_MENU); |
|
538c522e36e1
[gaim-migrate @ 6553]
Christian Hammond <chipx86@chipx86.com>
parents:
6009
diff
changeset
|
698 button = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
699 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
700 NULL, _("Pause"), _("Pause"), |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
701 NULL, image, |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
702 G_CALLBACK(pause_cb), win); |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
703 |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
704 /* Timestamps */ |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
705 button = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
706 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
707 NULL, _("Timestamps"), |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
708 _("Timestamps"), NULL, NULL, |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
709 G_CALLBACK(timestamps_cb), |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
710 win); |
| 8953 | 711 |
| 712 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), | |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
713 gaim_prefs_get_bool("/core/debug/timestamps")); |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
714 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
715 gaim_prefs_connect_callback(handle, "/core/debug/timestamps", |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
716 timestamps_pref_cb, button); |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
717 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
718 #ifdef HAVE_REGEX_H |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
719 /* regex stuff */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
720 gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
721 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
722 /* regex toggle button */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
723 win->filter = |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
724 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
725 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
726 NULL, _("Filter"), _("Filter"), |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
727 NULL, NULL, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
728 G_CALLBACK(regex_filter_toggled_cb), |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
729 win); |
|
11450
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
730 /* we purposely disable the toggle button here in case |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
731 * /gaim/gtk/debug/expression has an empty string. If it does not have |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
732 * an empty string, the change signal will get called and make the |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
733 * toggle button sensitive. |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
734 */ |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
735 gtk_widget_set_sensitive(win->filter, FALSE); |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
736 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
737 gaim_prefs_get_bool("/gaim/gtk/debug/filter")); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
738 gaim_prefs_connect_callback(handle, "/gaim/gtk/debug/filter", |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
739 regex_pref_filter_cb, win); |
| 8953 | 740 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
741 /* regex entry */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
742 win->expression = gtk_entry_new(); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
743 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
744 GTK_TOOLBAR_CHILD_WIDGET, win->expression, |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
745 NULL, _("Right click for more options."), |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
746 NULL, NULL, NULL, NULL); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
747 /* this needs to be before the text is set from the pref if we want it |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
748 * to colorize a stored expression. |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
749 */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
750 g_signal_connect(G_OBJECT(win->expression), "changed", |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
751 G_CALLBACK(regex_changed_cb), win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
752 gtk_entry_set_text(GTK_ENTRY(win->expression), |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
753 gaim_prefs_get_string("/gaim/gtk/debug/regex")); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
754 g_signal_connect(G_OBJECT(win->expression), "populate-popup", |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
755 G_CALLBACK(regex_popup_cb), win); |
|
11450
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
756 g_signal_connect(G_OBJECT(win->expression), "key-release-event", |
|
b7978afe81d0
[gaim-migrate @ 13689]
Gary Kramlich <grim@reaperworld.com>
parents:
11312
diff
changeset
|
757 G_CALLBACK(regex_key_release_cb), win); |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
758 gaim_prefs_connect_callback(handle, "/gaim/gtk/debug/regex", |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
759 regex_pref_expression_cb, win); |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
760 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
761 /* connect the rest of our pref callbacks */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
762 win->invert = gaim_prefs_get_bool("/gaim/gtk/debug/invert"); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
763 gaim_prefs_connect_callback(handle, "/gaim/gtk/debug/invert", |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
764 regex_pref_invert_cb, win); |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
765 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
766 win->highlight = gaim_prefs_get_bool("/gaim/gtk/debug/highlight"); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
767 gaim_prefs_connect_callback(handle, "/gaim/gtk/debug/highlight", |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
768 regex_pref_highlight_cb, win); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
769 |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
770 #endif /* HAVE_REGEX_H */ |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
771 } |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
772 |
| 10175 | 773 /* Add the gtkimhtml */ |
| 774 frame = gaim_gtk_create_imhtml(FALSE, &win->text, NULL); | |
| 10739 | 775 gtk_imhtml_set_format_functions(GTK_IMHTML(win->text), |
| 776 GTK_IMHTML_ALL ^ GTK_IMHTML_SMILEY ^ GTK_IMHTML_IMAGE); | |
| 10175 | 777 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
| 778 gtk_widget_show(frame); | |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
779 |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
780 #ifdef HAVE_REGEX_H |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
781 /* add the tag for regex highlighting */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
782 gtk_text_buffer_create_tag(GTK_IMHTML(win->text)->text_buffer, "regex", |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
783 "background", "#FFAFAF", |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
784 "weight", "bold", |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
785 NULL); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
786 #endif /* HAVE_REGEX_H */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
787 |
| 5212 | 788 gtk_widget_show_all(win->window); |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
789 |
| 5212 | 790 return win; |
| 791 } | |
| 792 | |
|
5625
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
793 static void |
|
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
794 debug_enabled_cb(const char *name, GaimPrefType type, gpointer value, |
|
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
795 gpointer data) |
|
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
796 { |
| 5636 | 797 if (value) |
|
5625
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
798 gaim_gtk_debug_window_show(); |
|
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
799 else |
|
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
800 gaim_gtk_debug_window_hide(); |
|
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
801 } |
|
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
802 |
| 7150 | 803 static void |
| 804 gaim_glib_log_handler(const gchar *domain, GLogLevelFlags flags, | |
| 805 const gchar *msg, gpointer user_data) | |
| 806 { | |
| 807 GaimDebugLevel level; | |
| 808 char *new_msg = NULL; | |
| 809 char *new_domain = NULL; | |
| 810 | |
|
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
811 if ((flags & G_LOG_LEVEL_ERROR) == G_LOG_LEVEL_ERROR) |
| 7150 | 812 level = GAIM_DEBUG_ERROR; |
|
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
813 else if ((flags & G_LOG_LEVEL_CRITICAL) == G_LOG_LEVEL_CRITICAL) |
| 7150 | 814 level = GAIM_DEBUG_FATAL; |
|
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
815 else if ((flags & G_LOG_LEVEL_WARNING) == G_LOG_LEVEL_WARNING) |
| 7150 | 816 level = GAIM_DEBUG_WARNING; |
|
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
817 else if ((flags & G_LOG_LEVEL_MESSAGE) == G_LOG_LEVEL_MESSAGE) |
| 7150 | 818 level = GAIM_DEBUG_INFO; |
|
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
819 else if ((flags & G_LOG_LEVEL_INFO) == G_LOG_LEVEL_INFO) |
| 7150 | 820 level = GAIM_DEBUG_INFO; |
|
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
821 else if ((flags & G_LOG_LEVEL_DEBUG) == G_LOG_LEVEL_DEBUG) |
| 7150 | 822 level = GAIM_DEBUG_MISC; |
|
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
823 else |
|
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
824 { |
|
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
825 gaim_debug_warning("gtkdebug", |
| 7150 | 826 "Unknown glib logging level in %d\n", flags); |
| 827 | |
| 828 level = GAIM_DEBUG_MISC; /* This will never happen. */ | |
| 829 } | |
| 830 | |
| 831 if (msg != NULL) | |
| 832 new_msg = gaim_utf8_try_convert(msg); | |
| 833 | |
| 834 if (domain != NULL) | |
| 835 new_domain = gaim_utf8_try_convert(domain); | |
| 836 | |
|
7152
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
837 if (new_msg != NULL) |
|
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
838 { |
|
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
839 gaim_debug(level, (new_domain != NULL ? new_domain : "g_log"), |
|
cada5ddc21f5
[gaim-migrate @ 7719]
Christian Hammond <chipx86@chipx86.com>
parents:
7150
diff
changeset
|
840 "%s\n", new_msg); |
| 7150 | 841 |
| 842 g_free(new_msg); | |
| 843 } | |
| 844 | |
| 845 if (new_domain != NULL) | |
| 846 g_free(new_domain); | |
| 847 } | |
| 848 | |
| 849 #ifdef _WIN32 | |
| 850 static void | |
| 851 gaim_glib_dummy_print_handler(const gchar *string) | |
| 852 { | |
| 853 } | |
| 854 #endif | |
| 855 | |
|
5625
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
856 void |
|
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
857 gaim_gtk_debug_init(void) |
|
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
858 { |
| 5684 | 859 /* Debug window preferences. */ |
| 860 /* | |
| 861 * NOTE: This must be set before prefs are loaded, and the callbacks | |
| 862 * set after they are loaded, since prefs sets the enabled | |
| 863 * preference here and that loads the window, which calls the | |
|
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
864 * configure event, which overrides the width and height! :P |
| 5684 | 865 */ |
| 866 | |
| 867 gaim_prefs_add_none("/gaim/gtk/debug"); | |
| 10307 | 868 |
| 869 /* Controls printing to the debug window */ | |
| 5684 | 870 gaim_prefs_add_bool("/gaim/gtk/debug/enabled", FALSE); |
| 10307 | 871 |
| 5684 | 872 gaim_prefs_add_bool("/gaim/gtk/debug/toolbar", TRUE); |
| 873 gaim_prefs_add_int("/gaim/gtk/debug/width", 450); | |
| 874 gaim_prefs_add_int("/gaim/gtk/debug/height", 250); | |
| 875 | |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
876 #ifdef HAVE_REGEX_H |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
877 gaim_prefs_add_string("/gaim/gtk/debug/regex", ""); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
878 gaim_prefs_add_bool("/gaim/gtk/debug/filter", FALSE); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
879 gaim_prefs_add_bool("/gaim/gtk/debug/invert", FALSE); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
880 gaim_prefs_add_bool("/gaim/gtk/debug/case_insensitive", FALSE); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
881 gaim_prefs_add_bool("/gaim/gtk/debug/highlight", FALSE); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
882 #endif /* HAVE_REGEX_H */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
883 |
| 10087 | 884 gaim_prefs_connect_callback(NULL, "/gaim/gtk/debug/enabled", |
|
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5738
diff
changeset
|
885 debug_enabled_cb, NULL); |
| 7150 | 886 |
| 887 #define REGISTER_G_LOG_HANDLER(name) \ | |
| 888 g_log_set_handler((name), G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL \ | |
| 889 | G_LOG_FLAG_RECURSION, \ | |
| 890 gaim_glib_log_handler, NULL) | |
| 891 | |
| 892 /* Register the glib/gtk log handlers. */ | |
| 893 REGISTER_G_LOG_HANDLER(NULL); | |
| 894 REGISTER_G_LOG_HANDLER("Gdk"); | |
| 895 REGISTER_G_LOG_HANDLER("Gtk"); | |
|
7229
26fe5055e0b0
[gaim-migrate @ 7799]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7152
diff
changeset
|
896 REGISTER_G_LOG_HANDLER("GdkPixbuf"); |
| 7150 | 897 REGISTER_G_LOG_HANDLER("GLib"); |
| 898 REGISTER_G_LOG_HANDLER("GModule"); | |
| 899 REGISTER_G_LOG_HANDLER("GLib-GObject"); | |
| 900 REGISTER_G_LOG_HANDLER("GThread"); | |
| 901 | |
| 902 #ifdef _WIN32 | |
| 10314 | 903 if (!gaim_debug_is_enabled()) |
| 7150 | 904 g_set_print_handler(gaim_glib_dummy_print_handler); |
| 905 #endif | |
|
5625
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
906 } |
|
73c9dc20e41a
[gaim-migrate @ 6032]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
907 |
| 5212 | 908 void |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
909 gaim_gtk_debug_uninit(void) |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
910 { |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
911 gaim_debug_set_ui_ops(NULL); |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
912 } |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
913 |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
914 void |
| 5212 | 915 gaim_gtk_debug_window_show(void) |
| 916 { | |
| 917 if (debug_win == NULL) | |
| 918 debug_win = debug_window_new(); | |
| 919 | |
| 920 gtk_widget_show(debug_win->window); | |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
921 |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
922 gaim_prefs_set_bool("/gaim/gtk/debug/enabled", TRUE); |
| 5212 | 923 } |
| 924 | |
| 925 void | |
| 926 gaim_gtk_debug_window_hide(void) | |
| 927 { | |
| 928 if (debug_win != NULL) { | |
| 929 gtk_widget_destroy(debug_win->window); | |
| 930 debug_window_destroy(NULL, NULL, NULL); | |
| 931 } | |
| 932 } | |
| 933 | |
| 934 static void | |
| 935 gaim_gtk_debug_print(GaimDebugLevel level, const char *category, | |
| 936 const char *format, va_list args) | |
| 937 { | |
| 11262 | 938 #ifdef HAVE_REGEX_H |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
939 GtkTreeIter iter; |
| 11262 | 940 #endif /* HAVE_REGEX_H */ |
| 10307 | 941 gboolean timestamps; |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
942 gchar *arg_s, *ts_s; |
| 10307 | 943 gchar *esc_s, *cat_s, *tmp, *s; |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
944 |
| 10307 | 945 if (!gaim_prefs_get_bool("/gaim/gtk/debug/enabled") || |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
946 (debug_win == NULL)) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
947 { |
| 10307 | 948 return; |
| 949 } | |
| 950 | |
| 951 timestamps = gaim_prefs_get_bool("/core/debug/timestamps"); | |
| 5212 | 952 |
| 953 arg_s = g_strdup_vprintf(format, args); | |
| 954 | |
| 10307 | 955 /* |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
956 * For some reason we only print the timestamp if category is |
|
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
957 * not NULL. Why the hell do we do that? --Mark |
| 10307 | 958 */ |
| 959 if ((category != NULL) && (timestamps)) { | |
| 960 gchar mdate[64]; | |
| 961 | |
| 962 time_t mtime = time(NULL); | |
| 963 strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); | |
| 964 ts_s = g_strdup_printf("(%s) ", mdate); | |
| 965 } else { | |
|
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
966 ts_s = g_strdup(""); |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
967 } |
|
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5430
diff
changeset
|
968 |
| 10307 | 969 if (category == NULL) |
| 970 cat_s = g_strdup(""); | |
| 971 else | |
| 972 cat_s = g_strdup_printf("<b>%s:</b> ", category); | |
| 5212 | 973 |
| 10307 | 974 esc_s = g_markup_escape_text(arg_s, -1); |
|
5428
96bde36bb76b
[gaim-migrate @ 5808]
Christian Hammond <chipx86@chipx86.com>
parents:
5314
diff
changeset
|
975 |
| 10307 | 976 g_free(arg_s); |
| 5212 | 977 |
| 10307 | 978 s = g_strdup_printf("<font color=\"%s\">%s%s%s</font>", |
| 979 debug_fg_colors[level], ts_s, cat_s, esc_s); | |
| 5212 | 980 |
| 10307 | 981 g_free(ts_s); |
| 982 g_free(cat_s); | |
| 983 g_free(esc_s); | |
| 5212 | 984 |
| 10307 | 985 tmp = gaim_utf8_try_convert(s); |
| 986 g_free(s); | |
| 987 s = tmp; | |
| 5212 | 988 |
| 10307 | 989 if (level == GAIM_DEBUG_FATAL) { |
| 990 tmp = g_strdup_printf("<b>%s</b>", s); | |
| 5212 | 991 g_free(s); |
| 10307 | 992 s = tmp; |
| 5212 | 993 } |
| 994 | |
|
11256
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
995 #ifdef HAVE_REGEX_H |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
996 /* add the text to the list store */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
997 gtk_list_store_append(debug_win->store, &iter); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
998 gtk_list_store_set(debug_win->store, &iter, 0, s, -1); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
999 #else /* HAVE_REGEX_H */ |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
1000 if(!debug_win->paused) |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
1001 gtk_imhtml_append_text(GTK_IMHTML(debug_win->text), s, 0); |
|
bb0d7b719af2
[gaim-migrate @ 13430]
Gary Kramlich <grim@reaperworld.com>
parents:
11243
diff
changeset
|
1002 #endif /* !HAVE_REGEX_H */ |
| 5212 | 1003 |
| 10307 | 1004 g_free(s); |
| 5212 | 1005 } |
| 1006 | |
| 1007 static GaimDebugUiOps ops = | |
| 1008 { | |
|
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10739
diff
changeset
|
1009 gaim_gtk_debug_print, |
| 5212 | 1010 }; |
| 1011 | |
| 1012 GaimDebugUiOps * | |
|
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
1013 gaim_gtk_debug_get_ui_ops(void) |
| 5212 | 1014 { |
| 1015 return &ops; | |
| 1016 } | |
| 10087 | 1017 |
| 1018 void * | |
| 1019 gaim_gtk_debug_get_handle() { | |
| 1020 static int handle; | |
| 1021 | |
| 1022 return &handle; | |
| 1023 } |
