finch/gntdebug.c

Thu, 28 Jun 2007 18:52:26 +0000

author
Sadrul Habib Chowdhury <sadrul@pidgin.im>
date
Thu, 28 Jun 2007 18:52:26 +0000
changeset 18400
549820f4725c
parent 17064
e081c1d7ceb4
child 18430
3030d58da117
child 18605
76230f659c3f
permissions
-rw-r--r--

If the action-windows are already there, then bring them to front when
requested.

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
14620
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14336
diff changeset
4 *
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15906
diff changeset
5 * finch
14620
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14336
diff changeset
6 *
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15906
diff changeset
7 * 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
8 * 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
9 * source distribution.
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14336
diff changeset
10 *
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14336
diff changeset
11 * 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
12 * 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
13 * 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
14 * (at your option) any later version.
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14336
diff changeset
15 *
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14336
diff changeset
16 * 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
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14336
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14336
diff changeset
19 * GNU General Public License for more details.
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14336
diff changeset
20 *
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14336
diff changeset
21 * 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
22 * along with this program; if not, write to the Free Software
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14336
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14336
diff changeset
24 */
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
25 #include <gnt.h>
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
26 #include <gntbox.h>
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
27 #include <gntbutton.h>
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
28 #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
29 #include <gntentry.h>
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 <gntlabel.h>
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
31 #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
32 #include <gnttextview.h>
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
33
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
34 #include "gntdebug.h"
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
35 #include "finch.h"
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
36 #include "util.h"
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
37
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
38 #include <stdio.h>
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
39 #include <string.h>
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
40
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
41 #define PREF_ROOT "/finch/debug"
14923
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
42
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
43 static struct
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
44 {
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
45 GntWidget *window;
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
46 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
47 GntWidget *search;
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
48 gboolean paused;
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
49 } debug;
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
50
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
51 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
52 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
53 {
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 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
55 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
56 return TRUE;
17064
e081c1d7ceb4 Fix debug filtering.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17056
diff changeset
57 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
58 return TRUE;
17064
e081c1d7ceb4 Fix debug filtering.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17056
diff changeset
59 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
60 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
61 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
62 }
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
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
64 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
65 finch_debug_print(PurpleDebugLevel level, const char *category,
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
66 const char *args)
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
67 {
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
68 if (debug.window && !debug.paused && match_string(category, args))
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
69 {
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
70 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
71 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
72 const char *mdate;
6ff1c7174836 The timestamp pref has been removed. Update finch accordingly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16748
diff changeset
73 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
74 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
75 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
76 mdate, flag);
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
77
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
78 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
79 category, GNT_TEXT_FLAG_BOLD);
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
80 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
81 ": ", GNT_TEXT_FLAG_BOLD);
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
82
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
83 switch (level)
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
84 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
85 case PURPLE_DEBUG_WARNING:
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
86 flag |= GNT_TEXT_FLAG_UNDERLINE;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
87 case PURPLE_DEBUG_ERROR:
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
88 case PURPLE_DEBUG_FATAL:
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
89 flag |= GNT_TEXT_FLAG_BOLD;
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
90 break;
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
91 default:
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
92 break;
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
93 }
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
94
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
95 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), args, flag);
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
96 if (pos <= 1)
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
97 gnt_text_view_scroll(GNT_TEXT_VIEW(debug.tview), 0);
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
98 }
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
99 }
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
100
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
101 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
102 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
103 {
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 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
105 }
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
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
107 static PurpleDebugUiOps uiops =
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
108 {
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15701
diff changeset
109 finch_debug_print,
16748
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16478
diff changeset
110 finch_debug_is_enabled,
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16478
diff changeset
111
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16478
diff changeset
112 /* padding */
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16478
diff changeset
113 NULL,
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16478
diff changeset
114 NULL,
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16478
diff changeset
115 NULL,
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16478
diff changeset
116 NULL
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
117 };
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
118
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
119 PurpleDebugUiOps *finch_debug_get_ui_ops()
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 return &uiops;
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
122 }
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
123
14047
764a70ebfdc5 [gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14045
diff changeset
124 static void
764a70ebfdc5 [gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14045
diff changeset
125 reset_debug_win(GntWidget *w, gpointer null)
764a70ebfdc5 [gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14045
diff changeset
126 {
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
127 debug.window = debug.tview = debug.search = NULL;
14047
764a70ebfdc5 [gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14045
diff changeset
128 }
764a70ebfdc5 [gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14045
diff changeset
129
14187
881ec8710386 [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
130 static void
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
131 clear_debug_win(GntWidget *w, GntTextView *tv)
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
132 {
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
133 gnt_text_view_clear(tv);
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
134 }
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
135
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
136 static void
14187
881ec8710386 [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
137 print_stderr(const char *string)
881ec8710386 [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
138 {
881ec8710386 [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
139 g_printerr("%s", string);
881ec8710386 [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
140 }
881ec8710386 [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
141
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
142 static void
15701
26f94dd0764a Suppress debug messages from libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14939
diff changeset
143 suppress_error_messages(const char *message)
26f94dd0764a Suppress debug messages from libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14939
diff changeset
144 {}
26f94dd0764a Suppress debug messages from libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14939
diff changeset
145
26f94dd0764a Suppress debug messages from libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14939
diff changeset
146 static void
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
147 toggle_pause(GntWidget *w, gpointer n)
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
148 {
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
149 debug.paused = !debug.paused;
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
150 }
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
151
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
152 /* Xerox */
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
153 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
154 purple_glib_log_handler(const gchar *domain, GLogLevelFlags flags,
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
155 const gchar *msg, gpointer user_data)
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
156 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
157 PurpleDebugLevel level;
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
158 char *new_msg = NULL;
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
159 char *new_domain = NULL;
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
160
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
161 if ((flags & G_LOG_LEVEL_ERROR) == G_LOG_LEVEL_ERROR)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
162 level = PURPLE_DEBUG_ERROR;
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
163 else if ((flags & G_LOG_LEVEL_CRITICAL) == G_LOG_LEVEL_CRITICAL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
164 level = PURPLE_DEBUG_FATAL;
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
165 else if ((flags & G_LOG_LEVEL_WARNING) == G_LOG_LEVEL_WARNING)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
166 level = PURPLE_DEBUG_WARNING;
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
167 else if ((flags & G_LOG_LEVEL_MESSAGE) == G_LOG_LEVEL_MESSAGE)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
168 level = PURPLE_DEBUG_INFO;
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
169 else if ((flags & G_LOG_LEVEL_INFO) == G_LOG_LEVEL_INFO)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
170 level = PURPLE_DEBUG_INFO;
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
171 else if ((flags & G_LOG_LEVEL_DEBUG) == G_LOG_LEVEL_DEBUG)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
172 level = PURPLE_DEBUG_MISC;
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
173 else
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
174 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
175 purple_debug_warning("gntdebug",
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
176 "Unknown glib logging level in %d\n", flags);
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
177
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
178 level = PURPLE_DEBUG_MISC; /* This will never happen. */
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
179 }
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
180
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
181 if (msg != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
182 new_msg = purple_utf8_try_convert(msg);
14771
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 (domain != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
185 new_domain = purple_utf8_try_convert(domain);
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 (new_msg != NULL)
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
188 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
189 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
190 "%s\n", new_msg);
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
191
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
192 g_free(new_msg);
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
193 }
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_domain);
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
14923
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
198 static void
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
199 size_changed_cb(GntWidget *widget, int oldw, int oldh)
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
200 {
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
201 int w, h;
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
202 gnt_widget_get_size(widget, &w, &h);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
203 purple_prefs_set_int(PREF_ROOT "/size/width", w);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
204 purple_prefs_set_int(PREF_ROOT "/size/height", h);
14923
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
205 }
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
206
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
207 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
208 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
209 {
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 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
211 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
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
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 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
215 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
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 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
218 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
219 (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
220 }
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
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15701
diff changeset
222 void finch_debug_window_show()
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
223 {
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
224 GntWidget *wid, *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
225
14906
fdf387cc4b12 [gaim-migrate @ 17613]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14775
diff changeset
226 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
227 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
228 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
229 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
230 }
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
231
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
232 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
233 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
234 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
235 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
236 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
237
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
238 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
239 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
240 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
241 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
242 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
243 g_signal_connect(G_OBJECT(debug.tview), "size_changed", G_CALLBACK(size_changed_cb), NULL);
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
244
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
245 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
246
549820f4725c If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17064
diff changeset
247 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
248 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
249 gnt_box_set_fill(GNT_BOX(box), FALSE);
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
250
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
251 /* 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
252 * 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
253 * 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
254 */
549820f4725c If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17064
diff changeset
255 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
256 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
257 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
258 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
259
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
260 debug.search = gnt_entry_new(purple_prefs_get_string(PREF_ROOT "/filter"));
549820f4725c If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17064
diff changeset
261 gnt_box_add_widget(GNT_BOX(box), gnt_label_new(_("Filter: ")));
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 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
263 g_signal_connect(G_OBJECT(debug.search), "text_changed", G_CALLBACK(update_filter_string), NULL);
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
264
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
265 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
266 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
267 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
268 gnt_box_add_widget(GNT_BOX(box), wid);
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
269
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
270 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
271 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_GROW_Y);
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
272
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
273 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
274
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 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
276 gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(debug.tview), debug.window);
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
277
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
278 gnt_widget_show(debug.window);
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
279 }
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
280
14336
f6d0cb054557 [gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14187
diff changeset
281 static gboolean
f6d0cb054557 [gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14187
diff changeset
282 start_with_debugwin(gpointer null)
f6d0cb054557 [gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14187
diff changeset
283 {
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15701
diff changeset
284 finch_debug_window_show();
14336
f6d0cb054557 [gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14187
diff changeset
285 return FALSE;
f6d0cb054557 [gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14187
diff changeset
286 }
f6d0cb054557 [gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14187
diff changeset
287
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15701
diff changeset
288 void finch_debug_init()
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
289 {
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
290 /* Xerox */
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
291 #define REGISTER_G_LOG_HANDLER(name) \
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
292 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
293 | G_LOG_FLAG_RECURSION, \
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
294 purple_glib_log_handler, NULL)
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
295
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
296 /* Register the glib log handlers. */
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
297 REGISTER_G_LOG_HANDLER(NULL);
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
298 REGISTER_G_LOG_HANDLER("GLib");
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
299 REGISTER_G_LOG_HANDLER("GModule");
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
300 REGISTER_G_LOG_HANDLER("GLib-GObject");
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
301 REGISTER_G_LOG_HANDLER("GThread");
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
302
14187
881ec8710386 [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
303 g_set_print_handler(print_stderr); /* Redirect the debug messages to stderr */
15701
26f94dd0764a Suppress debug messages from libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14939
diff changeset
304 g_set_printerr_handler(suppress_error_messages);
14923
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
305
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
306 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
307 purple_prefs_add_string(PREF_ROOT "/filter", "");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
308 purple_prefs_add_none(PREF_ROOT "/size");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
309 purple_prefs_add_int(PREF_ROOT "/size/width", 60);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
310 purple_prefs_add_int(PREF_ROOT "/size/height", 15);
14923
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
311
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
312 if (purple_debug_is_enabled())
14336
f6d0cb054557 [gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14187
diff changeset
313 g_timeout_add(0, start_with_debugwin, NULL);
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
314 }
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
315
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15701
diff changeset
316 void finch_debug_uninit()
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
317 {
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
318 }
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
319

mercurial