Thu, 08 Sep 2011 22:04:35 +0000
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
work with FIXME/TODO, and fix this ungodly formatting.
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
1 | /* pidgin |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
2 | * |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
3 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
4 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
5 | * source distribution. |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
6 | * |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
7 | * This program is free software; you can redistribute it and/or modify |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
8 | * it under the terms of the GNU General Public License as published by |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
9 | * the Free Software Foundation; either version 2 of the License, or |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
10 | * (at your option) any later version. |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
11 | * |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
12 | * This program is distributed in the hope that it will be useful, |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
15 | * GNU General Public License for more details. |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
16 | * |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
17 | * You should have received a copy of the GNU General Public License |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
18 | * along with this program; if not, write to the Free Software |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
20 | * |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
21 | */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
22 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
23 | #define PLUGIN_ID "gtk-webview-adium-ims" |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
24 | #define PLUGIN_NAME "webview-adium-ims" |
|
32453
12b7ca7ec8fa
Changed the Author added copyright, etc.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32452
diff
changeset
|
25 | |
|
12b7ca7ec8fa
Changed the Author added copyright, etc.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32452
diff
changeset
|
26 | /* |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
27 | * A lot of this was originally written by Sean Egan, but I think I've |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
28 | * rewrote enough to replace the author for now. |
|
32453
12b7ca7ec8fa
Changed the Author added copyright, etc.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32452
diff
changeset
|
29 | */ |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
30 | #define PLUGIN_AUTHOR "Arnold Noronha <arnstein87@gmail.com>" |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
31 | #define PURPLE_PLUGINS "Hell yeah" |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
32 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
33 | /* System headers */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
34 | #include <string.h> |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
35 | #include <gdk/gdk.h> |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
36 | #include <gtk/gtk.h> |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
37 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
38 | #include <webkit/webkit.h> |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
39 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
40 | /* Purple headers */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
41 | #include <conversation.h> |
| 32466 | 42 | #include <debug.h> |
|
32499
91d409e20e8a
Don't crash if we don't have any theme installed.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32495
diff
changeset
|
43 | #include <internal.h> |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
44 | #include <notify.h> |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
45 | #include <util.h> |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
46 | #include <version.h> |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
47 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
48 | /* Pidgin headers */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
49 | #include <gtkconv.h> |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
50 | #include <gtkplugin.h> |
|
32451
5474e644e2bd
* removed delete_conversation uiops and instead used signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32450
diff
changeset
|
51 | #include <gtkwebview.h> |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
52 | #include <smileyparser.h> |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
53 | |
|
32478
399d9ea27454
Parses Info.plist now!
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32477
diff
changeset
|
54 | #include <libxml/xmlreader.h> |
|
32485
b932922007bc
Separated the MessageStyle loading code from the actual rendering code.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32484
diff
changeset
|
55 | |
|
b932922007bc
Separated the MessageStyle loading code from the actual rendering code.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32484
diff
changeset
|
56 | #include "message-style.h" |
|
32457
834c570bfc40
more changes, but I still can't find the stupid bug. Valgrind gives me some information
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32456
diff
changeset
|
57 | /* GObject data keys */ |
|
834c570bfc40
more changes, but I still can't find the stupid bug. Valgrind gives me some information
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32456
diff
changeset
|
58 | #define MESSAGE_STYLE_KEY "message-style" |
|
834c570bfc40
more changes, but I still can't find the stupid bug. Valgrind gives me some information
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32456
diff
changeset
|
59 | |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
60 | static char *cur_style_dir = NULL; |
|
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
61 | static void *handle = NULL; |
| 32454 | 62 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
63 | static inline char * |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
64 | get_absolute_path(const char *path) |
|
32472
a8b826d5aa0b
make a get_absolute_path function.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32471
diff
changeset
|
65 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
66 | if (g_path_is_absolute(path)) |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
67 | return g_strdup(path); |
|
32472
a8b826d5aa0b
make a get_absolute_path function.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32471
diff
changeset
|
68 | else { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
69 | char *cwd, *ret; |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
70 | cwd = g_get_current_dir(); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
71 | ret = g_build_filename(cwd, path, NULL); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
72 | g_free(cwd); |
|
32472
a8b826d5aa0b
make a get_absolute_path function.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32471
diff
changeset
|
73 | return ret; |
|
a8b826d5aa0b
make a get_absolute_path function.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32471
diff
changeset
|
74 | } |
|
a8b826d5aa0b
make a get_absolute_path function.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32471
diff
changeset
|
75 | } |
|
a8b826d5aa0b
make a get_absolute_path function.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32471
diff
changeset
|
76 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
77 | static void webkit_on_webview_destroy(GtkObject* obj, gpointer data); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
78 | |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
79 | static void * |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
80 | webkit_plugin_get_handle(void) |
| 32454 | 81 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
82 | if (handle) |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
83 | return handle; |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
84 | else |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
85 | return (handle = g_malloc(1)); |
|
32480
5094cb6448af
new changes seemingly working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32479
diff
changeset
|
86 | } |
|
5094cb6448af
new changes seemingly working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32479
diff
changeset
|
87 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
88 | static void |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
89 | webkit_plugin_free_handle(void) |
|
32448
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
90 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
91 | purple_signals_disconnect_by_handle(handle); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
92 | g_free(handle); |
|
32448
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
93 | } |
|
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
94 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
95 | static char * |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
96 | replace_message_tokens( |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
97 | const char *text, |
|
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
98 | gsize len, |
|
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
99 | PurpleConversation *conv, |
|
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
100 | const char *name, |
|
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
101 | const char *alias, |
|
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
102 | const char *message, |
|
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
103 | PurpleMessageFlags flags, |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
104 | time_t mtime) |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
105 | { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
106 | GString *str = g_string_new_len(NULL, len); |
|
32487
13f307997f1a
Instead of using references, use copy's. Sigh, I know this is a memory inefficient
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32486
diff
changeset
|
107 | const char *cur = text; |
|
13f307997f1a
Instead of using references, use copy's. Sigh, I know this is a memory inefficient
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32486
diff
changeset
|
108 | const char *prev = cur; |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
109 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
110 | while ((cur = strchr(cur, '%'))) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
111 | const char *replace = NULL; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
112 | char *fin = NULL; |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
113 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
114 | if (!strncmp(cur, "%message%", strlen("%message%"))) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
115 | replace = message; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
116 | } else if (!strncmp(cur, "%messageClasses%", strlen("%messageClasses%"))) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
117 | replace = flags & PURPLE_MESSAGE_SEND ? "outgoing" : |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
118 | flags & PURPLE_MESSAGE_RECV ? "incoming" : "event"; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
119 | } else if (!strncmp(cur, "%time", strlen("%time"))) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
120 | char *format = NULL; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
121 | if (*(cur + strlen("%time")) == '{') { |
|
32487
13f307997f1a
Instead of using references, use copy's. Sigh, I know this is a memory inefficient
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32486
diff
changeset
|
122 | const char *start = cur + strlen("%time") + 1; |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
123 | char *end = strstr(start, "}%"); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
124 | if (!end) /* Invalid string */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
125 | continue; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
126 | format = g_strndup(start, end - start); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
127 | fin = end + 1; |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
128 | } |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
129 | replace = purple_utf8_strftime(format ? format : "%X", NULL); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
130 | g_free(format); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
131 | } else if (!strncmp(cur, "%userIconPath%", strlen("%userIconPath%"))) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
132 | if (flags & PURPLE_MESSAGE_SEND) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
133 | if (purple_account_get_bool(conv->account, "use-global-buddyicon", TRUE)) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
134 | replace = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon"); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
135 | } else { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
136 | PurpleStoredImage *img = purple_buddy_icons_find_account_icon(conv->account); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
137 | replace = purple_imgstore_get_filename(img); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
138 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
139 | if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
140 | replace = g_build_filename("Outgoing", "buddy_icon.png", NULL); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
141 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
142 | } else if (flags & PURPLE_MESSAGE_RECV) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
143 | PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
144 | replace = purple_buddy_icon_get_full_path(icon); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
145 | if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
146 | replace = g_build_filename("Incoming", "buddy_icon.png", NULL); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
147 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
148 | } |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
149 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
150 | } else if (!strncmp(cur, "%senderScreenName%", strlen("%senderScreenName%"))) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
151 | replace = name; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
152 | } else if (!strncmp(cur, "%sender%", strlen("%sender%"))) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
153 | replace = alias; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
154 | } else if (!strncmp(cur, "%service%", strlen("%service%"))) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
155 | replace = purple_account_get_protocol_name(conv->account); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
156 | } else { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
157 | cur++; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
158 | continue; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
159 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
160 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
161 | /* Here we have a replacement to make */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
162 | g_string_append_len(str, prev, cur - prev); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
163 | g_string_append(str, replace); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
164 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
165 | /* And update the pointers */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
166 | if (fin) { |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
167 | prev = cur = fin + 1; |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
168 | } else { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
169 | prev = cur = strchr(cur + 1, '%') + 1; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
170 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
171 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
172 | } |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
173 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
174 | /* And wrap it up */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
175 | g_string_append(str, prev); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
176 | return g_string_free(str, FALSE); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
177 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
178 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
179 | static char * |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
180 | replace_header_tokens(char *text, gsize len, PurpleConversation *conv) |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
181 | { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
182 | GString *str = g_string_new_len(NULL, len); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
183 | char *cur = text; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
184 | char *prev = cur; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
185 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
186 | if (text == NULL) |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
187 | return NULL; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
188 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
189 | while ((cur = strchr(cur, '%'))) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
190 | const char *replace = NULL; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
191 | char *fin = NULL; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
192 | |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
193 | if (!strncmp(cur, "%chatName%", strlen("%chatName%"))) { |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
194 | replace = conv->name; |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
195 | } else if (!strncmp(cur, "%sourceName%", strlen("%sourceName%"))) { |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
196 | replace = purple_account_get_alias(conv->account); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
197 | if (replace == NULL) |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
198 | replace = purple_account_get_username(conv->account); |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
199 | } else if (!strncmp(cur, "%destinationName%", strlen("%destinationName%"))) { |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
200 | PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
201 | if (buddy) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
202 | replace = purple_buddy_get_alias(buddy); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
203 | } else { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
204 | replace = conv->name; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
205 | } |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
206 | } else if (!strncmp(cur, "%incomingIconPath%", strlen("%incomingIconPath%"))) { |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
207 | PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
208 | replace = purple_buddy_icon_get_full_path(icon); |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
209 | } else if (!strncmp(cur, "%outgoingIconPath%", strlen("%outgoingIconPath%"))) { |
|
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
210 | } else if (!strncmp(cur, "%timeOpened", strlen("%timeOpened"))) { |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
211 | char *format = NULL; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
212 | if (*(cur + strlen("%timeOpened")) == '{') { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
213 | char *start = cur + strlen("%timeOpened") + 1; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
214 | char *end = strstr(start, "}%"); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
215 | if (!end) /* Invalid string */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
216 | continue; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
217 | format = g_strndup(start, end - start); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
218 | fin = end + 1; |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
219 | } |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
220 | replace = purple_utf8_strftime(format ? format : "%X", NULL); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
221 | g_free(format); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
222 | } else { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
223 | continue; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
224 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
225 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
226 | /* Here we have a replacement to make */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
227 | g_string_append_len(str, prev, cur - prev); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
228 | g_string_append(str, replace); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
229 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
230 | /* And update the pointers */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
231 | if (fin) { |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
232 | prev = cur = fin + 1; |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
233 | } else { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
234 | prev = cur = strchr(cur + 1, '%') + 1; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
235 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
236 | } |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
237 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
238 | /* And wrap it up */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
239 | g_string_append(str, prev); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
240 | return g_string_free(str, FALSE); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
241 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
242 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
243 | static char * |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
244 | replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *header, char *footer) |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
245 | { |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
246 | GString *str = g_string_new_len(NULL, len); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
247 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
248 | char **ms = g_strsplit(text, "%@", 6); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
249 | char *base = NULL; |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
250 | char *csspath = pidgin_message_style_get_css(style); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
251 | if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
252 | g_strfreev(ms); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
253 | g_string_free(str, TRUE); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
254 | return NULL; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
255 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
256 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
257 | g_string_append(str, ms[0]); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
258 | g_string_append(str, "file://"); |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
259 | base = g_build_filename(style->style_dir, "Contents", "Resources", "Template.html", NULL); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
260 | g_string_append(str, base); |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
261 | g_free(base); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
262 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
263 | g_string_append(str, ms[1]); |
|
32480
5094cb6448af
new changes seemingly working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32479
diff
changeset
|
264 | |
|
32486
c44fe7ecb3dd
load the default variant. Bring back basestyle.css.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32485
diff
changeset
|
265 | g_string_append(str, style->basestyle_css); |
|
32480
5094cb6448af
new changes seemingly working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32479
diff
changeset
|
266 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
267 | g_string_append(str, ms[2]); |
|
32480
5094cb6448af
new changes seemingly working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32479
diff
changeset
|
268 | |
|
5094cb6448af
new changes seemingly working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32479
diff
changeset
|
269 | g_string_append(str, "file://"); |
|
5094cb6448af
new changes seemingly working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32479
diff
changeset
|
270 | g_string_append(str, csspath); |
|
5094cb6448af
new changes seemingly working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32479
diff
changeset
|
271 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
272 | g_string_append(str, ms[3]); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
273 | if (header) |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
274 | g_string_append(str, header); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
275 | g_string_append(str, ms[4]); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
276 | if (footer) |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
277 | g_string_append(str, footer); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
278 | g_string_append(str, ms[5]); |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
279 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
280 | g_strfreev(ms); |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
281 | g_free(csspath); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
282 | return g_string_free(str, FALSE); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
283 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
284 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
285 | static GtkWidget * |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
286 | get_webkit(PurpleConversation *conv) |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
287 | { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
288 | PidginConversation *gtkconv; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
289 | gtkconv = PIDGIN_CONVERSATION(conv); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
290 | if (!gtkconv) |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
291 | return NULL; |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
292 | else |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
293 | return gtkconv->webview; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
294 | } |
|
32450
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
295 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
296 | static void |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
297 | set_theme_webkit_settings(WebKitWebView *webview, PidginMessageStyle *style) |
|
32482
d0f92b6cc6b4
hmm, fonts and font sizes from Info.plist.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32481
diff
changeset
|
298 | { |
|
d0f92b6cc6b4
hmm, fonts and font sizes from Info.plist.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32481
diff
changeset
|
299 | WebKitWebSettings *settings; |
|
d0f92b6cc6b4
hmm, fonts and font sizes from Info.plist.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32481
diff
changeset
|
300 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
301 | g_object_get(G_OBJECT(webview), "settings", &settings, NULL); |
|
32482
d0f92b6cc6b4
hmm, fonts and font sizes from Info.plist.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32481
diff
changeset
|
302 | if (style->default_font_family) |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
303 | g_object_set(G_OBJECT(settings), "default-font-family", style->default_font_family, NULL); |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
304 | |
|
32482
d0f92b6cc6b4
hmm, fonts and font sizes from Info.plist.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32481
diff
changeset
|
305 | if (style->default_font_size) |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
306 | g_object_set(G_OBJECT(settings), "default-font-size", GINT_TO_POINTER(style->default_font_size), NULL); |
|
32484
11ae8e769921
apparent code for webkit transparency that might not be working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32482
diff
changeset
|
307 | |
|
11ae8e769921
apparent code for webkit transparency that might not be working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32482
diff
changeset
|
308 | /* this does not work :( */ |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
309 | webkit_web_view_set_transparent(webview, style->default_background_is_transparent); |
|
32482
d0f92b6cc6b4
hmm, fonts and font sizes from Info.plist.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32481
diff
changeset
|
310 | } |
|
d0f92b6cc6b4
hmm, fonts and font sizes from Info.plist.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32481
diff
changeset
|
311 | |
|
32490
ece69f13d4fa
Adds the 'groupchat' classname to #Chat when using groupchat.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32488
diff
changeset
|
312 | /* |
|
ece69f13d4fa
Adds the 'groupchat' classname to #Chat when using groupchat.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32488
diff
changeset
|
313 | * The style specification says that if the conversation is a group |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
314 | * chat then the <div id="Chat"> element will be given a class |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
315 | * 'groupchat'. I can't add another '%@' in Template.html because |
|
32490
ece69f13d4fa
Adds the 'groupchat' classname to #Chat when using groupchat.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32488
diff
changeset
|
316 | * that breaks style-specific Template.html's. I have to either use libxml |
|
ece69f13d4fa
Adds the 'groupchat' classname to #Chat when using groupchat.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32488
diff
changeset
|
317 | * or conveniently play with WebKit's javascript engine. The javascript |
|
ece69f13d4fa
Adds the 'groupchat' classname to #Chat when using groupchat.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32488
diff
changeset
|
318 | * engine should work, but it's not an identical behavior. |
|
ece69f13d4fa
Adds the 'groupchat' classname to #Chat when using groupchat.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32488
diff
changeset
|
319 | */ |
|
ece69f13d4fa
Adds the 'groupchat' classname to #Chat when using groupchat.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32488
diff
changeset
|
320 | static void |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
321 | webkit_set_groupchat(GtkWebView *webview) |
|
32490
ece69f13d4fa
Adds the 'groupchat' classname to #Chat when using groupchat.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32488
diff
changeset
|
322 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
323 | gtk_webview_safe_execute_script(webview, "document.getElementById('Chat').className = 'groupchat'"); |
|
32490
ece69f13d4fa
Adds the 'groupchat' classname to #Chat when using groupchat.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32488
diff
changeset
|
324 | } |
|
ece69f13d4fa
Adds the 'groupchat' classname to #Chat when using groupchat.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32488
diff
changeset
|
325 | |
|
32482
d0f92b6cc6b4
hmm, fonts and font sizes from Info.plist.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32481
diff
changeset
|
326 | |
|
32450
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
327 | /** |
|
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
328 | * Called when either a new PurpleConversation is created |
|
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
329 | * or when a PidginConversation changes its active PurpleConversation |
|
32458
184f94216441
woo, fixed the bug. Now things are looking wonderfully stable.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32457
diff
changeset
|
330 | * This will not change the theme if the theme is already set. |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
331 | * (This is to prevent accidental theme changes if a new |
|
32458
184f94216441
woo, fixed the bug. Now things are looking wonderfully stable.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32457
diff
changeset
|
332 | * PurpleConversation gets added. |
|
32450
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
333 | * |
|
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
334 | * FIXME: it's not at all clear to me as to how |
|
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
335 | * Adium themes handle the case when the PurpleConversation |
|
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
336 | * changes. |
|
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
337 | */ |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
338 | static void |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
339 | init_theme_for_webkit(PurpleConversation *conv, char *style_dir) |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
340 | { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
341 | GtkWidget *webkit = PIDGIN_CONVERSATION(conv)->webview; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
342 | char *header, *footer; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
343 | char *template; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
344 | |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
345 | char* basedir; |
|
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
346 | char* baseuri; |
|
32457
834c570bfc40
more changes, but I still can't find the stupid bug. Valgrind gives me some information
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32456
diff
changeset
|
347 | PidginMessageStyle *style, *oldStyle; |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
348 | PidginMessageStyle *copy; |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
349 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
350 | oldStyle = g_object_get_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
351 | if (oldStyle) |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
352 | return; |
|
32457
834c570bfc40
more changes, but I still can't find the stupid bug. Valgrind gives me some information
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32456
diff
changeset
|
353 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
354 | purple_debug_info("webkit", "loading %s\n", style_dir); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
355 | style = pidgin_message_style_load(style_dir); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
356 | g_assert(style); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
357 | g_assert(style->template_html); /* debugging test? */ |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
358 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
359 | basedir = g_build_filename(style->style_dir, "Contents", "Resources", "Template.html", NULL); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
360 | baseuri = g_strdup_printf("file://%s", basedir); |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
361 | header = replace_header_tokens(style->header_html, strlen(style->header_html), conv); |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
362 | g_assert(style); |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
363 | footer = replace_header_tokens(style->footer_html, strlen(style->footer_html), conv); |
|
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
364 | template = replace_template_tokens(style, style->template_html, strlen(style->template_html) + strlen(style->header_html), header, footer); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
365 | |
|
32471
1eae26422963
small assertion code.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32470
diff
changeset
|
366 | g_assert(template); |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
367 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
368 | purple_debug_info("webkit", "template: %s\n", template); |
|
32482
d0f92b6cc6b4
hmm, fonts and font sizes from Info.plist.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32481
diff
changeset
|
369 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
370 | set_theme_webkit_settings(WEBKIT_WEB_VIEW(webkit), style); |
|
32457
834c570bfc40
more changes, but I still can't find the stupid bug. Valgrind gives me some information
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32456
diff
changeset
|
371 | webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); |
|
32458
184f94216441
woo, fixed the bug. Now things are looking wonderfully stable.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32457
diff
changeset
|
372 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
373 | copy = pidgin_message_style_copy(style); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
374 | g_object_set_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY, copy); |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
375 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
376 | pidgin_message_style_unref(style); |
|
32459
04857274f841
Cleanly handle webkit destroy events.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32458
diff
changeset
|
377 | /* I need to unref this style when the webkit object destroys */ |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
378 | g_signal_connect(G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), copy); |
|
32450
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
379 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
380 | if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
381 | webkit_set_groupchat(GTK_WEBVIEW(webkit)); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
382 | g_free(basedir); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
383 | g_free(baseuri); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
384 | g_free(header); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
385 | g_free(footer); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
386 | g_free(template); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
387 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
388 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
389 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
390 | /* restore the non theme version of the conversation window */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
391 | static void |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
392 | finalize_theme_for_webkit(PurpleConversation *conv) |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
393 | { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
394 | GtkWidget *webview = PIDGIN_CONVERSATION(conv)->webview; |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
395 | PidginMessageStyle *style = g_object_get_data(G_OBJECT(webview), MESSAGE_STYLE_KEY); |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
396 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
397 | webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), "", "text/html", "UTF-8", ""); |
|
32457
834c570bfc40
more changes, but I still can't find the stupid bug. Valgrind gives me some information
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32456
diff
changeset
|
398 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
399 | g_object_set_data(G_OBJECT(webview), MESSAGE_STYLE_KEY, NULL); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
400 | pidgin_message_style_unref(style); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
401 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
402 | |
|
32459
04857274f841
Cleanly handle webkit destroy events.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32458
diff
changeset
|
403 | static void |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
404 | webkit_on_webview_destroy(GtkObject *object, gpointer data) |
|
32459
04857274f841
Cleanly handle webkit destroy events.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32458
diff
changeset
|
405 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
406 | pidgin_message_style_unref((PidginMessageStyle *)data); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
407 | g_object_set_data(G_OBJECT(object), MESSAGE_STYLE_KEY, NULL); |
|
32459
04857274f841
Cleanly handle webkit destroy events.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32458
diff
changeset
|
408 | } |
|
04857274f841
Cleanly handle webkit destroy events.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32458
diff
changeset
|
409 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
410 | static gboolean |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
411 | webkit_on_displaying_im_msg(PurpleAccount *account, |
|
32448
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
412 | const char* name, |
|
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
413 | char **pmessage, |
|
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
414 | PurpleConversation *conv, |
|
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
415 | PurpleMessageFlags flags, |
|
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
416 | gpointer data) |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
417 | { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
418 | GtkWidget *webkit; |
|
32448
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
419 | char *message = *pmessage; |
|
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
420 | const char *alias = name; /* FIXME: signal doesn't give me alias */ |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
421 | char *stripped; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
422 | char *message_html; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
423 | char *msg; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
424 | char *escape; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
425 | char *script; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
426 | char *func = "appendMessage"; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
427 | char *smileyed; |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
428 | time_t mtime = time(NULL); /* FIXME: this should come from the write_conv calback, but the signal doesn't pass this to me */ |
|
32448
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
429 | |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
430 | PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags")); |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
431 | PidginMessageStyle *style; |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
432 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
433 | webkit = get_webkit(conv); |
|
32448
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
434 | stripped = g_strdup(message); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
435 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
436 | style = g_object_get_data(G_OBJECT(webkit), MESSAGE_STYLE_KEY); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
437 | g_assert(style); |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
438 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
439 | if (flags & PURPLE_MESSAGE_SEND && old_flags & PURPLE_MESSAGE_SEND) { |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
440 | message_html = style->outgoing_next_content_html; |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
441 | func = "appendNextMessage"; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
442 | } else if (flags & PURPLE_MESSAGE_SEND) { |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
443 | message_html = style->outgoing_content_html; |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
444 | } else if (flags & PURPLE_MESSAGE_RECV && old_flags & PURPLE_MESSAGE_RECV) { |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
445 | message_html = style->incoming_next_content_html; |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
446 | func = "appendNextMessage"; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
447 | } else if (flags & PURPLE_MESSAGE_RECV) { |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
448 | message_html = style->incoming_content_html; |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
449 | } else { |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
450 | message_html = style->status_html; |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
451 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
452 | purple_conversation_set_data(conv, "webkit-lastflags", GINT_TO_POINTER(flags)); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
453 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
454 | smileyed = smiley_parse_markup(stripped, conv->account->protocol_id); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
455 | msg = replace_message_tokens(message_html, 0, conv, name, alias, smileyed, flags, mtime); |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
456 | escape = gtk_webview_quote_js_string(msg); |
|
32451
5474e644e2bd
* removed delete_conversation uiops and instead used signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32450
diff
changeset
|
457 | script = g_strdup_printf("%s(%s)", func, escape); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
458 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
459 | purple_debug_info("webkit", "JS: %s\n", script); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
460 | gtk_webview_safe_execute_script(GTK_WEBVIEW(webkit), script); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
461 | |
|
32461
72fe247cc953
Yep, tested, and changed some code from previous commit. This is a hard
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32460
diff
changeset
|
462 | g_free(script); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
463 | g_free(smileyed); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
464 | g_free(msg); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
465 | g_free(stripped); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
466 | g_free(escape); |
|
32448
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
467 | |
|
32458
184f94216441
woo, fixed the bug. Now things are looking wonderfully stable.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32457
diff
changeset
|
468 | return TRUE; /* GtkConv should not handle this IM */ |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
469 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
470 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
471 | static gboolean |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
472 | webkit_on_displaying_chat_msg(PurpleAccount *account, |
|
32452
c4f3d02a3122
Well, chat is sorta kinda working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32451
diff
changeset
|
473 | const char *who, |
|
c4f3d02a3122
Well, chat is sorta kinda working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32451
diff
changeset
|
474 | char **message, |
|
c4f3d02a3122
Well, chat is sorta kinda working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32451
diff
changeset
|
475 | PurpleConversation *conv, |
|
c4f3d02a3122
Well, chat is sorta kinda working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32451
diff
changeset
|
476 | PurpleMessageFlags flags, |
|
c4f3d02a3122
Well, chat is sorta kinda working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32451
diff
changeset
|
477 | gpointer userdata) |
|
c4f3d02a3122
Well, chat is sorta kinda working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32451
diff
changeset
|
478 | { |
|
32458
184f94216441
woo, fixed the bug. Now things are looking wonderfully stable.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32457
diff
changeset
|
479 | /* handle exactly like an IM message for now */ |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
480 | return webkit_on_displaying_im_msg(account, who, message, conv, flags, NULL); |
|
32452
c4f3d02a3122
Well, chat is sorta kinda working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32451
diff
changeset
|
481 | } |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
482 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
483 | static void |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
484 | webkit_on_conversation_displayed(PidginConversation *gtkconv, gpointer data) |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
485 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
486 | init_theme_for_webkit(gtkconv->active_conv, cur_style_dir); |
|
32450
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
487 | } |
|
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
488 | |
|
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
489 | static void |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
490 | webkit_on_conversation_switched(PurpleConversation *conv, gpointer data) |
|
32450
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
491 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
492 | init_theme_for_webkit(conv, cur_style_dir); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
493 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
494 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
495 | static void |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
496 | webkit_on_conversation_hiding(PidginConversation *gtkconv, gpointer data) |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
497 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
498 | /* |
|
32451
5474e644e2bd
* removed delete_conversation uiops and instead used signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32450
diff
changeset
|
499 | * I'm not sure if I need to do anything here, but let's keep |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
500 | * this anyway. |
|
32451
5474e644e2bd
* removed delete_conversation uiops and instead used signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32450
diff
changeset
|
501 | */ |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
502 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
503 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
504 | static GList * |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
505 | get_dir_dir_list(const char *dirname) |
|
32464
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
506 | { |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
507 | GList *ret = NULL; |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
508 | GDir *dir = g_dir_open(dirname, 0, NULL); |
|
32464
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
509 | const char* subdir; |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
510 | |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
511 | if (!dir) return NULL; |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
512 | while ((subdir = g_dir_read_name(dir))) { |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
513 | ret = g_list_append(ret, g_build_filename(dirname, subdir, NULL)); |
|
32464
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
514 | } |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
515 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
516 | g_dir_close(dir); |
|
32464
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
517 | return ret; |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
518 | } |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
519 | |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
520 | /** |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
521 | * Get me a list of all the available themes specified by their |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
522 | * directories. I don't guarrantee that these are valid themes, just |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
523 | * that they are in the directories for themes. |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
524 | */ |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
525 | static GList * |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
526 | get_style_directory_list(void) |
|
32464
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
527 | { |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
528 | char *user_dir, *user_style_dir, *global_style_dir; |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
529 | GList *list1, *list2; |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
530 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
531 | user_dir = get_absolute_path(purple_user_dir()); |
|
32464
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
532 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
533 | user_style_dir = g_build_filename(user_dir, "styles", NULL); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
534 | global_style_dir = g_build_filename(DATADIR, "pidgin", "styles", NULL); |
|
32464
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
535 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
536 | list1 = get_dir_dir_list(user_style_dir); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
537 | list2 = get_dir_dir_list(global_style_dir); |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
538 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
539 | g_free(global_style_dir); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
540 | g_free(user_style_dir); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
541 | g_free(user_dir); |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
542 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
543 | return g_list_concat(list1, list2); |
|
32464
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
544 | } |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
545 | |
| 32466 | 546 | /** |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
547 | * use heuristics or previous user options to figure out what |
| 32466 | 548 | * theme to use as default in this Pidgin instance. |
| 549 | */ | |
| 550 | static void | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
551 | style_set_default(void) |
| 32466 | 552 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
553 | GList *styles = get_style_directory_list(), *iter; |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
554 | const char *stylepath = purple_prefs_get_string("/plugins/gtk/adiumthemes/stylepath"); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
555 | g_assert(cur_style_dir == NULL); |
| 32466 | 556 | |
|
32499
91d409e20e8a
Don't crash if we don't have any theme installed.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32495
diff
changeset
|
557 | if (stylepath && *stylepath) |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
558 | styles = g_list_prepend(styles, g_strdup(stylepath)); |
|
32499
91d409e20e8a
Don't crash if we don't have any theme installed.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32495
diff
changeset
|
559 | else { |
|
91d409e20e8a
Don't crash if we don't have any theme installed.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32495
diff
changeset
|
560 | purple_notify_error(handle, _("Webkit themes"), |
|
91d409e20e8a
Don't crash if we don't have any theme installed.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32495
diff
changeset
|
561 | _("Can't find installed styles"), |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
562 | _("Please install some theme and verify the installation path")); |
|
32499
91d409e20e8a
Don't crash if we don't have any theme installed.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32495
diff
changeset
|
563 | |
|
91d409e20e8a
Don't crash if we don't have any theme installed.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32495
diff
changeset
|
564 | } |
| 32466 | 565 | |
| 566 | /* pick any one that works. Note that we have first preference | |
| 567 | * for the one in the userdir */ | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
568 | for (iter = styles; iter; iter = g_list_next(iter)) { |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
569 | PidginMessageStyle *style = pidgin_message_style_load(iter->data); |
| 32466 | 570 | if (style) { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
571 | cur_style_dir = (char *)g_strdup(iter->data); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
572 | pidgin_message_style_unref(style); |
| 32466 | 573 | break; |
| 574 | } | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
575 | purple_debug_info("webkit", "Style %s is invalid\n", (char *)iter->data); |
| 32466 | 576 | } |
| 577 | ||
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
578 | for (iter = styles; iter; iter = g_list_next(iter)) |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
579 | g_free(iter->data); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
580 | g_list_free(styles); |
| 32466 | 581 | } |
|
32464
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
582 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
583 | static gboolean |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
584 | plugin_load(PurplePlugin *plugin) |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
585 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
586 | style_set_default(); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
587 | if (!cur_style_dir) |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
588 | return FALSE; /* couldn't find a style */ |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
589 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
590 | purple_signal_connect(pidgin_conversations_get_handle(), |
|
32448
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
591 | "displaying-im-msg", |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
592 | webkit_plugin_get_handle(), |
|
32452
c4f3d02a3122
Well, chat is sorta kinda working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32451
diff
changeset
|
593 | PURPLE_CALLBACK(webkit_on_displaying_im_msg), |
|
32448
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
594 | NULL); |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
595 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
596 | purple_signal_connect(pidgin_conversations_get_handle(), |
|
32452
c4f3d02a3122
Well, chat is sorta kinda working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32451
diff
changeset
|
597 | "displaying-chat-msg", |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
598 | webkit_plugin_get_handle(), |
|
32452
c4f3d02a3122
Well, chat is sorta kinda working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32451
diff
changeset
|
599 | PURPLE_CALLBACK(webkit_on_displaying_chat_msg), |
|
c4f3d02a3122
Well, chat is sorta kinda working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32451
diff
changeset
|
600 | NULL); |
|
c4f3d02a3122
Well, chat is sorta kinda working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32451
diff
changeset
|
601 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
602 | purple_signal_connect(pidgin_conversations_get_handle(), |
|
32450
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
603 | "conversation-displayed", |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
604 | webkit_plugin_get_handle(), |
|
32458
184f94216441
woo, fixed the bug. Now things are looking wonderfully stable.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32457
diff
changeset
|
605 | PURPLE_CALLBACK(webkit_on_conversation_displayed), |
|
32450
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
606 | NULL); |
|
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
607 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
608 | purple_signal_connect(pidgin_conversations_get_handle(), |
|
32450
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
609 | "conversation-switched", |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
610 | webkit_plugin_get_handle(), |
|
32450
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
611 | PURPLE_CALLBACK(webkit_on_conversation_switched), |
|
f91c5f54b29a
create conversation with signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32449
diff
changeset
|
612 | NULL); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
613 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
614 | purple_signal_connect(pidgin_conversations_get_handle(), |
|
32451
5474e644e2bd
* removed delete_conversation uiops and instead used signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32450
diff
changeset
|
615 | "conversation-hiding", |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
616 | webkit_plugin_get_handle(), |
|
32451
5474e644e2bd
* removed delete_conversation uiops and instead used signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32450
diff
changeset
|
617 | PURPLE_CALLBACK(webkit_on_conversation_hiding), |
|
5474e644e2bd
* removed delete_conversation uiops and instead used signals.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32450
diff
changeset
|
618 | NULL); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
619 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
620 | /* finally update each of the existing conversation windows */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
621 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
622 | GList *list = purple_get_conversations(); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
623 | for (;list; list = g_list_next(list)) |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
624 | init_theme_for_webkit(list->data, cur_style_dir); |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
625 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
626 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
627 | return TRUE; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
628 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
629 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
630 | static gboolean |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
631 | plugin_unload(PurplePlugin *plugin) |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
632 | { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
633 | GList *list; |
|
32448
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
634 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
635 | webkit_plugin_free_handle(); |
|
32469
ba275d3188c7
unset cur_style_dir when unloading.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32468
diff
changeset
|
636 | cur_style_dir = NULL; |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
637 | list = purple_get_conversations(); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
638 | while (list) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
639 | finalize_theme_for_webkit(list->data); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
640 | list = g_list_next(list); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
641 | } |
|
32448
2a5e5d1dde23
use displaying-im-msg instead of write_conv uiops.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32444
diff
changeset
|
642 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
643 | return TRUE; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
644 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
645 | |
|
32480
5094cb6448af
new changes seemingly working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32479
diff
changeset
|
646 | /* |
|
5094cb6448af
new changes seemingly working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32479
diff
changeset
|
647 | * UI config code |
|
5094cb6448af
new changes seemingly working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32479
diff
changeset
|
648 | */ |
|
5094cb6448af
new changes seemingly working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32479
diff
changeset
|
649 | |
|
32468
b7f42b3c683d
some code for style_changed and also default any empty file to "" rather than NULL.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32467
diff
changeset
|
650 | static void |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
651 | style_changed(GtkWidget *combobox, gpointer null) |
|
32468
b7f42b3c683d
some code for style_changed and also default any empty file to "" rather than NULL.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32467
diff
changeset
|
652 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
653 | char *name = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combobox)); |
|
32473
1cf735223afe
Inform the user about how the theme change takes effect.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32472
diff
changeset
|
654 | GtkWidget *dialog; |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
655 | GList *styles = get_style_directory_list(), *iter; |
|
32468
b7f42b3c683d
some code for style_changed and also default any empty file to "" rather than NULL.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32467
diff
changeset
|
656 | |
|
32476
03712ece5275
Show only the MessageStyle name and not the entire path.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32475
diff
changeset
|
657 | /* find the full path for this name, I wish I could store this info in the combobox itself. :( */ |
|
03712ece5275
Show only the MessageStyle name and not the entire path.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32475
diff
changeset
|
658 | for (iter = styles; iter; iter = g_list_next(iter)) { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
659 | char *basename = g_path_get_basename(iter->data); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
660 | if (g_str_equal(basename, name)) { |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
661 | g_free(basename); |
|
32476
03712ece5275
Show only the MessageStyle name and not the entire path.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32475
diff
changeset
|
662 | break; |
|
03712ece5275
Show only the MessageStyle name and not the entire path.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32475
diff
changeset
|
663 | } |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
664 | g_free(basename); |
|
32476
03712ece5275
Show only the MessageStyle name and not the entire path.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32475
diff
changeset
|
665 | } |
|
03712ece5275
Show only the MessageStyle name and not the entire path.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32475
diff
changeset
|
666 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
667 | g_assert(iter); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
668 | g_free(name); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
669 | g_free(cur_style_dir); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
670 | cur_style_dir = g_strdup(iter->data);; |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
671 | purple_prefs_set_string("/plugins/gtk/adiumthemes/stylepath", cur_style_dir); |
|
32473
1cf735223afe
Inform the user about how the theme change takes effect.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32472
diff
changeset
|
672 | |
|
1cf735223afe
Inform the user about how the theme change takes effect.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32472
diff
changeset
|
673 | /* inform the user that existing conversations haven't changed */ |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
674 | dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "The style for existing conversations have not been changed. Please close and re-open the conversation for the changes to take effect."); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
675 | g_assert(dialog); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
676 | gtk_widget_show(dialog); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
677 | g_signal_connect_swapped(dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog); |
|
32468
b7f42b3c683d
some code for style_changed and also default any empty file to "" rather than NULL.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32467
diff
changeset
|
678 | } |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
679 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
680 | static GtkWidget * |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
681 | get_style_config_frame(void) |
|
32467
9c3c14c44803
some code to get a list of styles and blah blah.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32466
diff
changeset
|
682 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
683 | GtkWidget *combobox = gtk_combo_box_new_text(); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
684 | GList *styles = get_style_directory_list(), *iter; |
|
32467
9c3c14c44803
some code to get a list of styles and blah blah.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32466
diff
changeset
|
685 | int index = 0, selected = 0; |
|
9c3c14c44803
some code to get a list of styles and blah blah.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32466
diff
changeset
|
686 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
687 | for (iter = styles; iter; iter = g_list_next(iter)) { |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
688 | PidginMessageStyle *style = pidgin_message_style_load(iter->data); |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
689 | |
|
32467
9c3c14c44803
some code to get a list of styles and blah blah.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32466
diff
changeset
|
690 | if (style) { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
691 | char *text = g_path_get_basename(iter->data); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
692 | gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), text); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
693 | g_free(text); |
|
32476
03712ece5275
Show only the MessageStyle name and not the entire path.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32475
diff
changeset
|
694 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
695 | if (g_str_equal(iter->data, cur_style_dir)) |
|
32467
9c3c14c44803
some code to get a list of styles and blah blah.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32466
diff
changeset
|
696 | selected = index; |
|
32473
1cf735223afe
Inform the user about how the theme change takes effect.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32472
diff
changeset
|
697 | index++; |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
698 | pidgin_message_style_unref(style); |
|
32467
9c3c14c44803
some code to get a list of styles and blah blah.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32466
diff
changeset
|
699 | } |
|
9c3c14c44803
some code to get a list of styles and blah blah.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32466
diff
changeset
|
700 | } |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
701 | gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), selected); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
702 | g_signal_connect_after(G_OBJECT(combobox), "changed", G_CALLBACK(style_changed), NULL); |
|
32467
9c3c14c44803
some code to get a list of styles and blah blah.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32466
diff
changeset
|
703 | return combobox; |
|
9c3c14c44803
some code to get a list of styles and blah blah.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32466
diff
changeset
|
704 | } |
|
9c3c14c44803
some code to get a list of styles and blah blah.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32466
diff
changeset
|
705 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
706 | static void |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
707 | variant_update_conversation(PurpleConversation *conv) |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
708 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
709 | PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
710 | WebKitWebView *webview = WEBKIT_WEB_VIEW(gtkconv->webview); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
711 | PidginMessageStyle *style = (PidginMessageStyle *)g_object_get_data(G_OBJECT(webview), MESSAGE_STYLE_KEY); |
|
32457
834c570bfc40
more changes, but I still can't find the stupid bug. Valgrind gives me some information
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32456
diff
changeset
|
712 | char *script; |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
713 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
714 | g_assert(style); |
|
32457
834c570bfc40
more changes, but I still can't find the stupid bug. Valgrind gives me some information
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32456
diff
changeset
|
715 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
716 | script = g_strdup_printf("setStylesheet(\"mainStyle\",\"%s\")", pidgin_message_style_get_css(style)); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
717 | gtk_webview_safe_execute_script(GTK_WEBVIEW(webview), script); |
|
32482
d0f92b6cc6b4
hmm, fonts and font sizes from Info.plist.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32481
diff
changeset
|
718 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
719 | set_theme_webkit_settings(WEBKIT_WEB_VIEW(gtkconv->webview), style); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
720 | g_free(script); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
721 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
722 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
723 | static void |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
724 | variant_changed(GtkWidget* combobox, gpointer null) |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
725 | { |
|
32480
5094cb6448af
new changes seemingly working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32479
diff
changeset
|
726 | char *name; |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
727 | GList *list; |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
728 | PidginMessageStyle *style = pidgin_message_style_load(cur_style_dir); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
729 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
730 | g_assert(style); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
731 | name = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combobox)); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
732 | pidgin_message_style_set_variant(style, name); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
733 | pidgin_message_style_save_state(style); |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
734 | |
|
32480
5094cb6448af
new changes seemingly working.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32479
diff
changeset
|
735 | /* update conversations */ |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
736 | list = purple_get_conversations(); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
737 | while (list) { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
738 | variant_update_conversation(list->data); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
739 | list = g_list_next(list); |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
740 | } |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
741 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
742 | g_free(name); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
743 | pidgin_message_style_unref(style); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
744 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
745 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
746 | static GtkWidget * |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
747 | get_variant_config_frame() |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
748 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
749 | PidginMessageStyle *style = pidgin_message_style_load(cur_style_dir); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
750 | GList *variants = pidgin_message_style_get_variants(style), *iter; |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
751 | char *cur_variant = pidgin_message_style_get_variant(style); |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
752 | GtkWidget *combobox = gtk_combo_box_new_text(); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
753 | int def = -1, index = 0; |
|
32456
f1b670241892
Ok, good part of this work of moving global variables to defined styles is
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32455
diff
changeset
|
754 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
755 | pidgin_message_style_unref(style); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
756 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
757 | for (iter = variants; iter; iter = g_list_next(iter)) { |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
758 | gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), iter->data); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
759 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
760 | if (g_str_equal(cur_variant, iter->data)) |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
761 | def = index; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
762 | index ++; |
|
32501
f150788023c0
Fix some white spaces issues.
Jorge Villaseñor <masca@cpw.pidgin.im>
parents:
32499
diff
changeset
|
763 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
764 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
765 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
766 | gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), def); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
767 | g_signal_connect(G_OBJECT(combobox), "changed", G_CALLBACK(variant_changed), NULL); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
768 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
769 | return combobox; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
770 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
771 | |
|
32475
a76ccc1e443d
Reset the list of variants when the MessageStyle is changed.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32474
diff
changeset
|
772 | static void |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
773 | style_changed_reset_variants(GtkWidget* combobox, gpointer table) |
|
32475
a76ccc1e443d
Reset the list of variants when the MessageStyle is changed.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32474
diff
changeset
|
774 | { |
|
a76ccc1e443d
Reset the list of variants when the MessageStyle is changed.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32474
diff
changeset
|
775 | /* I hate to do this, I swear. But I don't know how to cleanly clean an existing combobox */ |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
776 | GtkWidget* variants = g_object_get_data(G_OBJECT(table), "variants-cbox"); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
777 | gtk_widget_destroy(variants); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
778 | variants = get_variant_config_frame(); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
779 | gtk_table_attach_defaults(GTK_TABLE(table), variants, 1, 2, 1, 2); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
780 | gtk_widget_show_all(GTK_WIDGET(table)); |
|
32475
a76ccc1e443d
Reset the list of variants when the MessageStyle is changed.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32474
diff
changeset
|
781 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
782 | g_object_set_data(G_OBJECT(table), "variants-cbox", variants); |
|
32475
a76ccc1e443d
Reset the list of variants when the MessageStyle is changed.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32474
diff
changeset
|
783 | } |
|
a76ccc1e443d
Reset the list of variants when the MessageStyle is changed.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32474
diff
changeset
|
784 | |
|
32464
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
785 | static GtkWidget* |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
786 | get_config_frame(PurplePlugin* plugin) |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
787 | { |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
788 | GtkWidget *table = gtk_table_new(2, 2, FALSE); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
789 | GtkWidget *style_config = get_style_config_frame(); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
790 | GtkWidget *variant_config = get_variant_config_frame(); |
|
32475
a76ccc1e443d
Reset the list of variants when the MessageStyle is changed.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32474
diff
changeset
|
791 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
792 | gtk_table_attach_defaults(GTK_TABLE(table), gtk_label_new("Message Style"), 0, 1, 0, 1); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
793 | gtk_table_attach_defaults(GTK_TABLE(table), style_config, 1, 2, 0, 1); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
794 | gtk_table_attach_defaults(GTK_TABLE(table), gtk_label_new("Style Variant"), 0, 1, 1, 2); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
795 | gtk_table_attach_defaults(GTK_TABLE(table), variant_config, 1, 2, 1, 2); |
|
32475
a76ccc1e443d
Reset the list of variants when the MessageStyle is changed.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32474
diff
changeset
|
796 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
797 | g_object_set_data(G_OBJECT(table), "variants-cbox", variant_config); |
|
32475
a76ccc1e443d
Reset the list of variants when the MessageStyle is changed.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32474
diff
changeset
|
798 | /* to clarify, this is a second signal connected on style config */ |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
799 | g_signal_connect_after(G_OBJECT(style_config), "changed", G_CALLBACK(style_changed_reset_variants), table); |
|
32475
a76ccc1e443d
Reset the list of variants when the MessageStyle is changed.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32474
diff
changeset
|
800 | |
|
32474
8767057d0426
use a table to display the options neatly.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32473
diff
changeset
|
801 | return table; |
|
32464
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
802 | } |
|
79a2ad758fd5
partial work towards theme selection.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
32463
diff
changeset
|
803 | |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
804 | PidginPluginUiInfo ui_info = |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
805 | { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
806 | get_config_frame, |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
807 | 0, /* page_num (Reserved) */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
808 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
809 | /* padding */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
810 | NULL, |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
811 | NULL, |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
812 | NULL, |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
813 | NULL |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
814 | }; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
815 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
816 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
817 | static PurplePluginInfo info = |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
818 | { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
819 | PURPLE_PLUGIN_MAGIC, /* Magic */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
820 | PURPLE_MAJOR_VERSION, /* Purple Major Version */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
821 | PURPLE_MINOR_VERSION, /* Purple Minor Version */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
822 | PURPLE_PLUGIN_STANDARD, /* plugin type */ |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
823 | PIDGIN_PLUGIN_TYPE, /* ui requirement */ |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
824 | 0, /* flags */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
825 | NULL, /* dependencies */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
826 | PURPLE_PRIORITY_DEFAULT, /* priority */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
827 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
828 | PLUGIN_ID, /* plugin id */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
829 | NULL, /* name */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
830 | "0.1", /* version */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
831 | NULL, /* summary */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
832 | NULL, /* description */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
833 | PLUGIN_AUTHOR, /* author */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
834 | "http://pidgin.im", /* website */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
835 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
836 | plugin_load, /* load */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
837 | plugin_unload, /* unload */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
838 | NULL, /* destroy */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
839 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
840 | &ui_info, /* ui_info */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
841 | NULL, /* extra_info */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
842 | NULL, /* prefs_info */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
843 | NULL, /* actions */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
844 | NULL, /* reserved 1 */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
845 | NULL, /* reserved 2 */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
846 | NULL, /* reserved 3 */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
847 | NULL /* reserved 4 */ |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
848 | }; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
849 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
850 | static void |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
851 | init_plugin(PurplePlugin *plugin) { |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
852 | info.name = "Adium IMs"; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
853 | info.summary = "Adium-like IMs with Pidgin"; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
854 | info.description = "You can chat in Pidgin using Adium's WebKit view."; |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
855 | |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
856 | purple_prefs_add_none("/plugins"); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
857 | purple_prefs_add_none("/plugins/gtk"); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
858 | purple_prefs_add_none("/plugins/gtk/adiumthemes"); |
|
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
859 | purple_prefs_add_string("/plugins/gtk/adiumthemes/stylepath", ""); |
|
32444
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
860 | } |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
861 | |
|
69e11efb2ba6
other files that missed my main major commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
862 | PURPLE_INIT_PLUGIN(webkit, init_plugin, info) |
|
32513
9352b4c92d13
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32505
diff
changeset
|
863 |