Thu, 19 Dec 2019 14:25:49 +0100
Use gtk-doc comments (review pull request #632)
|
39887
9c8f874c74a0
Clean up all of the license headers
Gary Kramlich <grim@reaperworld.com>
parents:
39621
diff
changeset
|
1 | /* |
|
9c8f874c74a0
Clean up all of the license headers
Gary Kramlich <grim@reaperworld.com>
parents:
39621
diff
changeset
|
2 | * finch |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
3 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15906
diff
changeset
|
4 | * 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
|
5 | * 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
|
6 | * source distribution. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
7 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
8 | * 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
|
9 | * 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
|
10 | * 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
|
11 | * (at your option) any later version. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
12 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
13 | * 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
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
16 | * GNU General Public License for more details. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
17 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
18 | * 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
|
19 | * along with this program; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18637
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14336
diff
changeset
|
21 | */ |
|
29106
51c7b2177e42
Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <darkrain42@pidgin.im>
parents:
27829
diff
changeset
|
22 | |
|
51c7b2177e42
Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <darkrain42@pidgin.im>
parents:
27829
diff
changeset
|
23 | #include <internal.h> |
|
51c7b2177e42
Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <darkrain42@pidgin.im>
parents:
27829
diff
changeset
|
24 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
25 | #include <gnt.h> |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
26 | #include <gntbox.h> |
| 14755 | 27 | #include <gntbutton.h> |
| 28 | #include <gntcheckbox.h> | |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
29 | #include <gntentry.h> |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
30 | #include <gntfilesel.h> |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
31 | #include <gntlabel.h> |
| 14755 | 32 | #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
|
33 | #include <gnttextview.h> |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
34 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
35 | #include "gntdebug.h" |
| 15884 | 36 | #include "finch.h" |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
37 | #include "notify.h" |
|
26477
245d9650bb2b
Remove some extra edits that snuck into Finch.
Michael Ruprecht <maiku@pidgin.im>
parents:
26186
diff
changeset
|
38 | #include "util.h" |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
39 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
40 | #include <stdio.h> |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
41 | #include <string.h> |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
42 | |
|
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
|
43 | #define PREF_ROOT "/finch/debug" |
|
14923
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
44 | |
|
38644
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
45 | struct _FinchDebugUi |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
46 | { |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
47 | GObject parent; |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
48 | |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
49 | /* Other members, including private data. */ |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
50 | }; |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
51 | |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
52 | static void finch_debug_ui_finalize(GObject *gobject); |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
53 | static void finch_debug_ui_interface_init(PurpleDebugUiInterface *iface); |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
54 | |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
55 | G_DEFINE_TYPE_WITH_CODE(FinchDebugUi, finch_debug_ui, G_TYPE_OBJECT, |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
56 | G_IMPLEMENT_INTERFACE(PURPLE_TYPE_DEBUG_UI, |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
57 | finch_debug_ui_interface_init)); |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
58 | |
|
25321
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
59 | static gboolean |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
60 | handle_fprintf_stderr_cb(GIOChannel *source, GIOCondition cond, gpointer null) |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
61 | { |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
62 | gssize size; |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
63 | char message[1024]; |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
64 | |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
65 | size = read(g_io_channel_unix_get_fd(source), message, sizeof(message) - 1); |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
66 | if (size <= 0) { |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
67 | /* Something bad probably happened elsewhere ... let's ignore */ |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
68 | } else { |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
69 | message[size] = '\0'; |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
70 | g_log("stderr", G_LOG_LEVEL_WARNING, "%s", message); |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
71 | } |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
72 | |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
73 | return TRUE; |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
74 | } |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
75 | |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
76 | static void |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
77 | handle_fprintf_stderr(gboolean stop) |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
78 | { |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
79 | GIOChannel *stderrch; |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
80 | static int readhandle = -1; |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
81 | int pipes[2]; |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
82 | |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
83 | if (stop) { |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
84 | if (readhandle >= 0) { |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
85 | g_source_remove(readhandle); |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
86 | readhandle = -1; |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
87 | } |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
88 | return; |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
89 | } |
|
35877
6c3ab2fd4412
cross-win32: fix finch build
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35454
diff
changeset
|
90 | if (purple_input_pipe(pipes)) { |
|
30475
c6a00c98bf46
Get rid of this warning:
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
29106
diff
changeset
|
91 | readhandle = -1; |
|
c6a00c98bf46
Get rid of this warning:
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
29106
diff
changeset
|
92 | return; |
|
c6a00c98bf46
Get rid of this warning:
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
29106
diff
changeset
|
93 | }; |
|
25321
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
94 | dup2(pipes[1], STDERR_FILENO); |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
95 | |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
96 | stderrch = g_io_channel_unix_new(pipes[0]); |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
97 | g_io_channel_set_close_on_unref(stderrch, TRUE); |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
98 | readhandle = g_io_add_watch_full(stderrch, G_PRIORITY_HIGH, |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
99 | G_IO_IN | G_IO_ERR | G_IO_PRI, |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
100 | handle_fprintf_stderr_cb, NULL, NULL); |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
101 | g_io_channel_unref(stderrch); |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
102 | } |
|
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
103 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
104 | static struct |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
105 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
106 | GntWidget *window; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
107 | 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
|
108 | GntWidget *search; |
| 14755 | 109 | gboolean paused; |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
110 | } debug; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
111 | |
|
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
|
112 | 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
|
113 | 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
|
114 | { |
|
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
|
115 | 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
|
116 | 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
|
117 | return TRUE; |
|
17064
e081c1d7ceb4
Fix debug filtering.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17056
diff
changeset
|
118 | 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
|
119 | return TRUE; |
|
17064
e081c1d7ceb4
Fix debug filtering.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17056
diff
changeset
|
120 | 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
|
121 | 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
|
122 | 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
|
123 | } |
|
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
|
124 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
125 | static void |
|
38644
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
126 | finch_debug_print(PurpleDebugUi *self, |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
127 | PurpleDebugLevel level, const char *category, |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
128 | const char *args) |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
129 | { |
|
17056
10ca7f26479f
Now that timestamps are gone, let's allow filter strings in the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17043
diff
changeset
|
130 | if (debug.window && !debug.paused && match_string(category, args)) |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
131 | { |
| 14755 | 132 | 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
|
133 | 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
|
134 | const char *mdate; |
|
6ff1c7174836
The timestamp pref has been removed. Update finch accordingly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16748
diff
changeset
|
135 | 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
|
136 | 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
|
137 | 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
|
138 | mdate, flag); |
| 14755 | 139 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
140 | 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
|
141 | category, GNT_TEXT_FLAG_BOLD); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
142 | 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
|
143 | ": ", GNT_TEXT_FLAG_BOLD); |
| 14755 | 144 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
145 | switch (level) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
146 | { |
| 15884 | 147 | case PURPLE_DEBUG_WARNING: |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
148 | flag |= GNT_TEXT_FLAG_UNDERLINE; |
|
35966
d603bfb42fd9
Fix some coverity CWE-484 issues
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
30475
diff
changeset
|
149 | /* fall through */ |
| 15884 | 150 | case PURPLE_DEBUG_ERROR: |
| 151 | case PURPLE_DEBUG_FATAL: | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
152 | flag |= GNT_TEXT_FLAG_BOLD; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
153 | break; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
154 | default: |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
155 | break; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
156 | } |
| 14755 | 157 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
158 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), args, flag); |
|
34309
555e2bd38fb6
Add linefeeds to all debug log messages
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
30475
diff
changeset
|
159 | gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), "\n", GNT_TEXT_FLAG_NORMAL); |
| 14755 | 160 | if (pos <= 1) |
| 161 | gnt_text_view_scroll(GNT_TEXT_VIEW(debug.tview), 0); | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
162 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
163 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
164 | |
|
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
|
165 | static gboolean |
|
38644
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
166 | finch_debug_is_enabled(PurpleDebugUi *self, PurpleDebugLevel level, const char *category) |
|
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
|
167 | { |
|
257072807aa8
Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <markdoliner@pidgin.im>
parents:
15931
diff
changeset
|
168 | 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
|
169 | } |
|
257072807aa8
Add a whimpy ui op to the debug API that returns TRUE if debugging
Mark Doliner <markdoliner@pidgin.im>
parents:
15931
diff
changeset
|
170 | |
|
38644
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
171 | static void |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
172 | finch_debug_ui_interface_init(PurpleDebugUiInterface *iface) |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
173 | { |
|
38644
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
174 | iface->print = finch_debug_print; |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
175 | iface->is_enabled = finch_debug_is_enabled; |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
176 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
177 | |
|
14047
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
178 | static void |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
179 | reset_debug_win(GntWidget *w, gpointer null) |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
180 | { |
|
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
|
181 | debug.window = debug.tview = debug.search = NULL; |
|
14047
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
182 | } |
|
764a70ebfdc5
[gaim-migrate @ 16555]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
183 | |
|
14187
881ec8710386
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
184 | static void |
| 14755 | 185 | clear_debug_win(GntWidget *w, GntTextView *tv) |
| 186 | { | |
| 187 | gnt_text_view_clear(tv); | |
| 188 | } | |
| 189 | ||
| 190 | static void | |
|
14187
881ec8710386
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
191 | print_stderr(const char *string) |
|
881ec8710386
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
192 | { |
|
881ec8710386
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
193 | g_printerr("%s", string); |
|
881ec8710386
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
194 | } |
|
881ec8710386
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
195 | |
| 14755 | 196 | static void |
| 197 | toggle_pause(GntWidget *w, gpointer n) | |
| 198 | { | |
| 199 | debug.paused = !debug.paused; | |
| 200 | } | |
| 201 | ||
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
202 | /* Xerox */ |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
203 | static void |
| 15884 | 204 | purple_glib_log_handler(const gchar *domain, GLogLevelFlags flags, |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
205 | const gchar *msg, gpointer user_data) |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
206 | { |
| 15884 | 207 | PurpleDebugLevel level; |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
208 | char *new_msg = NULL; |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
209 | char *new_domain = NULL; |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
210 | |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
211 | if ((flags & G_LOG_LEVEL_ERROR) == G_LOG_LEVEL_ERROR) |
| 15884 | 212 | level = PURPLE_DEBUG_ERROR; |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
213 | else if ((flags & G_LOG_LEVEL_CRITICAL) == G_LOG_LEVEL_CRITICAL) |
| 15884 | 214 | level = PURPLE_DEBUG_FATAL; |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
215 | else if ((flags & G_LOG_LEVEL_WARNING) == G_LOG_LEVEL_WARNING) |
| 15884 | 216 | level = PURPLE_DEBUG_WARNING; |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
217 | else if ((flags & G_LOG_LEVEL_MESSAGE) == G_LOG_LEVEL_MESSAGE) |
| 15884 | 218 | level = PURPLE_DEBUG_INFO; |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
219 | else if ((flags & G_LOG_LEVEL_INFO) == G_LOG_LEVEL_INFO) |
| 15884 | 220 | level = PURPLE_DEBUG_INFO; |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
221 | else if ((flags & G_LOG_LEVEL_DEBUG) == G_LOG_LEVEL_DEBUG) |
| 15884 | 222 | level = PURPLE_DEBUG_MISC; |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
223 | else |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
224 | { |
| 15884 | 225 | purple_debug_warning("gntdebug", |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
226 | "Unknown glib logging level in %d\n", flags); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
227 | |
| 15884 | 228 | level = PURPLE_DEBUG_MISC; /* This will never happen. */ |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
229 | } |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
230 | |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
231 | if (msg != NULL) |
| 15884 | 232 | new_msg = purple_utf8_try_convert(msg); |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
233 | |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
234 | if (domain != NULL) |
| 15884 | 235 | new_domain = purple_utf8_try_convert(domain); |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
236 | |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
237 | if (new_msg != NULL) |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
238 | { |
| 15884 | 239 | 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
|
240 | "%s\n", new_msg); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
241 | |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
242 | g_free(new_msg); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
243 | } |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
244 | |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
245 | g_free(new_domain); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
246 | } |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
247 | |
|
14923
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
248 | static void |
|
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
249 | size_changed_cb(GntWidget *widget, int oldw, int oldh) |
|
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
250 | { |
|
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
251 | int w, h; |
|
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
252 | gnt_widget_get_size(widget, &w, &h); |
| 15884 | 253 | purple_prefs_set_int(PREF_ROOT "/size/width", w); |
| 254 | purple_prefs_set_int(PREF_ROOT "/size/height", h); | |
|
14923
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
255 | } |
|
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
256 | |
|
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
|
257 | 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
|
258 | 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
|
259 | { |
|
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 | 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
|
261 | 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
|
262 | } |
|
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
|
263 | |
|
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
|
264 | 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
|
265 | 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
|
266 | { |
|
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
|
267 | 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
|
268 | 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
|
269 | (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
|
270 | } |
|
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
|
271 | |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
272 | static void |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
273 | file_save(GntFileSel *fs, const char *path, const char *file, GntTextView *tv) |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
274 | { |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
275 | FILE *fp; |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
276 | |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
277 | if ((fp = g_fopen(path, "w+")) == NULL) { |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34309
diff
changeset
|
278 | purple_notify_error(NULL, NULL, _("Unable to open file."), NULL, NULL); |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
279 | return; |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
280 | } |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
281 | |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
282 | fprintf(fp, "Finch Debug Log : %s\n", purple_date_format_full(NULL)); |
|
39620
72bc1964b230
Use gnt_*_get_text accessors.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39617
diff
changeset
|
283 | fprintf(fp, "%s", gnt_text_view_get_text(tv)); |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
284 | fclose(fp); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
285 | gnt_widget_destroy(GNT_WIDGET(fs)); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
286 | } |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
287 | |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
288 | static void |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
289 | save_debug_win(GntWidget *w, GntTextView *tv) |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
290 | { |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
291 | GntWidget *window = gnt_file_sel_new(); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
292 | GntFileSel *sel = GNT_FILE_SEL(window); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
293 | gnt_file_sel_set_current_location(sel, purple_home_dir()); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
294 | gnt_file_sel_set_suggested_filename(sel, "debug.txt"); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
295 | g_signal_connect(G_OBJECT(sel), "file_selected", G_CALLBACK(file_save), tv); |
|
39621
ac33d7dd1ead
Use new GntFileSel signals.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
39620
diff
changeset
|
296 | g_signal_connect(G_OBJECT(sel), "cancelled", G_CALLBACK(gnt_widget_destroy), NULL); |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
297 | gnt_widget_show(window); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
298 | } |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
299 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15701
diff
changeset
|
300 | void finch_debug_window_show() |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
301 | { |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
302 | GntWidget *wid, *box, *label; |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
303 | |
|
14906
fdf387cc4b12
[gaim-migrate @ 17613]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14775
diff
changeset
|
304 | 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
|
305 | 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
|
306 | 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
|
307 | 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
|
308 | } |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
309 | |
|
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
|
310 | 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
|
311 | 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
|
312 | 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
|
313 | 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
|
314 | 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
|
315 | |
|
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
|
316 | 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
|
317 | 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
|
318 | 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
|
319 | 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
|
320 | 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
|
321 | g_signal_connect(G_OBJECT(debug.tview), "size_changed", G_CALLBACK(size_changed_cb), NULL); |
| 14755 | 322 | |
|
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
|
323 | 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
|
324 | |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
325 | 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
|
326 | 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
|
327 | gnt_box_set_fill(GNT_BOX(box), FALSE); |
| 14755 | 328 | |
|
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
|
329 | /* 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
|
330 | * 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
|
331 | * 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
|
332 | */ |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
333 | 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
|
334 | g_signal_connect(G_OBJECT(wid), "activate", G_CALLBACK(clear_debug_win), debug.tview); |
|
39617
1d0453799f73
Use GntWidget flag accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38644
diff
changeset
|
335 | gnt_widget_set_grow_y(wid, TRUE); |
|
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
|
336 | 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
|
337 | |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
338 | wid = gnt_button_new(_("Save")); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
339 | g_signal_connect(G_OBJECT(wid), "activate", G_CALLBACK(save_debug_win), debug.tview); |
|
39617
1d0453799f73
Use GntWidget flag accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38644
diff
changeset
|
340 | gnt_widget_set_grow_y(wid, TRUE); |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
341 | gnt_box_add_widget(GNT_BOX(box), wid); |
|
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
342 | |
|
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
|
343 | debug.search = gnt_entry_new(purple_prefs_get_string(PREF_ROOT "/filter")); |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
344 | label = gnt_label_new(_("Filter:")); |
|
39617
1d0453799f73
Use GntWidget flag accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38644
diff
changeset
|
345 | gnt_widget_set_grow_x(label, FALSE); |
|
20734
cb906a9e343e
Add save button to the debug window and alter some GROW_X for visual appeal
Richard Nelson <wabz@pidgin.im>
parents:
20147
diff
changeset
|
346 | gnt_box_add_widget(GNT_BOX(box), label); |
|
18400
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
347 | 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
|
348 | g_signal_connect(G_OBJECT(debug.search), "text_changed", G_CALLBACK(update_filter_string), NULL); |
| 14755 | 349 | |
|
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
|
350 | 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
|
351 | g_signal_connect(G_OBJECT(wid), "toggled", G_CALLBACK(toggle_pause), NULL); |
|
39617
1d0453799f73
Use GntWidget flag accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38644
diff
changeset
|
352 | gnt_widget_set_grow_y(wid, TRUE); |
|
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
|
353 | gnt_box_add_widget(GNT_BOX(box), wid); |
| 14755 | 354 | |
|
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
|
355 | gnt_box_add_widget(GNT_BOX(debug.window), box); |
|
39617
1d0453799f73
Use GntWidget flag accessor functions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38644
diff
changeset
|
356 | gnt_widget_set_grow_y(box, TRUE); |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14072
diff
changeset
|
357 | |
|
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
|
358 | 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
|
359 | |
|
549820f4725c
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17064
diff
changeset
|
360 | 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
|
361 | 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
|
362 | 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
|
363 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
364 | gnt_widget_show(debug.window); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
365 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
366 | |
|
14336
f6d0cb054557
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14187
diff
changeset
|
367 | static gboolean |
|
f6d0cb054557
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14187
diff
changeset
|
368 | start_with_debugwin(gpointer null) |
|
f6d0cb054557
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14187
diff
changeset
|
369 | { |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15701
diff
changeset
|
370 | finch_debug_window_show(); |
|
14336
f6d0cb054557
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14187
diff
changeset
|
371 | return FALSE; |
|
f6d0cb054557
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14187
diff
changeset
|
372 | } |
|
f6d0cb054557
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14187
diff
changeset
|
373 | |
|
38644
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
374 | static void |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
375 | finch_debug_ui_class_init(FinchDebugUiClass *klass) |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
376 | { |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
377 | GObjectClass *object_class = G_OBJECT_CLASS(klass); |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
378 | |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
379 | object_class->finalize = finch_debug_ui_finalize; |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
380 | } |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
381 | |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
382 | static void |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
383 | finch_debug_ui_init(FinchDebugUi *self) |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
384 | { |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
385 | /* Xerox */ |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
386 | #define REGISTER_G_LOG_HANDLER(name) \ |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
387 | 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
|
388 | | G_LOG_FLAG_RECURSION, \ |
| 15884 | 389 | purple_glib_log_handler, NULL) |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
390 | |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
391 | /* Register the glib log handlers. */ |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
392 | REGISTER_G_LOG_HANDLER(NULL); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
393 | REGISTER_G_LOG_HANDLER("GLib"); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
394 | REGISTER_G_LOG_HANDLER("GModule"); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
395 | REGISTER_G_LOG_HANDLER("GLib-GObject"); |
|
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
396 | REGISTER_G_LOG_HANDLER("GThread"); |
|
24822
d7774462f2ba
Use glib log functions to show error messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24683
diff
changeset
|
397 | REGISTER_G_LOG_HANDLER("Gnt"); |
|
21743
7a0caaf628ff
applied changes from 10f341962a83e2380243c4e44bb685105e3091a2
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20734
diff
changeset
|
398 | #ifdef USE_GSTREAMER |
|
7a0caaf628ff
applied changes from 10f341962a83e2380243c4e44bb685105e3091a2
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20734
diff
changeset
|
399 | REGISTER_G_LOG_HANDLER("GStreamer"); |
|
7a0caaf628ff
applied changes from 10f341962a83e2380243c4e44bb685105e3091a2
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
20734
diff
changeset
|
400 | #endif |
|
25321
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
401 | REGISTER_G_LOG_HANDLER("stderr"); |
|
14771
c9740405d914
[gaim-migrate @ 17463]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14755
diff
changeset
|
402 | |
|
14187
881ec8710386
[gaim-migrate @ 16763]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
403 | 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
|
404 | if (!purple_debug_is_enabled()) |
|
25321
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
405 | handle_fprintf_stderr(FALSE); |
|
14923
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
406 | |
| 15884 | 407 | 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
|
408 | purple_prefs_add_string(PREF_ROOT "/filter", ""); |
| 15884 | 409 | purple_prefs_add_none(PREF_ROOT "/size"); |
| 410 | purple_prefs_add_int(PREF_ROOT "/size/width", 60); | |
| 411 | purple_prefs_add_int(PREF_ROOT "/size/height", 15); | |
|
14923
ccb42b285510
[gaim-migrate @ 17630]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14906
diff
changeset
|
412 | |
| 15884 | 413 | if (purple_debug_is_enabled()) |
|
14336
f6d0cb054557
[gaim-migrate @ 16959]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14187
diff
changeset
|
414 | g_timeout_add(0, start_with_debugwin, NULL); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
415 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
416 | |
|
38644
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
417 | static void |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
418 | finch_debug_ui_finalize(GObject *gobject) |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
419 | { |
|
25321
69d02c27a5ff
Redirect stderr to the debug window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24822
diff
changeset
|
420 | handle_fprintf_stderr(TRUE); |
|
38644
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
421 | G_OBJECT_CLASS(finch_debug_ui_parent_class)->finalize(gobject); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
422 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
423 | |
|
38644
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
424 | FinchDebugUi * |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
425 | finch_debug_ui_new(void) |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
426 | { |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
427 | return g_object_new(FINCH_TYPE_DEBUG_UI, NULL); |
|
8ba616e7c69c
Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35972
diff
changeset
|
428 | } |