finch/gntdebug.c

Wed, 05 Sep 2007 00:47:58 +0000

author
Sean Egan <seanegan@pidgin.im>
date
Wed, 05 Sep 2007 00:47:58 +0000
branch
vv
changeset 19882
d8c2a2fc1fbf
parent 18637
c0bba39ab93b
child 22069
841d24b3a2bc
permissions
-rw-r--r--

Basic Google Talk voice call support. No UI; receiving a call auto-accepts it.

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 */
19882
d8c2a2fc1fbf Basic Google Talk voice call support. No UI; receiving a call auto-accepts it.
Sean Egan <seanegan@pidgin.im>
parents: 18637
diff changeset
25 #include "util.h"
d8c2a2fc1fbf Basic Google Talk voice call support. No UI; receiving a call auto-accepts it.
Sean Egan <seanegan@pidgin.im>
parents: 18637
diff changeset
26
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
27 #include <gnt.h>
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
28 #include <gntbox.h>
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
29 #include <gntbutton.h>
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
30 #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
31 #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
32 #include <gntlabel.h>
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
37 #include "finch.h"
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
38
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
39 #include <stdio.h>
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
40 #include <string.h>
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
41
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
42 #define PREF_ROOT "/finch/debug"
14923
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
43
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
44 static struct
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
45 {
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
46 GntWidget *window;
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
47 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
48 GntWidget *search;
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
49 gboolean paused;
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
50 } debug;
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
51
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
52 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
53 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
54 {
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 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
56 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
57 return TRUE;
17064
e081c1d7ceb4 Fix debug filtering.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17056
diff changeset
58 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
59 return TRUE;
17064
e081c1d7ceb4 Fix debug filtering.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17056
diff changeset
60 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
61 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
62 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
63 }
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
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
65 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
66 finch_debug_print(PurpleDebugLevel level, const char *category,
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
67 const char *args)
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
68 {
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
69 if (debug.window && !debug.paused && match_string(category, args))
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
70 {
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
71 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
72 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
73 const char *mdate;
6ff1c7174836 The timestamp pref has been removed. Update finch accordingly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16748
diff changeset
74 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
75 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
76 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
77 mdate, flag);
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
78
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
79 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
80 category, GNT_TEXT_FLAG_BOLD);
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 ": ", GNT_TEXT_FLAG_BOLD);
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
83
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
84 switch (level)
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
85 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
86 case PURPLE_DEBUG_WARNING:
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
87 flag |= GNT_TEXT_FLAG_UNDERLINE;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
88 case PURPLE_DEBUG_ERROR:
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
89 case PURPLE_DEBUG_FATAL:
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
90 flag |= GNT_TEXT_FLAG_BOLD;
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
91 break;
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
92 default:
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 }
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
95
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
96 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
97 if (pos <= 1)
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
98 gnt_text_view_scroll(GNT_TEXT_VIEW(debug.tview), 0);
14045
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 }
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
101
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
102 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
103 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
104 {
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 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
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
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
108 static PurpleDebugUiOps uiops =
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
109 {
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15701
diff changeset
110 finch_debug_print,
16748
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16478
diff changeset
111 finch_debug_is_enabled,
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16478
diff changeset
112
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16478
diff changeset
113 /* padding */
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,
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16478
diff changeset
117 NULL
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
118 };
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
119
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
120 PurpleDebugUiOps *finch_debug_get_ui_ops()
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
121 {
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
122 return &uiops;
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
14047
764a70ebfdc5 [gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14045
diff changeset
125 static void
764a70ebfdc5 [gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14045
diff changeset
126 reset_debug_win(GntWidget *w, gpointer null)
764a70ebfdc5 [gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14045
diff changeset
127 {
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
128 debug.window = debug.tview = debug.search = NULL;
14047
764a70ebfdc5 [gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14045
diff changeset
129 }
764a70ebfdc5 [gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14045
diff changeset
130
14187
881ec8710386 [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
131 static void
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
132 clear_debug_win(GntWidget *w, GntTextView *tv)
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
133 {
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
134 gnt_text_view_clear(tv);
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
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
137 static void
14187
881ec8710386 [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
138 print_stderr(const char *string)
881ec8710386 [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
139 {
881ec8710386 [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
140 g_printerr("%s", 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
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
143 static void
15701
26f94dd0764a Suppress debug messages from libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14939
diff changeset
144 suppress_error_messages(const char *message)
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
26f94dd0764a Suppress debug messages from libgnt.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14939
diff changeset
147 static void
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
148 toggle_pause(GntWidget *w, gpointer n)
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
149 {
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
150 debug.paused = !debug.paused;
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
151 }
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
152
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
153 /* Xerox */
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
154 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
155 purple_glib_log_handler(const gchar *domain, GLogLevelFlags flags,
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
156 const gchar *msg, gpointer user_data)
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
157 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
158 PurpleDebugLevel level;
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
159 char *new_msg = NULL;
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
160 char *new_domain = NULL;
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
161
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
162 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
163 level = PURPLE_DEBUG_ERROR;
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
164 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
165 level = PURPLE_DEBUG_FATAL;
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
166 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
167 level = PURPLE_DEBUG_WARNING;
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
168 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
169 level = PURPLE_DEBUG_INFO;
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
170 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
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_DEBUG) == G_LOG_LEVEL_DEBUG)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
173 level = PURPLE_DEBUG_MISC;
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
174 else
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
175 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
176 purple_debug_warning("gntdebug",
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
177 "Unknown glib logging level in %d\n", flags);
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
178
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
179 level = PURPLE_DEBUG_MISC; /* This will never happen. */
14771
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
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
182 if (msg != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
183 new_msg = purple_utf8_try_convert(msg);
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
184
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
185 if (domain != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
186 new_domain = purple_utf8_try_convert(domain);
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
187
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
188 if (new_msg != NULL)
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
189 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
190 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
191 "%s\n", new_msg);
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
192
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
193 g_free(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
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
196 g_free(new_domain);
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
14923
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
199 static void
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
200 size_changed_cb(GntWidget *widget, int oldw, int oldh)
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
201 {
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
202 int w, h;
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
203 gnt_widget_get_size(widget, &w, &h);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
204 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
205 purple_prefs_set_int(PREF_ROOT "/size/height", h);
14923
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
206 }
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
207
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
208 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
209 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
210 {
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 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
212 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
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
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 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
216 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
217 {
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 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
219 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
220 (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
221 }
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
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15701
diff changeset
223 void finch_debug_window_show()
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
224 {
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
225 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
226
14906
fdf387cc4b12 [gaim-migrate @ 17613]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14775
diff changeset
227 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
228 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
229 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
230 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
231 }
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
232
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
233 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
234 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
235 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
236 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
237 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
238
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
239 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
240 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
241 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
242 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
243 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
244 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
245
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
246 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
247
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 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
249 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
250 gnt_box_set_fill(GNT_BOX(box), FALSE);
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
251
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
252 /* 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
253 * 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
254 * 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
255 */
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 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
257 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
258 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
259 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
260
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
261 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
262 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
263 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
264 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
265
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
266 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
267 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
268 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
269 gnt_box_add_widget(GNT_BOX(box), wid);
14755
2f4f8ff1c22e [gaim-migrate @ 17445]
Richard Nelson <wabz@pidgin.im>
parents: 14620
diff changeset
270
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
271 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
272 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_GROW_Y);
14121
3d8804b82150 [gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14072
diff changeset
273
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
274 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
275
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 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
277 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
278 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
279
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
280 gnt_widget_show(debug.window);
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
281 }
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
282
14336
f6d0cb054557 [gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14187
diff changeset
283 static gboolean
f6d0cb054557 [gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14187
diff changeset
284 start_with_debugwin(gpointer null)
f6d0cb054557 [gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14187
diff changeset
285 {
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15701
diff changeset
286 finch_debug_window_show();
14336
f6d0cb054557 [gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14187
diff changeset
287 return FALSE;
f6d0cb054557 [gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14187
diff changeset
288 }
f6d0cb054557 [gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14187
diff changeset
289
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15701
diff changeset
290 void finch_debug_init()
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
291 {
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
292 /* Xerox */
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
293 #define REGISTER_G_LOG_HANDLER(name) \
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
294 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
295 | G_LOG_FLAG_RECURSION, \
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
296 purple_glib_log_handler, NULL)
14771
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
297
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
298 /* Register the glib log handlers. */
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
299 REGISTER_G_LOG_HANDLER(NULL);
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
300 REGISTER_G_LOG_HANDLER("GLib");
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
301 REGISTER_G_LOG_HANDLER("GModule");
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
302 REGISTER_G_LOG_HANDLER("GLib-GObject");
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
303 REGISTER_G_LOG_HANDLER("GThread");
c9740405d914 [gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14755
diff changeset
304
14187
881ec8710386 [gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14121
diff changeset
305 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
306 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
307 g_set_printerr_handler(suppress_error_messages);
14923
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
308
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
309 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
310 purple_prefs_add_string(PREF_ROOT "/filter", "");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
311 purple_prefs_add_none(PREF_ROOT "/size");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
312 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
313 purple_prefs_add_int(PREF_ROOT "/size/height", 15);
14923
ccb42b285510 [gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14906
diff changeset
314
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
315 if (purple_debug_is_enabled())
14336
f6d0cb054557 [gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14187
diff changeset
316 g_timeout_add(0, start_with_debugwin, NULL);
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
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15701
diff changeset
319 void finch_debug_uninit()
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
320 {
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
321 }
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
322

mercurial