Mercurial > pidgin.yaz
annotate pidgin/plugins/adiumthemes/webkit.c @ 32537:9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
done. Now, I still get a crash while changing the variant.
author | tdrhq@soc.pidgin.im |
---|---|
date | Mon, 10 Aug 2009 03:25:35 +0000 |
parents | fc2c2f20370f |
children | 3b1a130f7e88 |
rev | line source |
---|---|
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
1 /* |
32534
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32533
diff
changeset
|
2 * Adium Message Styles |
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32533
diff
changeset
|
3 * Copyright (C) 2009 Arnold Noronha <arnstein87@gmail.com> |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
4 * Copyright (C) 2007 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
5 * |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
6 * This program is free software; you can redistribute it and/or |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
7 * modify it under the terms of the GNU General Public License as |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
8 * published by the Free Software Foundation; either version 2 of the |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
9 * License, or (at your option) any later version. |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
10 * |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
11 * This program is distributed in the hope that it will be useful, but |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
12 * WITHOUT ANY WARRANTY; without even the implied warranty of |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
14 * General Public License for more details. |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
15 * |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
17 * along with this program; if not, write to the Free Software |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
19 * 02111-1307, USA. |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
20 */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
21 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
22 #define PLUGIN_ID "gtk-webview-adium-ims" |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
23 #define PLUGIN_NAME "webview-adium-ims" |
32534
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32533
diff
changeset
|
24 |
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32533
diff
changeset
|
25 /* |
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32533
diff
changeset
|
26 * A lot of this was originally written by Sean Egan, but I think I've |
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32533
diff
changeset
|
27 * rewrote enough to replace the author for now. |
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32533
diff
changeset
|
28 */ |
0bac73a6a536
Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents:
32533
diff
changeset
|
29 #define PLUGIN_AUTHOR "Arnold Noronha <arnstein87@gmail.com>" |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
30 #define PURPLE_PLUGINS "Hell yeah" |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
31 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
32 /* System headers */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
33 #include <string.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
34 #include <gdk/gdk.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
35 #include <gtk/gtk.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
36 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
37 #include <webkit/webkit.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
38 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
39 /* Purple headers */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
40 #include <conversation.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
41 #include <notify.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
42 #include <util.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
43 #include <version.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
44 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
45 /* Pidgin headers */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
46 #include <gtkconv.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
47 #include <gtkplugin.h> |
32532
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32531
diff
changeset
|
48 #include <gtkwebview.h> |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
49 #include <smileyparser.h> |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
50 |
32535 | 51 /* |
52 * I'm going to allow a different style for each PidginConversation. | |
53 * This way I can do two things: 1) change the theme on the fly and not | |
54 * change existing themes, and 2) Use a different theme for IMs and | |
55 * chats. | |
56 */ | |
57 typedef struct _PidginMessageStyle { | |
58 int ref_counter; | |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
59 |
32535 | 60 /* paths */ |
61 char *style_dir; | |
62 char *template_path; | |
63 char *css_path; | |
64 | |
65 /* caches */ | |
66 char *template_html; | |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
67 char *header_html; |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
68 char *footer_html; |
32535 | 69 char *incoming_content_html; |
70 char *outgoing_content_html; | |
71 char *incoming_next_content_html; | |
72 char *outgoing_next_content_html; | |
73 char *status_html; | |
74 char *basestyle_css; | |
75 } PidginMessageStyle; | |
76 | |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
77 static GList *style_list; /**< List of PidginMessageStyles */ |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
78 static char *cur_style_dir = NULL; |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
79 static void *handle = NULL; |
32535 | 80 |
81 static PidginMessageStyle* pidgin_message_style_new () | |
82 { | |
83 PidginMessageStyle* ret = g_new0 (PidginMessageStyle, 1); | |
84 ret->ref_counter ++; | |
85 | |
86 style_list = g_list_append (style_list, ret); | |
87 return ret; | |
88 } | |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
89 |
32535 | 90 static void pidgin_message_style_unref (PidginMessageStyle *style) |
91 { | |
92 style->ref_counter--; | |
93 if (style->ref_counter) return; | |
94 | |
95 g_free (style->style_dir); | |
96 g_free (style->template_path); | |
97 g_free (style->css_path); | |
98 | |
99 g_free (style->template_html); | |
100 g_free (style->incoming_content_html); | |
101 g_free (style->outgoing_content_html); | |
102 g_free (style->outgoing_next_content_html); | |
103 g_free (style->status_html); | |
104 g_free (style->basestyle_css); | |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
105 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
106 style_list = g_list_remove (style_list, style); |
32535 | 107 g_free (style); |
108 } | |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
109 |
32536
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
110 static void variant_set_default (PidginMessageStyle* style); |
32535 | 111 static PidginMessageStyle* |
112 pidgin_message_style_load (const char* styledir) | |
113 { | |
114 /* is this style already loaded? */ | |
32536
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
115 GList *cur = style_list; |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
116 char *file; /* temporary variable */ |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
117 PidginMessageStyle *style = NULL; |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
118 |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
119 g_assert (styledir); |
32536
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
120 |
32535 | 121 for (; cur; cur = g_list_next (cur)) { |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
122 if (g_str_equal (styledir, ((PidginMessageStyle*) cur->data)->style_dir)) |
32535 | 123 return (PidginMessageStyle*) cur->data; |
124 } | |
125 | |
126 /* else we need to load it */ | |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
127 style = pidgin_message_style_new (); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
128 style->style_dir = g_strdup (styledir); |
32535 | 129 |
32536
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
130 /* find some variant file (or load from user's settings) */ |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
131 variant_set_default (style); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
132 |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
133 /* load all other files */ |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
134 |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
135 /* The template path can either come from the theme, or can |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
136 * be stock Template.html that comes with the plugin */ |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
137 style->template_path = g_build_filename(styledir, "Contents", "Resources", "Template.html", NULL); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
138 |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
139 if (!g_file_test(style->template_path, G_FILE_TEST_EXISTS)) { |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
140 g_free (style->template_path); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
141 style->template_path = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
142 } |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
143 |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
144 if (!g_file_get_contents(style->template_path, &style->template_html, NULL, NULL)) { |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
145 pidgin_message_style_unref (style); |
32536
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
146 return NULL; |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
147 } |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
148 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
149 file = g_build_filename(styledir, "Contents", "Resources", "Status.html", NULL); |
32536
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
150 if (!g_file_get_contents(file, &style->status_html, NULL, NULL)) { |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
151 pidgin_message_style_unref (style); |
32536
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
152 g_free (file); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
153 return NULL; |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
154 } |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
155 g_free (file); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
156 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
157 file = g_build_filename(styledir, "Contents", "Resources", "main.css", NULL); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
158 g_file_get_contents(file, &style->basestyle_css, NULL, NULL); |
32536
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
159 g_free (file); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
160 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
161 file = g_build_filename(styledir, "Contents", "Resources", "Header.html", NULL); |
32536
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
162 g_file_get_contents(file, &style->header_html, NULL, NULL); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
163 g_free (file); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
164 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
165 file = g_build_filename(styledir, "Contents", "Resources", "Footer.html", NULL); |
32536
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
166 g_file_get_contents(file, &style->footer_html, NULL, NULL); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
167 g_free (file); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
168 |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
169 |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
170 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
171 file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "Content.html", NULL); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
172 if (!g_file_get_contents(file, &style->incoming_content_html, NULL, NULL)) { |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
173 pidgin_message_style_unref (style); |
32536
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
174 g_free (file); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
175 return NULL; |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
176 } |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
177 g_free (file); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
178 |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
179 |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
180 /* according to the spec, the following are not necessary files */ |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
181 file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
182 if (!g_file_get_contents(file, &style->incoming_next_content_html, NULL, NULL)) { |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
183 style->incoming_next_content_html = g_strdup (style->incoming_content_html); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
184 } |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
185 g_free (file); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
186 |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
187 file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "Content.html", NULL); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
188 if (!g_file_get_contents(file, &style->outgoing_content_html, NULL, NULL)) { |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
189 style->outgoing_content_html = g_strdup(style->incoming_content_html); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
190 } |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
191 g_free (file); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
192 |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
193 file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
194 if (!g_file_get_contents(file, &style->outgoing_next_content_html, NULL, NULL)) { |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
195 style->outgoing_next_content_html = g_strdup (style->outgoing_content_html); |
32536
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
196 } |
fc2c2f20370f
Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents:
32535
diff
changeset
|
197 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
198 return style; |
32535 | 199 } |
200 | |
201 | |
32529
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
202 static void* webkit_plugin_get_handle () |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
203 { |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
204 if (handle) return handle; |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
205 else return (handle = g_malloc (1)); |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
206 } |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
207 |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
208 static void webkit_plugin_free_handle () |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
209 { |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
210 purple_signals_disconnect_by_handle (handle); |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
211 g_free (handle); |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
212 } |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
213 |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
214 static char * |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
215 replace_message_tokens( |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
216 char *text, |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
217 gsize len, |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
218 PurpleConversation *conv, |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
219 const char *name, |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
220 const char *alias, |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
221 const char *message, |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
222 PurpleMessageFlags flags, |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
223 time_t mtime) |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
224 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
225 GString *str = g_string_new_len(NULL, len); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
226 char *cur = text; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
227 char *prev = cur; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
228 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
229 while ((cur = strchr(cur, '%'))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
230 const char *replace = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
231 char *fin = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
232 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
233 if (!strncmp(cur, "%message%", strlen("%message%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
234 replace = message; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
235 } else if (!strncmp(cur, "%messageClasses%", strlen("%messageClasses%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
236 replace = flags & PURPLE_MESSAGE_SEND ? "outgoing" : |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
237 flags & PURPLE_MESSAGE_RECV ? "incoming" : "event"; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
238 } else if (!strncmp(cur, "%time", strlen("%time"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
239 char *format = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
240 if (*(cur + strlen("%time")) == '{') { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
241 char *start = cur + strlen("%time") + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
242 char *end = strstr(start, "}%"); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
243 if (!end) /* Invalid string */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
244 continue; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
245 format = g_strndup(start, end - start); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
246 fin = end + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
247 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
248 replace = purple_utf8_strftime(format ? format : "%X", NULL); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
249 g_free(format); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
250 } else if (!strncmp(cur, "%userIconPath%", strlen("%userIconPath%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
251 if (flags & PURPLE_MESSAGE_SEND) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
252 if (purple_account_get_bool(conv->account, "use-global-buddyicon", TRUE)) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
253 replace = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon"); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
254 } else { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
255 PurpleStoredImage *img = purple_buddy_icons_find_account_icon(conv->account); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
256 replace = purple_imgstore_get_filename(img); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
257 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
258 if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
259 replace = g_build_filename("Outgoing", "buddy_icon.png", NULL); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
260 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
261 } else if (flags & PURPLE_MESSAGE_RECV) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
262 PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
263 replace = purple_buddy_icon_get_full_path(icon); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
264 if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
265 replace = g_build_filename("Incoming", "buddy_icon.png", NULL); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
266 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
267 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
268 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
269 } else if (!strncmp(cur, "%senderScreenName%", strlen("%senderScreenName%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
270 replace = name; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
271 } else if (!strncmp(cur, "%sender%", strlen("%sender%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
272 replace = alias; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
273 } else if (!strncmp(cur, "%service%", strlen("%service%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
274 replace = purple_account_get_protocol_name(conv->account); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
275 } else { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
276 cur++; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
277 continue; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
278 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
279 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
280 /* Here we have a replacement to make */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
281 g_string_append_len(str, prev, cur - prev); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
282 g_string_append(str, replace); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
283 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
284 /* And update the pointers */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
285 if (fin) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
286 prev = cur = fin + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
287 } else { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
288 prev = cur = strchr(cur + 1, '%') + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
289 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
290 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
291 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
292 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
293 /* And wrap it up */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
294 g_string_append(str, prev); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
295 return g_string_free(str, FALSE); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
296 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
297 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
298 static char * |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
299 replace_header_tokens(char *text, gsize len, PurpleConversation *conv) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
300 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
301 GString *str = g_string_new_len(NULL, len); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
302 char *cur = text; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
303 char *prev = cur; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
304 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
305 if (text == NULL) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
306 return NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
307 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
308 while ((cur = strchr(cur, '%'))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
309 const char *replace = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
310 char *fin = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
311 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
312 if (!strncmp(cur, "%chatName%", strlen("%chatName%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
313 replace = conv->name; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
314 } else if (!strncmp(cur, "%sourceName%", strlen("%sourceName%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
315 replace = purple_account_get_alias(conv->account); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
316 if (replace == NULL) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
317 replace = purple_account_get_username(conv->account); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
318 } else if (!strncmp(cur, "%destinationName%", strlen("%destinationName%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
319 PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
320 if (buddy) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
321 replace = purple_buddy_get_alias(buddy); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
322 } else { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
323 replace = conv->name; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
324 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
325 } else if (!strncmp(cur, "%incomingIconPath%", strlen("%incomingIconPath%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
326 PurpleBuddyIcon *icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
327 replace = purple_buddy_icon_get_full_path(icon); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
328 } else if (!strncmp(cur, "%outgoingIconPath%", strlen("%outgoingIconPath%"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
329 } else if (!strncmp(cur, "%timeOpened", strlen("%timeOpened"))) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
330 char *format = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
331 if (*(cur + strlen("%timeOpened")) == '{') { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
332 char *start = cur + strlen("%timeOpened") + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
333 char *end = strstr(start, "}%"); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
334 if (!end) /* Invalid string */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
335 continue; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
336 format = g_strndup(start, end - start); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
337 fin = end + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
338 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
339 replace = purple_utf8_strftime(format ? format : "%X", NULL); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
340 g_free(format); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
341 } else { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
342 continue; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
343 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
344 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
345 /* Here we have a replacement to make */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
346 g_string_append_len(str, prev, cur - prev); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
347 g_string_append(str, replace); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
348 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
349 /* And update the pointers */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
350 if (fin) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
351 prev = cur = fin + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
352 } else { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
353 prev = cur = strchr(cur + 1, '%') + 1; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
354 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
355 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
356 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
357 /* And wrap it up */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
358 g_string_append(str, prev); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
359 return g_string_free(str, FALSE); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
360 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
361 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
362 static char * |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
363 replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *header, char *footer) { |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
364 GString *str = g_string_new_len(NULL, len); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
365 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
366 char **ms = g_strsplit(text, "%@", 6); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
367 char *base = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
368 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
369 if (ms[0] == NULL || ms[1] == NULL || ms[2] == NULL || ms[3] == NULL || ms[4] == NULL || ms[5] == NULL) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
370 g_strfreev(ms); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
371 g_string_free(str, TRUE); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
372 return NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
373 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
374 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
375 g_string_append(str, ms[0]); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
376 g_string_append(str, "file://"); |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
377 base = g_build_filename (style->style_dir, "Contents", "Resources", "Template.html", NULL); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
378 g_string_append(str, base); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
379 g_free (base); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
380 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
381 g_string_append(str, ms[1]); |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
382 if (style->basestyle_css) |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
383 g_string_append(str, style->basestyle_css); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
384 g_string_append(str, ms[2]); |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
385 if (style->css_path) { |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
386 g_string_append(str, "file://"); |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
387 g_string_append(str, style->css_path); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
388 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
389 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
390 g_string_append(str, ms[3]); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
391 if (header) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
392 g_string_append(str, header); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
393 g_string_append(str, ms[4]); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
394 if (footer) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
395 g_string_append(str, footer); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
396 g_string_append(str, ms[5]); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
397 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
398 g_strfreev(ms); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
399 return g_string_free (str, FALSE); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
400 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
401 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
402 static GtkWidget * |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
403 get_webkit(PurpleConversation *conv) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
404 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
405 PidginConversation *gtkconv; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
406 gtkconv = PIDGIN_CONVERSATION(conv); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
407 if (!gtkconv) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
408 return NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
409 else |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
410 return gtkconv->webview; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
411 } |
32531 | 412 |
413 /** | |
414 * Called when either a new PurpleConversation is created | |
415 * or when a PidginConversation changes its active PurpleConversation | |
416 * | |
417 * FIXME: it's not at all clear to me as to how | |
418 * Adium themes handle the case when the PurpleConversation | |
419 * changes. | |
420 */ | |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
421 static void |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
422 init_theme_for_webkit (PurpleConversation *conv, char *style_dir) |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
423 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
424 GtkWidget *webkit = PIDGIN_CONVERSATION(conv)->webview; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
425 char *header, *footer; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
426 char *template; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
427 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
428 char* basedir; |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
429 char* baseuri; |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
430 PidginMessageStyle *style; |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
431 style = pidgin_message_style_load (style_dir); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
432 g_assert (style); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
433 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
434 basedir = g_build_filename (style->style_dir, "Contents", "Resources", "Template.html", NULL); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
435 baseuri = g_strdup_printf ("file://%s", basedir); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
436 header = replace_header_tokens(style->header_html, strlen(style->header_html), conv); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
437 footer = replace_header_tokens(style->footer_html, strlen(style->footer_html), conv); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
438 template = replace_template_tokens(style, style->template_html, strlen(style->template_html) + strlen(style->header_html), header, footer); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
439 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
440 if (!g_object_get_data (G_OBJECT(webkit), "adium-themed")) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
441 webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
442 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
443 g_object_set_data (G_OBJECT(webkit), "adium-themed", style); |
32531 | 444 |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
445 g_free (basedir); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
446 g_free (baseuri); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
447 g_free (header); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
448 g_free (footer); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
449 g_free (template); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
450 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
451 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
452 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
453 /* restore the non theme version of the conversation window */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
454 static void |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
455 finalize_theme_for_webkit (PurpleConversation *conv) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
456 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
457 GtkWidget *webview = PIDGIN_CONVERSATION(conv)->webview; |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
458 PidginMessageStyle *style = g_object_get_data (G_OBJECT(webview), "adium-themed"); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
459 |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
460 webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), "", "text/html", "UTF-8", ""); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
461 g_object_set_data (G_OBJECT(webview), "adium-themed", NULL); |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
462 pidgin_message_style_unref (style); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
463 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
464 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
465 struct webkit_script { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
466 GtkWidget *webkit; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
467 char *script; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
468 }; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
469 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
470 static gboolean purple_webkit_execute_script(gpointer _script) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
471 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
472 struct webkit_script *script = (struct webkit_script*) _script; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
473 printf ("%s\n", script->script); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
474 webkit_web_view_execute_script(WEBKIT_WEB_VIEW(script->webkit), script->script); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
475 g_free(script->script); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
476 g_free(script); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
477 return FALSE; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
478 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
479 |
32533 | 480 |
481 static gboolean webkit_on_displaying_im_msg (PurpleAccount *account, | |
32529
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
482 const char* name, |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
483 char **pmessage, |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
484 PurpleConversation *conv, |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
485 PurpleMessageFlags flags, |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
486 gpointer data) |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
487 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
488 GtkWidget *webkit; |
32529
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
489 char *message = *pmessage; |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
490 const char *alias = name; /* FIXME: signal doesn't give me alias */ |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
491 char *stripped; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
492 char *message_html; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
493 char *msg; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
494 char *escape; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
495 char *script; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
496 char *func = "appendMessage"; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
497 char *smileyed; |
32529
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
498 time_t mtime = time (NULL); /* FIXME: this should come from the write_conv calback, but the signal doesn't pass this to me */ |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
499 |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
500 struct webkit_script *wk_script; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
501 PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags")); |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
502 PidginMessageStyle *style; |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
503 |
32532
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32531
diff
changeset
|
504 fprintf (stderr, "hmm.. here %s %s\n", name, message); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
505 webkit = get_webkit(conv); |
32529
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
506 stripped = g_strdup(message); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
507 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
508 style = g_object_get_data (G_OBJECT (webkit), "adium-themed"); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
509 |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
510 if (flags & PURPLE_MESSAGE_SEND && old_flags & PURPLE_MESSAGE_SEND) { |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
511 message_html = style->outgoing_next_content_html; |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
512 func = "appendNextMessage"; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
513 } else if (flags & PURPLE_MESSAGE_SEND) { |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
514 message_html = style->outgoing_content_html; |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
515 } else if (flags & PURPLE_MESSAGE_RECV && old_flags & PURPLE_MESSAGE_RECV) { |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
516 message_html = style->incoming_next_content_html; |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
517 func = "appendNextMessage"; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
518 } else if (flags & PURPLE_MESSAGE_RECV) { |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
519 message_html = style->incoming_content_html; |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
520 } else { |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
521 message_html = style->status_html; |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
522 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
523 purple_conversation_set_data(conv, "webkit-lastflags", GINT_TO_POINTER(flags)); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
524 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
525 smileyed = smiley_parse_markup(stripped, conv->account->protocol_id); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
526 msg = replace_message_tokens(message_html, 0, conv, name, alias, smileyed, flags, mtime); |
32532
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32531
diff
changeset
|
527 escape = gtk_webview_quote_js_string (msg); |
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32531
diff
changeset
|
528 script = g_strdup_printf("%s(%s)", func, escape); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
529 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
530 wk_script = g_new0(struct webkit_script, 1); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
531 wk_script->script = script; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
532 wk_script->webkit = webkit; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
533 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
534 g_idle_add(purple_webkit_execute_script, wk_script); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
535 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
536 g_free(smileyed); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
537 g_free(msg); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
538 g_free(stripped); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
539 g_free(escape); |
32529
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
540 |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
541 return TRUE; /* GtkConv should not handle this guy */ |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
542 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
543 |
32533 | 544 static gboolean webkit_on_displaying_chat_msg (PurpleAccount *account, |
545 const char *who, | |
546 char **message, | |
547 PurpleConversation *conv, | |
548 PurpleMessageFlags flags, | |
549 gpointer userdata) | |
550 { | |
551 /* handle exactly like an IM message */ | |
552 return webkit_on_displaying_im_msg (account, who, message, conv, flags, NULL); | |
553 } | |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
554 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
555 static void |
32531 | 556 webkit_on_converstation_displayed (PidginConversation *gtkconv, gpointer data) |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
557 { |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
558 init_theme_for_webkit (gtkconv->active_conv, cur_style_dir); |
32531 | 559 } |
560 | |
561 static void | |
562 webkit_on_conversation_switched (PurpleConversation *conv, gpointer data) | |
563 { | |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
564 init_theme_for_webkit (conv, cur_style_dir); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
565 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
566 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
567 static void |
32532
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32531
diff
changeset
|
568 webkit_on_conversation_hiding (PidginConversation *gtkconv, gpointer data) |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
569 { |
32532
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32531
diff
changeset
|
570 /* |
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32531
diff
changeset
|
571 * I'm not sure if I need to do anything here, but let's keep |
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32531
diff
changeset
|
572 * this anyway |
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32531
diff
changeset
|
573 */ |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
574 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
575 |
32535 | 576 /** |
577 * Get each of the files corresponding to each variant. | |
578 */ | |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
579 static GList* |
32535 | 580 get_theme_files(PidginMessageStyle *style) |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
581 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
582 GList *ret = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
583 GDir *variants; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
584 const char *css_file; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
585 char *css; |
32535 | 586 char *variant_dir; |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
587 |
32535 | 588 g_assert (style->style_dir); |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
589 variant_dir = g_build_filename(style->style_dir, "Contents", "Resources", "Variants", NULL); |
32535 | 590 |
591 variants = g_dir_open(variant_dir, 0, NULL); | |
592 if (!variants) return NULL; | |
593 | |
594 while ((css_file = g_dir_read_name(variants)) != NULL) { | |
595 if (!g_str_has_suffix (css_file, ".css")) | |
596 continue; | |
597 | |
598 css = g_build_filename(variant_dir, css_file, NULL); | |
599 ret = g_list_append(ret, css); | |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
600 } |
32535 | 601 |
602 g_dir_close(variants); | |
603 g_free(variant_dir); | |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
604 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
605 ret = g_list_sort (ret, (GCompareFunc)g_strcmp0); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
606 return ret; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
607 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
608 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
609 static void |
32535 | 610 variant_set_default (PidginMessageStyle* style) |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
611 { |
32535 | 612 GList *all, *iter; |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
613 const char *css_path = purple_prefs_get_string ("/plugins/gtk/adiumthemes/csspath"); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
614 |
32535 | 615 g_free (style->css_path); |
616 if (g_str_has_prefix (css_path, style->style_dir) && | |
617 g_file_test (css_path, G_FILE_TEST_EXISTS)) { | |
618 style->css_path = g_strdup (css_path); | |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
619 return; |
32535 | 620 } |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
621 else { |
32535 | 622 /* something about the theme has changed */ |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
623 css_path = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
624 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
625 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
626 all = get_theme_files (style); |
32535 | 627 |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
628 if (all) { |
32535 | 629 style->css_path = g_strdup (all->data); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
630 purple_prefs_set_string ("/plugins/gtk/adiumthemes/csspath", css_path); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
631 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
632 |
32535 | 633 for (iter = all; iter; iter = g_list_next (iter)) |
634 g_free (iter->data); | |
635 | |
636 g_list_free (all); | |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
637 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
638 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
639 static gboolean |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
640 plugin_load(PurplePlugin *plugin) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
641 { |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
642 PidginMessageStyle *_style; /* temp */ |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
643 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
644 if (g_path_is_absolute (purple_user_dir())) |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
645 cur_style_dir = g_build_filename(purple_user_dir(), "style", NULL); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
646 else { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
647 char* cur = g_get_current_dir (); |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
648 cur_style_dir = g_build_filename (cur, purple_user_dir(), "style", NULL); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
649 g_free (cur); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
650 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
651 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
652 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
653 _style = pidgin_message_style_load (cur_style_dir); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
654 if (!_style) { |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
655 g_free (cur_style_dir); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
656 cur_style_dir = NULL; |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
657 return FALSE; |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
658 } |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
659 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
660 pidgin_message_style_unref (_style); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
661 |
32529
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
662 purple_signal_connect (pidgin_conversations_get_handle (), |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
663 "displaying-im-msg", |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
664 webkit_plugin_get_handle (), |
32533 | 665 PURPLE_CALLBACK(webkit_on_displaying_im_msg), |
32529
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
666 NULL); |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
667 |
32531 | 668 purple_signal_connect (pidgin_conversations_get_handle (), |
32533 | 669 "displaying-chat-msg", |
670 webkit_plugin_get_handle (), | |
671 PURPLE_CALLBACK(webkit_on_displaying_chat_msg), | |
672 NULL); | |
673 | |
674 purple_signal_connect (pidgin_conversations_get_handle (), | |
32531 | 675 "conversation-displayed", |
676 webkit_plugin_get_handle (), | |
677 PURPLE_CALLBACK(webkit_on_converstation_displayed), | |
678 NULL); | |
679 | |
680 purple_signal_connect (pidgin_conversations_get_handle (), | |
681 "conversation-switched", | |
682 webkit_plugin_get_handle (), | |
683 PURPLE_CALLBACK(webkit_on_conversation_switched), | |
684 NULL); | |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
685 |
32532
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32531
diff
changeset
|
686 purple_signal_connect (pidgin_conversations_get_handle (), |
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32531
diff
changeset
|
687 "conversation-hiding", |
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32531
diff
changeset
|
688 webkit_plugin_get_handle (), |
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32531
diff
changeset
|
689 PURPLE_CALLBACK(webkit_on_conversation_hiding), |
32d7d3c4163c
* removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents:
32531
diff
changeset
|
690 NULL); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
691 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
692 /* finally update each of the existing conversation windows */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
693 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
694 GList* list = purple_get_conversations (); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
695 for (;list; list = g_list_next(list)) |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
696 init_theme_for_webkit (list->data, cur_style_dir); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
697 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
698 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
699 return TRUE; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
700 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
701 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
702 static gboolean |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
703 plugin_unload(PurplePlugin *plugin) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
704 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
705 GList *list; |
32529
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
706 |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
707 webkit_plugin_free_handle (); |
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
708 |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
709 list = purple_get_conversations (); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
710 while (list) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
711 finalize_theme_for_webkit(list->data); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
712 list = g_list_next(list); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
713 } |
32529
50a38bbca397
use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents:
32525
diff
changeset
|
714 |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
715 return TRUE; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
716 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
717 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
718 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
719 static void |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
720 variant_update_conversation (PurpleConversation *conv) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
721 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
722 PidginConversation *gtkconv = PIDGIN_CONVERSATION (conv); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
723 WebKitWebView *webview = WEBKIT_WEB_VIEW (gtkconv->webview); |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
724 PidginMessageStyle *style = (PidginMessageStyle*) g_object_get_data (G_OBJECT(webview), "adium-themed"); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
725 |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
726 char* script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", style->css_path); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
727 webkit_web_view_execute_script (webview, script); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
728 g_free (script); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
729 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
730 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
731 static void |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
732 variant_changed (GtkWidget* combobox, gpointer null) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
733 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
734 char *name, *name_with_ext; |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
735 char *css_path; |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
736 GList *list; |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
737 PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
738 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
739 g_assert (style); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
740 |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
741 /* it is possible that the theme changed by this point, so we check |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
742 * that first */ |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
743 |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
744 name = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combobox)); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
745 name_with_ext = g_strdup_printf ("%s.css", name); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
746 g_free (name); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
747 |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
748 css_path = g_build_filename (style->style_dir, "Contents", "Resources", "Variants", name_with_ext, NULL); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
749 |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
750 if (!g_file_test (css_path, G_FILE_TEST_EXISTS)) { |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
751 goto cleanup; |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
752 } |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
753 |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
754 g_free (style->css_path); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
755 style->css_path = g_strdup (css_path); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
756 purple_prefs_set_string ("/plugins/gtk/adiumthemes/csspath", css_path); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
757 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
758 /* update each conversation */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
759 list = purple_get_conversations (); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
760 while (list) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
761 variant_update_conversation (list->data); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
762 list = g_list_next(list); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
763 } |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
764 |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
765 cleanup: |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
766 g_free (css_path); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
767 g_free (name_with_ext); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
768 pidgin_message_style_unref (style); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
769 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
770 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
771 static GtkWidget * |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
772 get_config_frame(PurplePlugin *plugin) |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
773 { |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
774 PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir); |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
775 GList *themes = get_theme_files(style); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
776 GList *theme = themes; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
777 char *curdir = NULL; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
778 GtkWidget *combobox = gtk_combo_box_new_text(); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
779 int def = -1, index = 0; |
32537
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
780 char* css_path = style->css_path; |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
781 |
9ad4257f5e8f
Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents:
32536
diff
changeset
|
782 pidgin_message_style_unref (style); |
32525
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
783 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
784 while (theme) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
785 char *basename = g_path_get_basename(theme->data); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
786 char *dirname = g_path_get_dirname(theme->data); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
787 if (!curdir || strcmp(curdir, dirname)) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
788 char *plist, *plist_xml; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
789 gsize plist_len; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
790 xmlnode *node; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
791 g_free(curdir); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
792 curdir = strdup(dirname); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
793 plist = g_build_filename(curdir, "..", "..", "Info.plist", NULL); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
794 if (!g_file_get_contents(plist, &plist_xml, &plist_len, NULL)) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
795 continue; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
796 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
797 node = xmlnode_from_str(plist_xml, plist_len); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
798 if (!node) continue; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
799 node = xmlnode_get_child(node, "dict"); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
800 if (!node) continue; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
801 node = xmlnode_get_child(node, "key"); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
802 while (node && strcmp(xmlnode_get_data(node), "CFBundleName")) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
803 node = xmlnode_get_next_twin(node); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
804 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
805 if (!node) continue; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
806 node = node->next; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
807 while (node && node->type != XMLNODE_TYPE_TAG) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
808 node = node->next; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
809 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
810 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
811 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
812 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
813 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
814 char *temp = g_strndup (basename, strlen(basename)-4); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
815 gtk_combo_box_append_text (GTK_COMBO_BOX(combobox), temp); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
816 g_free (temp); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
817 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
818 if (g_str_has_suffix (css_path, basename)) |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
819 def = index; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
820 index ++; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
821 theme = theme->next; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
822 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
823 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
824 gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), def); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
825 g_signal_connect (G_OBJECT(combobox), "changed", G_CALLBACK(variant_changed), NULL); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
826 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
827 return combobox; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
828 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
829 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
830 PidginPluginUiInfo ui_info = |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
831 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
832 get_config_frame, |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
833 0, /* page_num (Reserved) */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
834 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
835 /* padding */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
836 NULL, |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
837 NULL, |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
838 NULL, |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
839 NULL |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
840 }; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
841 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
842 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
843 static PurplePluginInfo info = |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
844 { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
845 PURPLE_PLUGIN_MAGIC, /* Magic */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
846 PURPLE_MAJOR_VERSION, /* Purple Major Version */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
847 PURPLE_MINOR_VERSION, /* Purple Minor Version */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
848 PURPLE_PLUGIN_STANDARD, /* plugin type */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
849 PIDGIN_PLUGIN_TYPE, /* ui requirement */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
850 0, /* flags */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
851 NULL, /* dependencies */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
852 PURPLE_PRIORITY_DEFAULT, /* priority */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
853 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
854 PLUGIN_ID, /* plugin id */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
855 NULL, /* name */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
856 "0.1", /* version */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
857 NULL, /* summary */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
858 NULL, /* description */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
859 PLUGIN_AUTHOR, /* author */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
860 "http://pidgin.im", /* website */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
861 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
862 plugin_load, /* load */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
863 plugin_unload, /* unload */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
864 NULL, /* destroy */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
865 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
866 &ui_info, /* ui_info */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
867 NULL, /* extra_info */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
868 NULL, /* prefs_info */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
869 NULL, /* actions */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
870 NULL, /* reserved 1 */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
871 NULL, /* reserved 2 */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
872 NULL, /* reserved 3 */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
873 NULL /* reserved 4 */ |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
874 }; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
875 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
876 static void |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
877 init_plugin(PurplePlugin *plugin) { |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
878 info.name = "Adium IMs"; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
879 info.summary = "Adium-like IMs with Pidgin"; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
880 info.description = "You can chat in Pidgin using Adium's WebKit view."; |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
881 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
882 purple_prefs_add_none ("/plugins"); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
883 purple_prefs_add_none ("/plugins/gtk"); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
884 purple_prefs_add_none ("/plugins/gtk/adiumthemes"); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
885 purple_prefs_add_string ("/plugins/gtk/adiumthemes/csspath", ""); |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
886 } |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
887 |
d0be198c4694
other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
888 PURPLE_INIT_PLUGIN(webkit, init_plugin, info) |