annotate finch/gntdebug.c @ 26033:366f68124622

Convert more PidginMedia signals to the newer API.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Tue, 13 Jan 2009 09:50:13 +0000
parents f0c2e27c7ae7
children 1c73d2ef9ddc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file gntdebug.c GNT Debug API
16194
0f0832c13fcb Rename the Doxygen group from gntui to finch and define the finch group
Richard Laager <rlaager@wiktel.com>
parents: 16124
diff changeset
3 * @ingroup finch
20074
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19681
diff changeset
4 */
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19681
diff changeset
5
6bf32c9e15a7 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents: 19681
diff changeset
6 /* finch
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
15870
66dff3dfdea6 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents: 15822
diff changeset
8 * Finch is the legal property of its developers, whose names are too numerous
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * source distribution.
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
19681
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 18454
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 */
23759
315151da0dc6 Basic Google Talk voice call support. No UI; receiving a call auto-accepts it.
Sean Egan <seanegan@gmail.com>
parents: 18454
diff changeset
26 #include "util.h"
315151da0dc6 Basic Google Talk voice call support. No UI; receiving a call auto-accepts it.
Sean Egan <seanegan@gmail.com>
parents: 18454
diff changeset
27
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include <gnt.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include <gntbox.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include <gntbutton.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include <gntcheckbox.h>
17000
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
32 #include <gntentry.h>
20672
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
33 #include <gntfilesel.h>
17000
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
34 #include <gntlabel.h>
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include <gntline.h>
17000
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
36 #include <gnttextview.h>
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 #include "gntdebug.h"
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
39 #include "finch.h"
20672
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
40 #include "notify.h"
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 #include <stdio.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 #include <string.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44
16424
4999bbc52881 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents: 16194
diff changeset
45 #define PREF_ROOT "/finch/debug"
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46
24883
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
47 static gboolean
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
48 handle_fprintf_stderr_cb(GIOChannel *source, GIOCondition cond, gpointer null)
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
49 {
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
50 gssize size;
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
51 char message[1024];
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
52
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
53 size = read(g_io_channel_unix_get_fd(source), message, sizeof(message) - 1);
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
54 if (size <= 0) {
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
55 /* Something bad probably happened elsewhere ... let's ignore */
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
56 } else {
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
57 message[size] = '\0';
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
58 g_log("stderr", G_LOG_LEVEL_WARNING, "%s", message);
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
59 }
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
60
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
61 return TRUE;
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
62 }
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
63
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
64 static void
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
65 handle_fprintf_stderr(gboolean stop)
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
66 {
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
67 GIOChannel *stderrch;
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
68 static int readhandle = -1;
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
69 int pipes[2];
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
70
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
71 if (stop) {
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
72 if (readhandle >= 0) {
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
73 g_source_remove(readhandle);
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
74 readhandle = -1;
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
75 }
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
76 return;
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
77 }
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
78 pipe(pipes);
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
79 dup2(pipes[1], STDERR_FILENO);
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
80
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
81 stderrch = g_io_channel_unix_new(pipes[0]);
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
82 g_io_channel_set_close_on_unref(stderrch, TRUE);
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
83 readhandle = g_io_add_watch_full(stderrch, G_PRIORITY_HIGH,
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
84 G_IO_IN | G_IO_ERR | G_IO_PRI,
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
85 handle_fprintf_stderr_cb, NULL, NULL);
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
86 g_io_channel_unref(stderrch);
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
87 }
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
88
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 static struct
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 GntWidget *window;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 GntWidget *tview;
17000
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
93 GntWidget *search;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 gboolean paused;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 } debug;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96
17000
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
97 static gboolean
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
98 match_string(const char *category, const char *args)
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
99 {
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
100 const char *str = gnt_entry_get_text(GNT_ENTRY(debug.search));
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
101 if (!str || !*str)
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
102 return TRUE;
17015
47a9ba4f4373 Fix debug filtering.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17000
diff changeset
103 if (g_strrstr(category, str) != NULL)
17000
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
104 return TRUE;
17015
47a9ba4f4373 Fix debug filtering.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17000
diff changeset
105 if (g_strrstr(args, str) != NULL)
17000
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
106 return TRUE;
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
107 return FALSE;
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
108 }
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
109
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
111 finch_debug_print(PurpleDebugLevel level, const char *category,
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 const char *args)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 {
17000
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
114 if (debug.window && !debug.paused && match_string(category, args))
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 int pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(debug.tview));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 GntTextFormatFlags flag = GNT_TEXT_FLAG_NORMAL;
16988
87748f771638 The timestamp pref has been removed. Update finch accordingly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16669
diff changeset
118 const char *mdate;
87748f771638 The timestamp pref has been removed. Update finch accordingly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16669
diff changeset
119 time_t mtime = time(NULL);
87748f771638 The timestamp pref has been removed. Update finch accordingly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16669
diff changeset
120 mdate = purple_utf8_strftime("%H:%M:%S ", localtime(&mtime));
87748f771638 The timestamp pref has been removed. Update finch accordingly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16669
diff changeset
121 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview),
87748f771638 The timestamp pref has been removed. Update finch accordingly.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16669
diff changeset
122 mdate, flag);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 category, GNT_TEXT_FLAG_BOLD);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 ": ", GNT_TEXT_FLAG_BOLD);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 switch (level)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
131 case PURPLE_DEBUG_WARNING:
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 flag |= GNT_TEXT_FLAG_UNDERLINE;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
133 case PURPLE_DEBUG_ERROR:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
134 case PURPLE_DEBUG_FATAL:
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 flag |= GNT_TEXT_FLAG_BOLD;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 break;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 default:
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 break;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), args, flag);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 if (pos <= 1)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 gnt_text_view_scroll(GNT_TEXT_VIEW(debug.tview), 0);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146
15985
6dc5dc83a61b Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <mark@kingant.net>
parents: 15870
diff changeset
147 static gboolean
6dc5dc83a61b Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <mark@kingant.net>
parents: 15870
diff changeset
148 finch_debug_is_enabled(PurpleDebugLevel level, const char *category)
6dc5dc83a61b Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <mark@kingant.net>
parents: 15870
diff changeset
149 {
6dc5dc83a61b Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <mark@kingant.net>
parents: 15870
diff changeset
150 return debug.window && !debug.paused;
6dc5dc83a61b Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <mark@kingant.net>
parents: 15870
diff changeset
151 }
6dc5dc83a61b Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <mark@kingant.net>
parents: 15870
diff changeset
152
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
153 static PurpleDebugUiOps uiops =
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 finch_debug_print,
16669
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16424
diff changeset
156 finch_debug_is_enabled,
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16424
diff changeset
157
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16424
diff changeset
158 /* padding */
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16424
diff changeset
159 NULL,
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16424
diff changeset
160 NULL,
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16424
diff changeset
161 NULL,
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16424
diff changeset
162 NULL
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 };
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
165 PurpleDebugUiOps *finch_debug_get_ui_ops()
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 return &uiops;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 reset_debug_win(GntWidget *w, gpointer null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 {
17000
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
173 debug.window = debug.tview = debug.search = NULL;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 clear_debug_win(GntWidget *w, GntTextView *tv)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 gnt_text_view_clear(tv);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 print_stderr(const char *string)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 g_printerr("%s", string);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 toggle_pause(GntWidget *w, gpointer n)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 debug.paused = !debug.paused;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 /* Xerox */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
196 purple_glib_log_handler(const gchar *domain, GLogLevelFlags flags,
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 const gchar *msg, gpointer user_data)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
199 PurpleDebugLevel level;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 char *new_msg = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 char *new_domain = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 if ((flags & G_LOG_LEVEL_ERROR) == G_LOG_LEVEL_ERROR)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
204 level = PURPLE_DEBUG_ERROR;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 else if ((flags & G_LOG_LEVEL_CRITICAL) == G_LOG_LEVEL_CRITICAL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
206 level = PURPLE_DEBUG_FATAL;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 else if ((flags & G_LOG_LEVEL_WARNING) == G_LOG_LEVEL_WARNING)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
208 level = PURPLE_DEBUG_WARNING;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 else if ((flags & G_LOG_LEVEL_MESSAGE) == G_LOG_LEVEL_MESSAGE)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
210 level = PURPLE_DEBUG_INFO;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 else if ((flags & G_LOG_LEVEL_INFO) == G_LOG_LEVEL_INFO)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
212 level = PURPLE_DEBUG_INFO;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 else if ((flags & G_LOG_LEVEL_DEBUG) == G_LOG_LEVEL_DEBUG)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
214 level = PURPLE_DEBUG_MISC;
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
217 purple_debug_warning("gntdebug",
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 "Unknown glib logging level in %d\n", flags);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
220 level = PURPLE_DEBUG_MISC; /* This will never happen. */
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 if (msg != NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
224 new_msg = purple_utf8_try_convert(msg);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 if (domain != NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
227 new_domain = purple_utf8_try_convert(domain);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 if (new_msg != NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
231 purple_debug(level, (new_domain != NULL ? new_domain : "g_log"),
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 "%s\n", new_msg);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 g_free(new_msg);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 g_free(new_domain);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 size_changed_cb(GntWidget *widget, int oldw, int oldh)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 int w, h;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 gnt_widget_get_size(widget, &w, &h);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
245 purple_prefs_set_int(PREF_ROOT "/size/width", w);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
246 purple_prefs_set_int(PREF_ROOT "/size/height", h);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248
17000
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
249 static gboolean
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
250 for_real(gpointer entry)
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
251 {
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
252 purple_prefs_set_string(PREF_ROOT "/filter", gnt_entry_get_text(entry));
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
253 return FALSE;
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
254 }
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
255
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
256 static void
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
257 update_filter_string(GntEntry *entry, gpointer null)
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
258 {
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
259 int id = g_timeout_add(1000, for_real, entry);
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
260 g_object_set_data_full(G_OBJECT(entry), "update-filter", GINT_TO_POINTER(id),
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
261 (GDestroyNotify)g_source_remove);
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
262 }
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
263
20672
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
264 static void
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
265 file_save(GntFileSel *fs, const char *path, const char *file, GntTextView *tv)
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
266 {
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
267 FILE *fp;
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
268
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
269 if ((fp = g_fopen(path, "w+")) == NULL) {
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
270 purple_notify_error(NULL, NULL, _("Unable to open file."), NULL);
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
271 return;
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
272 }
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
273
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
274 fprintf(fp, "Finch Debug Log : %s\n", purple_date_format_full(NULL));
24453
0320b4a33432 Backport the 'purple_debug_*(msg)' -> 'purple_debug_*("%s", msg);' fixes.
Richard Laager <rlaager@wiktel.com>
parents: 21796
diff changeset
275 fprintf(fp, "%s", tv->string->str);
20672
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
276 fclose(fp);
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
277 gnt_widget_destroy(GNT_WIDGET(fs));
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
278 }
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
279
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
280 static void
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
281 file_cancel(GntWidget *w, GntFileSel *fs)
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
282 {
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
283 gnt_widget_destroy(GNT_WIDGET(fs));
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
284 }
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
285
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
286 static void
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
287 save_debug_win(GntWidget *w, GntTextView *tv)
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
288 {
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
289 GntWidget *window = gnt_file_sel_new();
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
290 GntFileSel *sel = GNT_FILE_SEL(window);
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
291 gnt_file_sel_set_current_location(sel, purple_home_dir());
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
292 gnt_file_sel_set_suggested_filename(sel, "debug.txt");
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
293 g_signal_connect(G_OBJECT(sel), "file_selected", G_CALLBACK(file_save), tv);
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
294 g_signal_connect(G_OBJECT(sel->cancel), "activate", G_CALLBACK(file_cancel), sel);
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
295 gnt_widget_show(window);
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
296 }
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
297
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 void finch_debug_window_show()
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 {
20672
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
300 GntWidget *wid, *box, *label;
18345
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
301
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 debug.paused = FALSE;
18345
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
303 if (debug.window) {
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
304 gnt_window_present(debug.window);
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
305 return;
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
306 }
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307
18345
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
308 debug.window = gnt_vbox_new(FALSE);
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
309 gnt_box_set_toplevel(GNT_BOX(debug.window), TRUE);
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
310 gnt_box_set_title(GNT_BOX(debug.window), _("Debug Window"));
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
311 gnt_box_set_pad(GNT_BOX(debug.window), 0);
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
312 gnt_box_set_alignment(GNT_BOX(debug.window), GNT_ALIGN_MID);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313
18345
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
314 debug.tview = gnt_text_view_new();
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
315 gnt_box_add_widget(GNT_BOX(debug.window), debug.tview);
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
316 gnt_widget_set_size(debug.tview,
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
317 purple_prefs_get_int(PREF_ROOT "/size/width"),
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
318 purple_prefs_get_int(PREF_ROOT "/size/height"));
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
319 g_signal_connect(G_OBJECT(debug.tview), "size_changed", G_CALLBACK(size_changed_cb), NULL);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320
18345
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
321 gnt_box_add_widget(GNT_BOX(debug.window), gnt_line_new(FALSE));
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
322
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
323 box = gnt_hbox_new(FALSE);
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
324 gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID);
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
325 gnt_box_set_fill(GNT_BOX(box), FALSE);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326
18345
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
327 /* XXX: Setting the GROW_Y for the following widgets don't make sense. But right now
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
328 * it's necessary to make the width of the debug window resizable ... like I said,
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
329 * it doesn't make sense. The bug is likely in the packing in gntbox.c.
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
330 */
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
331 wid = gnt_button_new(_("Clear"));
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
332 g_signal_connect(G_OBJECT(wid), "activate", G_CALLBACK(clear_debug_win), debug.tview);
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
333 GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y);
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
334 gnt_box_add_widget(GNT_BOX(box), wid);
17000
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
335
20672
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
336 wid = gnt_button_new(_("Save"));
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
337 g_signal_connect(G_OBJECT(wid), "activate", G_CALLBACK(save_debug_win), debug.tview);
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
338 GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y);
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
339 gnt_box_add_widget(GNT_BOX(box), wid);
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
340
18345
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
341 debug.search = gnt_entry_new(purple_prefs_get_string(PREF_ROOT "/filter"));
20672
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
342 label = gnt_label_new(_("Filter:"));
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
343 GNT_WIDGET_UNSET_FLAGS(label, GNT_WIDGET_GROW_X);
c8d4fe2cd0d7 Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents: 20074
diff changeset
344 gnt_box_add_widget(GNT_BOX(box), label);
18345
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
345 gnt_box_add_widget(GNT_BOX(box), debug.search);
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
346 g_signal_connect(G_OBJECT(debug.search), "text_changed", G_CALLBACK(update_filter_string), NULL);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347
18345
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
348 wid = gnt_check_box_new(_("Pause"));
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
349 g_signal_connect(G_OBJECT(wid), "toggled", G_CALLBACK(toggle_pause), NULL);
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
350 GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y);
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
351 gnt_box_add_widget(GNT_BOX(box), wid);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352
18345
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
353 gnt_box_add_widget(GNT_BOX(debug.window), box);
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
354 GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_GROW_Y);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355
18345
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
356 gnt_widget_set_name(debug.window, "debug-window");
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
357
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
358 g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL);
2d4df5ef0090 If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17015
diff changeset
359 gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(debug.tview), debug.window);
18427
be8c4eba38f6 Use the utility function for the conversation and debug windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18345
diff changeset
360 gnt_text_view_attach_pager_widget(GNT_TEXT_VIEW(debug.tview), debug.window);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 gnt_widget_show(debug.window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365 static gboolean
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 start_with_debugwin(gpointer null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 finch_debug_window_show();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 return FALSE;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372 void finch_debug_init()
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 /* Xerox */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 #define REGISTER_G_LOG_HANDLER(name) \
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 g_log_set_handler((name), G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL \
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377 | G_LOG_FLAG_RECURSION, \
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
378 purple_glib_log_handler, NULL)
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 /* Register the glib log handlers. */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 REGISTER_G_LOG_HANDLER(NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 REGISTER_G_LOG_HANDLER("GLib");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 REGISTER_G_LOG_HANDLER("GModule");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 REGISTER_G_LOG_HANDLER("GLib-GObject");
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 REGISTER_G_LOG_HANDLER("GThread");
24558
e2e57d3c0578 Use glib log functions to show error messages.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24453
diff changeset
386 REGISTER_G_LOG_HANDLER("Gnt");
21796
39e07c9ae0d7 Trap gstreamer error messages with our debug stuff so they don't get spewed
Stu Tomlinson <stu@nosnilmot.com>
parents: 20672
diff changeset
387 #ifdef USE_GSTREAMER
39e07c9ae0d7 Trap gstreamer error messages with our debug stuff so they don't get spewed
Stu Tomlinson <stu@nosnilmot.com>
parents: 20672
diff changeset
388 REGISTER_G_LOG_HANDLER("GStreamer");
39e07c9ae0d7 Trap gstreamer error messages with our debug stuff so they don't get spewed
Stu Tomlinson <stu@nosnilmot.com>
parents: 20672
diff changeset
389 #endif
23804
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23789
diff changeset
390 #ifdef USE_VV
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23769
diff changeset
391 #ifdef USE_FARSIGHT
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23769
diff changeset
392 REGISTER_G_LOG_HANDLER("farsight");
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23769
diff changeset
393 REGISTER_G_LOG_HANDLER("farsight-transmitter");
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23769
diff changeset
394 REGISTER_G_LOG_HANDLER("farsight-rtp");
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23769
diff changeset
395 #endif
23804
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23789
diff changeset
396 #endif
24883
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
397 REGISTER_G_LOG_HANDLER("stderr");
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 g_set_print_handler(print_stderr); /* Redirect the debug messages to stderr */
18454
6b623a59cec6 If debug is enabled using the -d argument, then do not suppress the outputs
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18427
diff changeset
400 if (!purple_debug_is_enabled())
24883
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
401 handle_fprintf_stderr(FALSE);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
403 purple_prefs_add_none(PREF_ROOT);
17000
531a4585d437 Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16988
diff changeset
404 purple_prefs_add_string(PREF_ROOT "/filter", "");
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
405 purple_prefs_add_none(PREF_ROOT "/size");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
406 purple_prefs_add_int(PREF_ROOT "/size/width", 60);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
407 purple_prefs_add_int(PREF_ROOT "/size/height", 15);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15817
diff changeset
409 if (purple_debug_is_enabled())
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 g_timeout_add(0, start_with_debugwin, NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 void finch_debug_uninit()
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 {
24883
bbcdb1786eda Redirect stderr to the debug window.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24558
diff changeset
415 handle_fprintf_stderr(TRUE);
15817
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417