Fri, 28 Sep 2007 02:24:08 +0000
Add save button to the debug window and alter some GROW_X for visual appeal
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
1 | /** |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
2 | * @file gntdebug.c GNT Debug API |
|
16255
fa61ee19f526
Rename the Doxygen group from gntui to finch and define the finch group
Richard Laager <rlaager@pidgin.im>
parents:
16186
diff
changeset
|
3 | * @ingroup finch |
|
20330
650a7af9c238
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents:
19859
diff
changeset
|
4 | */ |
|
650a7af9c238
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents:
19859
diff
changeset
|
5 | |
|
650a7af9c238
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents:
19859
diff
changeset
|
6 | /* finch |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
7 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15906
diff
changeset
|
8 | * Finch is the legal property of its developers, whose names are too numerous |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
10 | * source distribution. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
11 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
12 | * This program is free software; you can redistribute it and/or modify |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
13 | * it under the terms of the GNU General Public License as published by |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
14 | * the Free Software Foundation; either version 2 of the License, or |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
15 | * (at your option) any later version. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
16 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
17 | * This program is distributed in the hope that it will be useful, |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
20 | * GNU General Public License for more details. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
21 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
22 | * You should have received a copy of the GNU General Public License |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
23 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18637
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
25 | */ |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
26 | #include <gnt.h> |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
27 | #include <gntbox.h> |
| 14755 | 28 | #include <gntbutton.h> |
| 29 | #include <gntcheckbox.h> | |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
30 | #include <gntentry.h> |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
31 | #include <gntfilesel.h> |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
32 | #include <gntlabel.h> |
| 14755 | 33 | #include <gntline.h> |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
34 | #include <gnttextview.h> |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
35 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
36 | #include "gntdebug.h" |
| 15884 | 37 | #include "finch.h" |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
38 | #include "notify.h" |
| 14755 | 39 | #include "util.h" |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
40 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
41 | #include <stdio.h> |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
42 | #include <string.h> |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
43 | |
|
16478
19107605c565
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents:
16255
diff
changeset
|
44 | #define PREF_ROOT "/finch/debug" |
|
14923
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
45 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
46 | static struct |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
47 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
48 | GntWidget *window; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
49 | GntWidget *tview; |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
50 | GntWidget *search; |
| 14755 | 51 | gboolean paused; |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
52 | } debug; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
53 | |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
54 | static gboolean |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
55 | match_string(const char *category, const char *args) |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
56 | { |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
57 | const char *str = gnt_entry_get_text(GNT_ENTRY(debug.search)); |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
58 | if (!str || !*str) |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
59 | return TRUE; |
|
17064
e081c1d7ceb4
Fix debug filtering.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17056
diff
changeset
|
60 | if (g_strrstr(category, str) != NULL) |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
61 | return TRUE; |
|
17064
e081c1d7ceb4
Fix debug filtering.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17056
diff
changeset
|
62 | if (g_strrstr(args, str) != NULL) |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
63 | return TRUE; |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
64 | return FALSE; |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
65 | } |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
66 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
67 | static void |
| 15884 | 68 | finch_debug_print(PurpleDebugLevel level, const char *category, |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
69 | const char *args) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
70 | { |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
71 | if (debug.window && !debug.paused && match_string(category, args)) |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
72 | { |
| 14755 | 73 | int pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(debug.tview)); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
74 | GntTextFormatFlags flag = GNT_TEXT_FLAG_NORMAL; |
|
17043
6ff1c7174836
The timestamp pref has been removed. Update finch accordingly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
75 | const char *mdate; |
|
6ff1c7174836
The timestamp pref has been removed. Update finch accordingly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
76 | time_t mtime = time(NULL); |
|
6ff1c7174836
The timestamp pref has been removed. Update finch accordingly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
77 | mdate = purple_utf8_strftime("%H:%M:%S ", localtime(&mtime)); |
|
6ff1c7174836
The timestamp pref has been removed. Update finch accordingly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
78 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), |
|
6ff1c7174836
The timestamp pref has been removed. Update finch accordingly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
79 | mdate, flag); |
| 14755 | 80 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
81 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
82 | category, GNT_TEXT_FLAG_BOLD); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
83 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
84 | ": ", GNT_TEXT_FLAG_BOLD); |
| 14755 | 85 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
86 | switch (level) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
87 | { |
| 15884 | 88 | case PURPLE_DEBUG_WARNING: |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
89 | flag |= GNT_TEXT_FLAG_UNDERLINE; |
| 15884 | 90 | case PURPLE_DEBUG_ERROR: |
| 91 | case PURPLE_DEBUG_FATAL: | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
92 | flag |= GNT_TEXT_FLAG_BOLD; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
93 | break; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
94 | default: |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
95 | break; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
96 | } |
| 14755 | 97 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
98 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), args, flag); |
| 14755 | 99 | if (pos <= 1) |
| 100 | gnt_text_view_scroll(GNT_TEXT_VIEW(debug.tview), 0); | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
101 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
102 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
103 | |
|
16044
257072807aa8
Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <markdoliner@pidgin.im>
parents:
15931
diff
changeset
|
104 | static gboolean |
|
257072807aa8
Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <markdoliner@pidgin.im>
parents:
15931
diff
changeset
|
105 | finch_debug_is_enabled(PurpleDebugLevel level, const char *category) |
|
257072807aa8
Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <markdoliner@pidgin.im>
parents:
15931
diff
changeset
|
106 | { |
|
257072807aa8
Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <markdoliner@pidgin.im>
parents:
15931
diff
changeset
|
107 | return debug.window && !debug.paused; |
|
257072807aa8
Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <markdoliner@pidgin.im>
parents:
15931
diff
changeset
|
108 | } |
|
257072807aa8
Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <markdoliner@pidgin.im>
parents:
15931
diff
changeset
|
109 | |
| 15884 | 110 | static PurpleDebugUiOps uiops = |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
111 | { |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15701
diff
changeset
|
112 | finch_debug_print, |
|
16748
f8e1573bfde0
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16478
diff
changeset
|
113 | finch_debug_is_enabled, |
|
f8e1573bfde0
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16478
diff
changeset
|
114 | |
|
f8e1573bfde0
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16478
diff
changeset
|
115 | /* padding */ |
|
f8e1573bfde0
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16478
diff
changeset
|
116 | NULL, |
|
f8e1573bfde0
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16478
diff
changeset
|
117 | NULL, |
|
f8e1573bfde0
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16478
diff
changeset
|
118 | NULL, |
|
f8e1573bfde0
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16478
diff
changeset
|
119 | NULL |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
120 | }; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
121 | |
| 15884 | 122 | PurpleDebugUiOps *finch_debug_get_ui_ops() |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
123 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
124 | return &uiops; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
125 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
126 | |
|
14047
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
127 | static void |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
128 | reset_debug_win(GntWidget *w, gpointer null) |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
129 | { |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
130 | debug.window = debug.tview = debug.search = NULL; |
|
14047
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
131 | } |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
132 | |
|
14187
881ec8710386
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
133 | static void |
| 14755 | 134 | clear_debug_win(GntWidget *w, GntTextView *tv) |
| 135 | { | |
| 136 | gnt_text_view_clear(tv); | |
| 137 | } | |
| 138 | ||
| 139 | static void | |
|
14187
881ec8710386
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
140 | print_stderr(const char *string) |
|
881ec8710386
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
141 | { |
|
881ec8710386
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
142 | g_printerr("%s", string); |
|
881ec8710386
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
143 | } |
|
881ec8710386
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
144 | |
| 14755 | 145 | static void |
|
15701
26f94dd0764a
Suppress debug messages from libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
146 | suppress_error_messages(const char *message) |
|
26f94dd0764a
Suppress debug messages from libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
147 | {} |
|
26f94dd0764a
Suppress debug messages from libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
148 | |
|
26f94dd0764a
Suppress debug messages from libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14939
diff
changeset
|
149 | static void |
| 14755 | 150 | toggle_pause(GntWidget *w, gpointer n) |
| 151 | { | |
| 152 | debug.paused = !debug.paused; | |
| 153 | } | |
| 154 | ||
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
155 | /* Xerox */ |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
156 | static void |
| 15884 | 157 | purple_glib_log_handler(const gchar *domain, GLogLevelFlags flags, |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
158 | const gchar *msg, gpointer user_data) |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
159 | { |
| 15884 | 160 | PurpleDebugLevel level; |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
161 | char *new_msg = NULL; |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
162 | char *new_domain = NULL; |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
163 | |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
164 | if ((flags & G_LOG_LEVEL_ERROR) == G_LOG_LEVEL_ERROR) |
| 15884 | 165 | level = PURPLE_DEBUG_ERROR; |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
166 | else if ((flags & G_LOG_LEVEL_CRITICAL) == G_LOG_LEVEL_CRITICAL) |
| 15884 | 167 | level = PURPLE_DEBUG_FATAL; |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
168 | else if ((flags & G_LOG_LEVEL_WARNING) == G_LOG_LEVEL_WARNING) |
| 15884 | 169 | level = PURPLE_DEBUG_WARNING; |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
170 | else if ((flags & G_LOG_LEVEL_MESSAGE) == G_LOG_LEVEL_MESSAGE) |
| 15884 | 171 | level = PURPLE_DEBUG_INFO; |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
172 | else if ((flags & G_LOG_LEVEL_INFO) == G_LOG_LEVEL_INFO) |
| 15884 | 173 | level = PURPLE_DEBUG_INFO; |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
174 | else if ((flags & G_LOG_LEVEL_DEBUG) == G_LOG_LEVEL_DEBUG) |
| 15884 | 175 | level = PURPLE_DEBUG_MISC; |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
176 | else |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
177 | { |
| 15884 | 178 | purple_debug_warning("gntdebug", |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
179 | "Unknown glib logging level in %d\n", flags); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
180 | |
| 15884 | 181 | level = PURPLE_DEBUG_MISC; /* This will never happen. */ |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
182 | } |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
183 | |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
184 | if (msg != NULL) |
| 15884 | 185 | new_msg = purple_utf8_try_convert(msg); |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
186 | |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
187 | if (domain != NULL) |
| 15884 | 188 | new_domain = purple_utf8_try_convert(domain); |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
189 | |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
190 | if (new_msg != NULL) |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
191 | { |
| 15884 | 192 | purple_debug(level, (new_domain != NULL ? new_domain : "g_log"), |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
193 | "%s\n", new_msg); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
194 | |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
195 | g_free(new_msg); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
196 | } |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
197 | |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
198 | g_free(new_domain); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
199 | } |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
200 | |
|
14923
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
201 | static void |
|
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
202 | size_changed_cb(GntWidget *widget, int oldw, int oldh) |
|
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
203 | { |
|
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
204 | int w, h; |
|
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
205 | gnt_widget_get_size(widget, &w, &h); |
| 15884 | 206 | purple_prefs_set_int(PREF_ROOT "/size/width", w); |
| 207 | purple_prefs_set_int(PREF_ROOT "/size/height", h); | |
|
14923
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
208 | } |
|
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
209 | |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
210 | static gboolean |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
211 | for_real(gpointer entry) |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
212 | { |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
213 | purple_prefs_set_string(PREF_ROOT "/filter", gnt_entry_get_text(entry)); |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
214 | return FALSE; |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
215 | } |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
216 | |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
217 | static void |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
218 | update_filter_string(GntEntry *entry, gpointer null) |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
219 | { |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
220 | int id = g_timeout_add(1000, for_real, entry); |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
221 | g_object_set_data_full(G_OBJECT(entry), "update-filter", GINT_TO_POINTER(id), |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
222 | (GDestroyNotify)g_source_remove); |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
223 | } |
|
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
224 | |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
225 | static void |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
226 | file_save(GntFileSel *fs, const char *path, const char *file, GntTextView *tv) |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
227 | { |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
228 | FILE *fp; |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
229 | |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
230 | if ((fp = g_fopen(path, "w+")) == NULL) { |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
231 | purple_notify_error(NULL, NULL, _("Unable to open file."), NULL); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
232 | return; |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
233 | } |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
234 | |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
235 | fprintf(fp, "Finch Debug Log : %s\n", purple_date_format_full(NULL)); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
236 | fprintf(fp, tv->string->str); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
237 | fclose(fp); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
238 | gnt_widget_destroy(GNT_WIDGET(fs)); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
239 | } |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
240 | |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
241 | static void |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
242 | file_cancel(GntWidget *w, GntFileSel *fs) |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
243 | { |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
244 | gnt_widget_destroy(GNT_WIDGET(fs)); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
245 | } |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
246 | |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
247 | static void |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
248 | save_debug_win(GntWidget *w, GntTextView *tv) |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
249 | { |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
250 | GntWidget *window = gnt_file_sel_new(); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
251 | GntFileSel *sel = GNT_FILE_SEL(window); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
252 | gnt_file_sel_set_current_location(sel, purple_home_dir()); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
253 | gnt_file_sel_set_suggested_filename(sel, "debug.txt"); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
254 | g_signal_connect(G_OBJECT(sel), "file_selected", G_CALLBACK(file_save), tv); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
255 | g_signal_connect(G_OBJECT(sel->cancel), "activate", G_CALLBACK(file_cancel), sel); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
256 | gnt_widget_show(window); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
257 | } |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
258 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15701
diff
changeset
|
259 | void finch_debug_window_show() |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
260 | { |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
261 | GntWidget *wid, *box, *label; |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
262 | |
|
14906
fdf387cc4b12
[gaim-migrate @ 17613]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14775
diff
changeset
|
263 | debug.paused = FALSE; |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
264 | if (debug.window) { |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
265 | gnt_window_present(debug.window); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
266 | return; |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
267 | } |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
268 | |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
269 | debug.window = gnt_vbox_new(FALSE); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
270 | gnt_box_set_toplevel(GNT_BOX(debug.window), TRUE); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
271 | gnt_box_set_title(GNT_BOX(debug.window), _("Debug Window")); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
272 | gnt_box_set_pad(GNT_BOX(debug.window), 0); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
273 | gnt_box_set_alignment(GNT_BOX(debug.window), GNT_ALIGN_MID); |
|
14047
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
274 | |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
275 | debug.tview = gnt_text_view_new(); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
276 | gnt_box_add_widget(GNT_BOX(debug.window), debug.tview); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
277 | gnt_widget_set_size(debug.tview, |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
278 | purple_prefs_get_int(PREF_ROOT "/size/width"), |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
279 | purple_prefs_get_int(PREF_ROOT "/size/height")); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
280 | g_signal_connect(G_OBJECT(debug.tview), "size_changed", G_CALLBACK(size_changed_cb), NULL); |
| 14755 | 281 | |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
282 | gnt_box_add_widget(GNT_BOX(debug.window), gnt_line_new(FALSE)); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
283 | |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
284 | box = gnt_hbox_new(FALSE); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
285 | gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
286 | gnt_box_set_fill(GNT_BOX(box), FALSE); |
| 14755 | 287 | |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
288 | /* XXX: Setting the GROW_Y for the following widgets don't make sense. But right now |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
289 | * it's necessary to make the width of the debug window resizable ... like I said, |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
290 | * it doesn't make sense. The bug is likely in the packing in gntbox.c. |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
291 | */ |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
292 | wid = gnt_button_new(_("Clear")); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
293 | g_signal_connect(G_OBJECT(wid), "activate", G_CALLBACK(clear_debug_win), debug.tview); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
294 | GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
295 | gnt_box_add_widget(GNT_BOX(box), wid); |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
296 | |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
297 | wid = gnt_button_new(_("Save")); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
298 | g_signal_connect(G_OBJECT(wid), "activate", G_CALLBACK(save_debug_win), debug.tview); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
299 | GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
300 | gnt_box_add_widget(GNT_BOX(box), wid); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
301 | |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
302 | debug.search = gnt_entry_new(purple_prefs_get_string(PREF_ROOT "/filter")); |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
303 | label = gnt_label_new(_("Filter:")); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
304 | GNT_WIDGET_UNSET_FLAGS(label, GNT_WIDGET_GROW_X); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20330
diff
changeset
|
305 | gnt_box_add_widget(GNT_BOX(box), label); |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
306 | gnt_box_add_widget(GNT_BOX(box), debug.search); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
307 | g_signal_connect(G_OBJECT(debug.search), "text_changed", G_CALLBACK(update_filter_string), NULL); |
| 14755 | 308 | |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
309 | wid = gnt_check_box_new(_("Pause")); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
310 | g_signal_connect(G_OBJECT(wid), "toggled", G_CALLBACK(toggle_pause), NULL); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
311 | GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
312 | gnt_box_add_widget(GNT_BOX(box), wid); |
| 14755 | 313 | |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
314 | gnt_box_add_widget(GNT_BOX(debug.window), box); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
315 | GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_GROW_Y); |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
316 | |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
317 | gnt_widget_set_name(debug.window, "debug-window"); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
318 | |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
319 | g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL); |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
320 | gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(debug.tview), debug.window); |
|
18605
76230f659c3f
Use the utility function for the conversation and debug windows.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18400
diff
changeset
|
321 | gnt_text_view_attach_pager_widget(GNT_TEXT_VIEW(debug.tview), debug.window); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
322 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
323 | gnt_widget_show(debug.window); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
324 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
325 | |
|
14336
f6d0cb054557
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14187
diff
changeset
|
326 | static gboolean |
|
f6d0cb054557
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14187
diff
changeset
|
327 | start_with_debugwin(gpointer null) |
|
f6d0cb054557
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14187
diff
changeset
|
328 | { |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15701
diff
changeset
|
329 | finch_debug_window_show(); |
|
14336
f6d0cb054557
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14187
diff
changeset
|
330 | return FALSE; |
|
f6d0cb054557
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14187
diff
changeset
|
331 | } |
|
f6d0cb054557
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14187
diff
changeset
|
332 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15701
diff
changeset
|
333 | void finch_debug_init() |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
334 | { |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
335 | /* Xerox */ |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
336 | #define REGISTER_G_LOG_HANDLER(name) \ |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
337 | g_log_set_handler((name), G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL \ |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
338 | | G_LOG_FLAG_RECURSION, \ |
| 15884 | 339 | purple_glib_log_handler, NULL) |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
340 | |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
341 | /* Register the glib log handlers. */ |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
342 | REGISTER_G_LOG_HANDLER(NULL); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
343 | REGISTER_G_LOG_HANDLER("GLib"); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
344 | REGISTER_G_LOG_HANDLER("GModule"); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
345 | REGISTER_G_LOG_HANDLER("GLib-GObject"); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
346 | REGISTER_G_LOG_HANDLER("GThread"); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
347 | |
|
14187
881ec8710386
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
348 | g_set_print_handler(print_stderr); /* Redirect the debug messages to stderr */ |
|
18637
c0bba39ab93b
If debug is enabled using the -d argument, then do not suppress the outputs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18605
diff
changeset
|
349 | if (!purple_debug_is_enabled()) |
|
c0bba39ab93b
If debug is enabled using the -d argument, then do not suppress the outputs
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18605
diff
changeset
|
350 | g_set_printerr_handler(suppress_error_messages); |
|
14923
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
351 | |
| 15884 | 352 | purple_prefs_add_none(PREF_ROOT); |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
353 | purple_prefs_add_string(PREF_ROOT "/filter", ""); |
| 15884 | 354 | purple_prefs_add_none(PREF_ROOT "/size"); |
| 355 | purple_prefs_add_int(PREF_ROOT "/size/width", 60); | |
| 356 | purple_prefs_add_int(PREF_ROOT "/size/height", 15); | |
|
14923
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
357 | |
| 15884 | 358 | if (purple_debug_is_enabled()) |
|
14336
f6d0cb054557
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14187
diff
changeset
|
359 | g_timeout_add(0, start_with_debugwin, NULL); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
360 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
361 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15701
diff
changeset
|
362 | void finch_debug_uninit() |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
363 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
364 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
365 |