annotate pidgin/plugins/adiumthemes/webkit.c @ 32085:f989838b91ae

removed the fixme.
author tdrhq@soc.pidgin.im
date Mon, 10 Aug 2009 08:20:05 +0000
parents d60517f63f99
children 355b9461057f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
1 /*
32073
0bac73a6a536 Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents: 32072
diff changeset
2 * Adium Message Styles
0bac73a6a536 Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents: 32072
diff changeset
3 * Copyright (C) 2009 Arnold Noronha <arnstein87@gmail.com>
32064
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"
32073
0bac73a6a536 Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents: 32072
diff changeset
24
0bac73a6a536 Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents: 32072
diff changeset
25 /*
0bac73a6a536 Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents: 32072
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: 32072
diff changeset
27 * rewrote enough to replace the author for now.
0bac73a6a536 Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents: 32072
diff changeset
28 */
0bac73a6a536 Changed the Author added copyright, etc.
tdrhq@soc.pidgin.im
parents: 32072
diff changeset
29 #define PLUGIN_AUTHOR "Arnold Noronha <arnstein87@gmail.com>"
32064
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>
32071
32d7d3c4163c * removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents: 32070
diff changeset
48 #include <gtkwebview.h>
32064
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
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
51
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
52 /* GObject data keys */
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
53 #define MESSAGE_STYLE_KEY "message-style"
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
54
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
55 /*
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
56 * I'm going to allow a different style for each PidginConversation.
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
57 * This way I can do two things: 1) change the theme on the fly and not
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
58 * change existing themes, and 2) Use a different theme for IMs and
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
59 * chats.
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
60 */
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
61 typedef struct _PidginMessageStyle {
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
62 int ref_counter;
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
63
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
64 /* paths */
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
65 char *style_dir;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
66 char *template_path;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
67 char *css_path;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
68
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
69 /* caches */
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
70 char *template_html;
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
71 char *header_html;
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
72 char *footer_html;
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
73 char *incoming_content_html;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
74 char *outgoing_content_html;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
75 char *incoming_next_content_html;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
76 char *outgoing_next_content_html;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
77 char *status_html;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
78 char *basestyle_css;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
79 } PidginMessageStyle;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
80
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
81 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: 32075
diff changeset
82 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: 32075
diff changeset
83 static void *handle = NULL;
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
84
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
85 static PidginMessageStyle* pidgin_message_style_new (const char* styledir)
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
86 {
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
87 PidginMessageStyle* ret = g_new0 (PidginMessageStyle, 1);
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
88 GList *iter;
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
89
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
90 /* sanity check */
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
91 for (iter = style_list; iter; iter = g_list_next (iter))
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
92 g_assert (!g_str_equal (((PidginMessageStyle*)iter->data)->style_dir, styledir));
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
93
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
94 ret->ref_counter = 1;
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
95 ret->style_dir = g_strdup (styledir);
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
96
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
97 style_list = g_list_append (style_list, ret);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
98 return ret;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
99 }
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
100
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
101 static void pidgin_message_style_unref (PidginMessageStyle *style)
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
102 {
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
103 if (!style) return;
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
104 g_assert (style->ref_counter > 0);
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
105
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
106 style->ref_counter--;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
107 if (style->ref_counter) return;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
108
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
109 g_free (style->style_dir);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
110 g_free (style->template_path);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
111 g_free (style->css_path);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
112
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
113 g_free (style->template_html);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
114 g_free (style->incoming_content_html);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
115 g_free (style->outgoing_content_html);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
116 g_free (style->outgoing_next_content_html);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
117 g_free (style->status_html);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
118 g_free (style->basestyle_css);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
119
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
120 style_list = g_list_remove (style_list, style);
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
121 g_free (style);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
122 }
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
123
32075
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
124 static void variant_set_default (PidginMessageStyle* style);
32079
7b92a2b852db Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents: 32078
diff changeset
125 static void webkit_on_webview_destroy (GtkObject* obj, gpointer data);
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
126
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
127 static PidginMessageStyle*
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
128 pidgin_message_style_load (const char* styledir)
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
129 {
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
130 /* is this style already loaded? */
32075
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
131 GList *cur = style_list;
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
132 char *file; /* temporary variable */
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
133 PidginMessageStyle *style = NULL;
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
134
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
135 g_assert (styledir);
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
136 for (cur = style_list; cur; cur = g_list_next (cur)) {
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
137 style = (PidginMessageStyle*) cur->data;
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
138 if (g_str_equal (styledir, style->style_dir)) {
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
139 style->ref_counter++;
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
140 return style;
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
141 }
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
142 }
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
143
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
144 /* else we need to load it */
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
145 style = pidgin_message_style_new (styledir);
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
146
32075
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
147 /* load all other files */
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
148
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
149 /* The template path can either come from the theme, or can
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
150 * be stock Template.html that comes with the plugin */
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
151 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: 32074
diff changeset
152
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
153 if (!g_file_test(style->template_path, G_FILE_TEST_EXISTS)) {
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
154 g_free (style->template_path);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
155 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: 32074
diff changeset
156 }
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
157
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
158 if (!g_file_get_contents(style->template_path, &style->template_html, NULL, NULL)) {
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
159 pidgin_message_style_unref (style);
32075
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
160 return NULL;
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
161 }
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
162
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
163 file = g_build_filename(styledir, "Contents", "Resources", "Status.html", NULL);
32075
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
164 if (!g_file_get_contents(file, &style->status_html, NULL, NULL)) {
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
165 pidgin_message_style_unref (style);
32075
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
166 g_free (file);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
167 return NULL;
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
168 }
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
169 g_free (file);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
170
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
171 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: 32075
diff changeset
172 g_file_get_contents(file, &style->basestyle_css, NULL, NULL);
32075
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
173 g_free (file);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
174
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
175 file = g_build_filename(styledir, "Contents", "Resources", "Header.html", NULL);
32075
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
176 g_file_get_contents(file, &style->header_html, NULL, NULL);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
177 g_free (file);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
178
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
179 file = g_build_filename(styledir, "Contents", "Resources", "Footer.html", NULL);
32075
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
180 g_file_get_contents(file, &style->footer_html, NULL, NULL);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
181 g_free (file);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
182
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
183 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: 32075
diff changeset
184 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: 32075
diff changeset
185 pidgin_message_style_unref (style);
32075
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
186 g_free (file);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
187 return NULL;
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
188 }
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
189 g_free (file);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
190
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
191
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
192 /* according to the spec, the following are optional files */
32075
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
193 file = g_build_filename(styledir, "Contents", "Resources", "Incoming", "NextContent.html", NULL);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
194 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: 32074
diff changeset
195 style->incoming_next_content_html = g_strdup (style->incoming_content_html);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
196 }
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
197 g_free (file);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
198
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
199 file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "Content.html", NULL);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
200 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: 32074
diff changeset
201 style->outgoing_content_html = g_strdup(style->incoming_content_html);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
202 }
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
203 g_free (file);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
204
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
205 file = g_build_filename(styledir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL);
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
206 if (!g_file_get_contents(file, &style->outgoing_next_content_html, NULL, NULL)) {
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
207 style->outgoing_next_content_html = g_strdup (style->outgoing_content_html);
32075
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
208 }
fc2c2f20370f Another temporary commit that will not compile.
tdrhq@soc.pidgin.im
parents: 32074
diff changeset
209
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
210 /* find some variant file (or load from user's settings) */
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
211 variant_set_default (style);
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
212
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
213 return style;
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
214 }
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
215
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
216
32068
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
217 static void* webkit_plugin_get_handle ()
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
218 {
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
219 if (handle) return handle;
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
220 else return (handle = g_malloc (1));
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
221 }
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
222
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
223 static void webkit_plugin_free_handle ()
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
224 {
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
225 purple_signals_disconnect_by_handle (handle);
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
226 g_free (handle);
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
227 }
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
228
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
229 static char *
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
230 replace_message_tokens(
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
231 char *text,
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
232 gsize len,
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
233 PurpleConversation *conv,
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
234 const char *name,
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
235 const char *alias,
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
236 const char *message,
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
237 PurpleMessageFlags flags,
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
238 time_t mtime)
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
239 {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
240 GString *str = g_string_new_len(NULL, len);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
241 char *cur = text;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
242 char *prev = cur;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
243
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
244 while ((cur = strchr(cur, '%'))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
245 const char *replace = NULL;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
246 char *fin = NULL;
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 if (!strncmp(cur, "%message%", strlen("%message%"))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
249 replace = message;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
250 } else if (!strncmp(cur, "%messageClasses%", strlen("%messageClasses%"))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
251 replace = flags & PURPLE_MESSAGE_SEND ? "outgoing" :
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
252 flags & PURPLE_MESSAGE_RECV ? "incoming" : "event";
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
253 } else if (!strncmp(cur, "%time", strlen("%time"))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
254 char *format = NULL;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
255 if (*(cur + strlen("%time")) == '{') {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
256 char *start = cur + strlen("%time") + 1;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
257 char *end = strstr(start, "}%");
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
258 if (!end) /* Invalid string */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
259 continue;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
260 format = g_strndup(start, end - start);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
261 fin = end + 1;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
262 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
263 replace = purple_utf8_strftime(format ? format : "%X", NULL);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
264 g_free(format);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
265 } else if (!strncmp(cur, "%userIconPath%", strlen("%userIconPath%"))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
266 if (flags & PURPLE_MESSAGE_SEND) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
267 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
268 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
269 } else {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
270 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
271 replace = purple_imgstore_get_filename(img);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
272 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
273 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
274 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
275 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
276 } else if (flags & PURPLE_MESSAGE_RECV) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
277 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
278 replace = purple_buddy_icon_get_full_path(icon);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
279 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
280 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
281 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
282 }
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 } else if (!strncmp(cur, "%senderScreenName%", strlen("%senderScreenName%"))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
285 replace = name;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
286 } else if (!strncmp(cur, "%sender%", strlen("%sender%"))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
287 replace = alias;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
288 } else if (!strncmp(cur, "%service%", strlen("%service%"))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
289 replace = purple_account_get_protocol_name(conv->account);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
290 } else {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
291 cur++;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
292 continue;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
293 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
294
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
295 /* Here we have a replacement to make */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
296 g_string_append_len(str, prev, cur - prev);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
297 g_string_append(str, replace);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
298
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
299 /* And update the pointers */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
300 if (fin) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
301 prev = cur = fin + 1;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
302 } else {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
303 prev = cur = strchr(cur + 1, '%') + 1;
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
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
306 }
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 /* And wrap it up */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
309 g_string_append(str, prev);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
310 return g_string_free(str, FALSE);
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
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
313 static char *
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
314 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
315 {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
316 GString *str = g_string_new_len(NULL, len);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
317 char *cur = text;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
318 char *prev = cur;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
319
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
320 if (text == NULL)
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
321 return NULL;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
322
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
323 while ((cur = strchr(cur, '%'))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
324 const char *replace = NULL;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
325 char *fin = NULL;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
326
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
327 if (!strncmp(cur, "%chatName%", strlen("%chatName%"))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
328 replace = conv->name;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
329 } else if (!strncmp(cur, "%sourceName%", strlen("%sourceName%"))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
330 replace = purple_account_get_alias(conv->account);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
331 if (replace == NULL)
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
332 replace = purple_account_get_username(conv->account);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
333 } else if (!strncmp(cur, "%destinationName%", strlen("%destinationName%"))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
334 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
335 if (buddy) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
336 replace = purple_buddy_get_alias(buddy);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
337 } else {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
338 replace = conv->name;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
339 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
340 } else if (!strncmp(cur, "%incomingIconPath%", strlen("%incomingIconPath%"))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
341 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
342 replace = purple_buddy_icon_get_full_path(icon);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
343 } else if (!strncmp(cur, "%outgoingIconPath%", strlen("%outgoingIconPath%"))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
344 } else if (!strncmp(cur, "%timeOpened", strlen("%timeOpened"))) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
345 char *format = NULL;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
346 if (*(cur + strlen("%timeOpened")) == '{') {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
347 char *start = cur + strlen("%timeOpened") + 1;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
348 char *end = strstr(start, "}%");
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
349 if (!end) /* Invalid string */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
350 continue;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
351 format = g_strndup(start, end - start);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
352 fin = end + 1;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
353 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
354 replace = purple_utf8_strftime(format ? format : "%X", NULL);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
355 g_free(format);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
356 } else {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
357 continue;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
358 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
359
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
360 /* Here we have a replacement to make */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
361 g_string_append_len(str, prev, cur - prev);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
362 g_string_append(str, replace);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
363
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
364 /* And update the pointers */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
365 if (fin) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
366 prev = cur = fin + 1;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
367 } else {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
368 prev = cur = strchr(cur + 1, '%') + 1;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
369 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
370 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
371
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
372 /* And wrap it up */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
373 g_string_append(str, prev);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
374 return g_string_free(str, FALSE);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
375 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
376
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
377 static char *
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
378 replace_template_tokens(PidginMessageStyle *style, char *text, int len, char *header, char *footer) {
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
379 GString *str = g_string_new_len(NULL, len);
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 char **ms = g_strsplit(text, "%@", 6);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
382 char *base = NULL;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
383
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
384 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
385 g_strfreev(ms);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
386 g_string_free(str, TRUE);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
387 return NULL;
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[0]);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
391 g_string_append(str, "file://");
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
392 base = g_build_filename (style->style_dir, "Contents", "Resources", "Template.html", NULL);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
393 g_string_append(str, base);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
394 g_free (base);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
395
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
396 g_string_append(str, ms[1]);
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
397 if (style->basestyle_css)
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
398 g_string_append(str, style->basestyle_css);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
399 g_string_append(str, ms[2]);
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
400 if (style->css_path) {
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
401 g_string_append(str, "file://");
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
402 g_string_append(str, style->css_path);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
403 }
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 g_string_append(str, ms[3]);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
406 if (header)
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
407 g_string_append(str, header);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
408 g_string_append(str, ms[4]);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
409 if (footer)
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
410 g_string_append(str, footer);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
411 g_string_append(str, ms[5]);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
412
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
413 g_strfreev(ms);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
414 return g_string_free (str, FALSE);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
415 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
416
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
417 static GtkWidget *
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
418 get_webkit(PurpleConversation *conv)
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
419 {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
420 PidginConversation *gtkconv;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
421 gtkconv = PIDGIN_CONVERSATION(conv);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
422 if (!gtkconv)
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
423 return NULL;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
424 else
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
425 return gtkconv->webview;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
426 }
32070
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
427
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
428 /**
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
429 * Called when either a new PurpleConversation is created
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
430 * or when a PidginConversation changes its active PurpleConversation
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
431 * This will not change the theme if the theme is already set.
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
432 * (This is to prevent accidental theme changes if a new
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
433 * PurpleConversation gets added.
32070
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
434 *
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
435 * FIXME: it's not at all clear to me as to how
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
436 * Adium themes handle the case when the PurpleConversation
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
437 * changes.
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
438 */
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
439 static void
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
440 init_theme_for_webkit (PurpleConversation *conv, char *style_dir)
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
441 {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
442 GtkWidget *webkit = PIDGIN_CONVERSATION(conv)->webview;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
443 char *header, *footer;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
444 char *template;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
445
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
446 char* basedir;
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
447 char* baseuri;
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
448 PidginMessageStyle *style, *oldStyle;
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
449 oldStyle = g_object_get_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY);
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
450
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
451 if (oldStyle) return;
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
452
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
453 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: 32075
diff changeset
454 g_assert (style);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
455
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
456 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: 32075
diff changeset
457 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: 32075
diff changeset
458 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: 32075
diff changeset
459 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: 32075
diff changeset
460 template = replace_template_tokens(style, style->template_html, strlen(style->template_html) + strlen(style->header_html), header, footer);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
461
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
462 webkit_web_view_load_string(WEBKIT_WEB_VIEW(webkit), template, "text/html", "UTF-8", baseuri);
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
463
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
464 g_object_set_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY, style);
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
465
32079
7b92a2b852db Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents: 32078
diff changeset
466 /* I need to unref this style when the webkit object destroys */
7b92a2b852db Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents: 32078
diff changeset
467 g_signal_connect (G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), style);
32070
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
468
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
469 g_free (basedir);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
470 g_free (baseuri);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
471 g_free (header);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
472 g_free (footer);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
473 g_free (template);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
474 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
475
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
476
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
477 /* 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
478 static void
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
479 finalize_theme_for_webkit (PurpleConversation *conv)
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
480 {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
481 GtkWidget *webview = PIDGIN_CONVERSATION(conv)->webview;
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
482 PidginMessageStyle *style = g_object_get_data (G_OBJECT(webview), MESSAGE_STYLE_KEY);
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
483
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
484 webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), "", "text/html", "UTF-8", "");
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
485
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
486 g_object_set_data (G_OBJECT(webview), MESSAGE_STYLE_KEY, NULL);
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
487 pidgin_message_style_unref (style);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
488 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
489
32079
7b92a2b852db Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents: 32078
diff changeset
490 static void
7b92a2b852db Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents: 32078
diff changeset
491 webkit_on_webview_destroy (GtkObject *object, gpointer data)
7b92a2b852db Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents: 32078
diff changeset
492 {
7b92a2b852db Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents: 32078
diff changeset
493 pidgin_message_style_unref ((PidginMessageStyle*) data);
7b92a2b852db Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents: 32078
diff changeset
494 g_object_set_data (G_OBJECT(object), MESSAGE_STYLE_KEY, NULL);
7b92a2b852db Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents: 32078
diff changeset
495 }
7b92a2b852db Cleanly handle webkit destroy events.
tdrhq@soc.pidgin.im
parents: 32078
diff changeset
496
32072
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
497 static gboolean webkit_on_displaying_im_msg (PurpleAccount *account,
32068
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
498 const char* name,
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
499 char **pmessage,
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
500 PurpleConversation *conv,
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
501 PurpleMessageFlags flags,
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
502 gpointer data)
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
503 {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
504 GtkWidget *webkit;
32068
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
505 char *message = *pmessage;
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
506 const char *alias = name; /* FIXME: signal doesn't give me alias */
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
507 char *stripped;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
508 char *message_html;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
509 char *msg;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
510 char *escape;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
511 char *script;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
512 char *func = "appendMessage";
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
513 char *smileyed;
32068
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
514 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: 32064
diff changeset
515
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
516 PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags"));
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
517 PidginMessageStyle *style;
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
518
32071
32d7d3c4163c * removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents: 32070
diff changeset
519 fprintf (stderr, "hmm.. here %s %s\n", name, message);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
520 webkit = get_webkit(conv);
32068
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
521 stripped = g_strdup(message);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
522
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
523 style = g_object_get_data (G_OBJECT (webkit), MESSAGE_STYLE_KEY);
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
524 g_assert (style);
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
525
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
526 if (flags & PURPLE_MESSAGE_SEND && old_flags & PURPLE_MESSAGE_SEND) {
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
527 message_html = style->outgoing_next_content_html;
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
528 func = "appendNextMessage";
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
529 } else if (flags & PURPLE_MESSAGE_SEND) {
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
530 message_html = style->outgoing_content_html;
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
531 } else if (flags & PURPLE_MESSAGE_RECV && old_flags & PURPLE_MESSAGE_RECV) {
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
532 message_html = style->incoming_next_content_html;
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
533 func = "appendNextMessage";
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
534 } else if (flags & PURPLE_MESSAGE_RECV) {
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
535 message_html = style->incoming_content_html;
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
536 } else {
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
537 message_html = style->status_html;
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
538 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
539 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
540
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
541 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
542 msg = replace_message_tokens(message_html, 0, conv, name, alias, smileyed, flags, mtime);
32071
32d7d3c4163c * removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents: 32070
diff changeset
543 escape = gtk_webview_quote_js_string (msg);
32d7d3c4163c * removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents: 32070
diff changeset
544 script = g_strdup_printf("%s(%s)", func, escape);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
545
32081
3bd8fb942ea4 Yep, tested, and changed some code from previous commit. This is a hard
tdrhq@soc.pidgin.im
parents: 32080
diff changeset
546 gtk_webview_safe_execute_script (GTK_WEBVIEW (webkit), script);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
547
32081
3bd8fb942ea4 Yep, tested, and changed some code from previous commit. This is a hard
tdrhq@soc.pidgin.im
parents: 32080
diff changeset
548 g_free(script);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
549 g_free(smileyed);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
550 g_free(msg);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
551 g_free(stripped);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
552 g_free(escape);
32068
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
553
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
554 return TRUE; /* GtkConv should not handle this IM */
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
555 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
556
32072
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
557 static gboolean webkit_on_displaying_chat_msg (PurpleAccount *account,
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
558 const char *who,
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
559 char **message,
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
560 PurpleConversation *conv,
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
561 PurpleMessageFlags flags,
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
562 gpointer userdata)
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
563 {
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
564 /* handle exactly like an IM message for now */
32072
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
565 return webkit_on_displaying_im_msg (account, who, message, conv, flags, NULL);
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
566 }
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
567
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
568 static void
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
569 webkit_on_conversation_displayed (PidginConversation *gtkconv, gpointer data)
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
570 {
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
571 init_theme_for_webkit (gtkconv->active_conv, cur_style_dir);
32070
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
572 }
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
573
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
574 static void
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
575 webkit_on_conversation_switched (PurpleConversation *conv, gpointer data)
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
576 {
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
577 init_theme_for_webkit (conv, cur_style_dir);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
578 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
579
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
580 static void
32071
32d7d3c4163c * removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents: 32070
diff changeset
581 webkit_on_conversation_hiding (PidginConversation *gtkconv, gpointer data)
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
582 {
32071
32d7d3c4163c * removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents: 32070
diff changeset
583 /*
32d7d3c4163c * removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents: 32070
diff changeset
584 * I'm not sure if I need to do anything here, but let's keep
32085
f989838b91ae removed the fixme.
tdrhq@soc.pidgin.im
parents: 32084
diff changeset
585 * this anyway.
32071
32d7d3c4163c * removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents: 32070
diff changeset
586 */
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
587 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
588
32084
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
589 static GList*
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
590 get_dir_dir_list (const char* dirname)
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
591 {
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
592 GList *ret = NULL;
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
593 GDir *dir = g_dir_open (dirname, 0, NULL);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
594 const char* subdir;
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
595
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
596 if (!dir) return NULL;
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
597 while ((subdir = g_dir_read_name (dir))) {
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
598 ret = g_list_append (ret, g_build_filename (dirname, subdir, NULL));
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
599 }
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
600
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
601 g_dir_close (dir);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
602 return ret;
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
603 }
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
604
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
605 /**
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
606 * Get me a list of all the available themes specified by their
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
607 * directories. I don't guarrantee that these are valid themes, just
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
608 * that they are in the directories for themes.
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
609 */
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
610 static GList*
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
611 get_theme_directory_list ()
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
612 {
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
613 char *user_dir, *user_style_dir, *global_style_dir;
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
614 GList *list1, *list2;
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
615
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
616 user_dir = g_strdup (purple_user_dir ());
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
617 if (!g_path_is_absolute (user_dir)) {
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
618 char* cur = g_get_current_dir ();
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
619 g_free (user_dir);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
620 user_dir = g_build_filename (cur, purple_user_dir(), NULL);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
621 g_free (cur);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
622 }
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
623
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
624 user_style_dir = g_build_filename (user_dir, "styles", NULL);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
625 global_style_dir = g_build_filename (DATADIR, "pidgin", "styles", NULL);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
626
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
627 list1 = get_dir_dir_list (user_style_dir);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
628 list2 = get_dir_dir_list (global_style_dir);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
629
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
630 g_free (global_style_dir);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
631 g_free (user_style_dir);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
632 g_free (user_dir);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
633
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
634 return g_list_concat (list1, list2);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
635 }
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
636
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
637
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
638 /**
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
639 * Get each of the files corresponding to each variant.
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
640 */
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
641 static GList*
32083
ef8d9e44cc73 get_theme_files --> get_variant_files.
tdrhq@soc.pidgin.im
parents: 32081
diff changeset
642 get_variant_files(PidginMessageStyle *style)
32064
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 GList *ret = NULL;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
645 GDir *variants;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
646 const char *css_file;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
647 char *css;
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
648 char *variant_dir;
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
649
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
650 g_assert (style->style_dir);
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
651 variant_dir = g_build_filename(style->style_dir, "Contents", "Resources", "Variants", NULL);
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
652
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
653 variants = g_dir_open(variant_dir, 0, NULL);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
654 if (!variants) return NULL;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
655
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
656 while ((css_file = g_dir_read_name(variants)) != NULL) {
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
657 if (!g_str_has_suffix (css_file, ".css"))
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
658 continue;
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
659
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
660 css = g_build_filename(variant_dir, css_file, NULL);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
661 ret = g_list_append(ret, css);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
662 }
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
663
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
664 g_dir_close(variants);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
665 g_free(variant_dir);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
666
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
667 ret = g_list_sort (ret, (GCompareFunc)g_strcmp0);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
668 return ret;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
669 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
670
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
671 static void
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
672 variant_set_default (PidginMessageStyle* style)
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
673 {
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
674 GList *all, *iter;
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
675 const char *css_path = purple_prefs_get_string ("/plugins/gtk/adiumthemes/csspath");
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
676
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
677 g_free (style->css_path);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
678 if (g_str_has_prefix (css_path, style->style_dir) &&
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
679 g_file_test (css_path, G_FILE_TEST_EXISTS)) {
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
680 style->css_path = g_strdup (css_path);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
681 return;
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
682 }
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
683 else {
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
684 /* something about the theme has changed */
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
685 css_path = NULL;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
686 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
687
32083
ef8d9e44cc73 get_theme_files --> get_variant_files.
tdrhq@soc.pidgin.im
parents: 32081
diff changeset
688 all = get_variant_files (style);
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
689
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
690 if (all) {
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
691 style->css_path = g_strdup (all->data);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
692 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
693 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
694
32074
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
695 for (iter = all; iter; iter = g_list_next (iter))
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
696 g_free (iter->data);
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
697
41cb5245b253 temporary commit.
tdrhq@soc.pidgin.im
parents: 32073
diff changeset
698 g_list_free (all);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
699 }
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 static gboolean
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
702 plugin_load(PurplePlugin *plugin)
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
703 {
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
704 PidginMessageStyle *_style; /* temp */
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
705
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
706 if (g_path_is_absolute (purple_user_dir()))
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
707 cur_style_dir = g_build_filename(purple_user_dir(), "style", NULL);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
708 else {
32084
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
709
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
710
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
711
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
712 char* cur = g_get_current_dir ();
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
713 cur_style_dir = g_build_filename (cur, purple_user_dir(), "style", NULL);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
714 g_free (cur);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
715 }
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
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
718 _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: 32075
diff changeset
719 if (!_style) {
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
720 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: 32075
diff changeset
721 cur_style_dir = NULL;
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
722 return FALSE;
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
723 }
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
724
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
725 pidgin_message_style_unref (_style);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
726
32068
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
727 purple_signal_connect (pidgin_conversations_get_handle (),
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
728 "displaying-im-msg",
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
729 webkit_plugin_get_handle (),
32072
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
730 PURPLE_CALLBACK(webkit_on_displaying_im_msg),
32068
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
731 NULL);
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
732
32070
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
733 purple_signal_connect (pidgin_conversations_get_handle (),
32072
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
734 "displaying-chat-msg",
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
735 webkit_plugin_get_handle (),
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
736 PURPLE_CALLBACK(webkit_on_displaying_chat_msg),
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
737 NULL);
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
738
9839a31f2667 Well, chat is sorta kinda working.
tdrhq@soc.pidgin.im
parents: 32071
diff changeset
739 purple_signal_connect (pidgin_conversations_get_handle (),
32070
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
740 "conversation-displayed",
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
741 webkit_plugin_get_handle (),
32078
7194ddfc8158 woo, fixed the bug. Now things are looking wonderfully stable.
tdrhq@soc.pidgin.im
parents: 32077
diff changeset
742 PURPLE_CALLBACK(webkit_on_conversation_displayed),
32070
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
743 NULL);
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
744
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
745 purple_signal_connect (pidgin_conversations_get_handle (),
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
746 "conversation-switched",
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
747 webkit_plugin_get_handle (),
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
748 PURPLE_CALLBACK(webkit_on_conversation_switched),
849e74b579e4 create conversation with signals.
tdrhq@soc.pidgin.im
parents: 32069
diff changeset
749 NULL);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
750
32071
32d7d3c4163c * removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents: 32070
diff changeset
751 purple_signal_connect (pidgin_conversations_get_handle (),
32d7d3c4163c * removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents: 32070
diff changeset
752 "conversation-hiding",
32d7d3c4163c * removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents: 32070
diff changeset
753 webkit_plugin_get_handle (),
32d7d3c4163c * removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents: 32070
diff changeset
754 PURPLE_CALLBACK(webkit_on_conversation_hiding),
32d7d3c4163c * removed delete_conversation uiops and instead used signals.
tdrhq@soc.pidgin.im
parents: 32070
diff changeset
755 NULL);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
756
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
757 /* finally update each of the existing conversation windows */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
758 {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
759 GList* list = purple_get_conversations ();
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
760 for (;list; list = g_list_next(list))
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
761 init_theme_for_webkit (list->data, cur_style_dir);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
762
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
763 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
764 return TRUE;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
765 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
766
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
767 static gboolean
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
768 plugin_unload(PurplePlugin *plugin)
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 GList *list;
32068
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
771
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
772 webkit_plugin_free_handle ();
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
773
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
774 list = purple_get_conversations ();
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
775 while (list) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
776 finalize_theme_for_webkit(list->data);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
777 list = g_list_next(list);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
778 }
32068
50a38bbca397 use displaying-im-msg instead of write_conv uiops.
tdrhq@soc.pidgin.im
parents: 32064
diff changeset
779
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
780 return TRUE;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
781 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
782
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 static void
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
785 variant_update_conversation (PurpleConversation *conv)
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
786 {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
787 PidginConversation *gtkconv = PIDGIN_CONVERSATION (conv);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
788 WebKitWebView *webview = WEBKIT_WEB_VIEW (gtkconv->webview);
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
789 PidginMessageStyle *style = (PidginMessageStyle*) g_object_get_data (G_OBJECT(webview), MESSAGE_STYLE_KEY);
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
790 char *script;
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
791
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
792 g_assert (style && style->css_path);
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
793
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
794 script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", style->css_path);
32081
3bd8fb942ea4 Yep, tested, and changed some code from previous commit. This is a hard
tdrhq@soc.pidgin.im
parents: 32080
diff changeset
795 gtk_webview_safe_execute_script (GTK_WEBVIEW(webview), script);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
796 g_free (script);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
797 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
798
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
799 static void
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
800 variant_changed (GtkWidget* combobox, gpointer null)
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
801 {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
802 char *name, *name_with_ext;
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
803 char *css_path;
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
804 GList *list;
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
805 PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
806
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
807 g_assert (style);
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
808
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
809 /* 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: 32075
diff changeset
810 * that first */
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
811
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
812 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
813 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
814 g_free (name);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
815
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
816 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: 32075
diff changeset
817
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
818 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: 32075
diff changeset
819 goto cleanup;
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
820 }
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
821
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
822 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: 32075
diff changeset
823 style->css_path = g_strdup (css_path);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
824 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
825
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
826 /* update each conversation */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
827 list = purple_get_conversations ();
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
828 while (list) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
829 variant_update_conversation (list->data);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
830 list = g_list_next(list);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
831 }
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
832
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
833 cleanup:
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
834 g_free (css_path);
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
835 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: 32075
diff changeset
836 pidgin_message_style_unref (style);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
837 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
838
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
839 static GtkWidget *
32084
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
840 get_variant_config_frame()
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
841 {
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
842 PidginMessageStyle *style = pidgin_message_style_load (cur_style_dir);
32083
ef8d9e44cc73 get_theme_files --> get_variant_files.
tdrhq@soc.pidgin.im
parents: 32081
diff changeset
843 GList *variants = get_variant_files(style);
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
844 GList *iter = variants;
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
845 char *curdir = NULL;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
846 GtkWidget *combobox = gtk_combo_box_new_text();
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
847 int def = -1, index = 0;
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
848 char* css_path = g_strdup (style->css_path);
32076
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
849
9ad4257f5e8f Ok, good part of this work of moving global variables to defined styles is
tdrhq@soc.pidgin.im
parents: 32075
diff changeset
850 pidgin_message_style_unref (style);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
851
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
852 for (; iter; iter = g_list_next (iter)) {
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
853 char *basename = g_path_get_basename(iter->data);
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
854 char *dirname = g_path_get_dirname(iter->data);
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
855 if (!curdir || !g_str_equal (curdir, dirname)) {
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
856 char *plist, *plist_xml;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
857 gsize plist_len;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
858 xmlnode *node;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
859 g_free(curdir);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
860 curdir = strdup(dirname);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
861 plist = g_build_filename(curdir, "..", "..", "Info.plist", NULL);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
862 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
863 continue;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
864 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
865 node = xmlnode_from_str(plist_xml, plist_len);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
866 if (!node) continue;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
867 node = xmlnode_get_child(node, "dict");
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
868 if (!node) continue;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
869 node = xmlnode_get_child(node, "key");
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
870 while (node && strcmp(xmlnode_get_data(node), "CFBundleName")) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
871 node = xmlnode_get_next_twin(node);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
872 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
873 if (!node) continue;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
874 node = node->next;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
875 while (node && node->type != XMLNODE_TYPE_TAG) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
876 node = node->next;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
877 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
878
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
879 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
880
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 char *temp = g_strndup (basename, strlen(basename)-4);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
883 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
884 g_free (temp);
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
885 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
886 if (g_str_has_suffix (css_path, basename))
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
887 def = index;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
888 index ++;
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
889
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
890 g_free (basename);
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
891 g_free (dirname);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
892 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
893
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
894 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
895 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
896
32077
3b1a130f7e88 more changes, but I still can't find the stupid bug. Valgrind gives me some information
tdrhq@soc.pidgin.im
parents: 32076
diff changeset
897 g_free (css_path);
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
898 return combobox;
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
899 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
900
32084
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
901 static GtkWidget*
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
902 get_config_frame(PurplePlugin* plugin)
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
903 {
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
904 GtkWidget *vbox = gtk_vbox_new (TRUE, 0);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
905
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
906 gtk_box_pack_end (GTK_BOX(vbox), get_variant_config_frame (), TRUE, TRUE, 0);
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
907 return vbox;
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
908 }
d60517f63f99 partial work towards theme selection.
tdrhq@soc.pidgin.im
parents: 32083
diff changeset
909
32064
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
910 PidginPluginUiInfo ui_info =
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
911 {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
912 get_config_frame,
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
913 0, /* page_num (Reserved) */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
914
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
915 /* padding */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
916 NULL,
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
917 NULL,
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
918 NULL,
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
919 NULL
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
920 };
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
921
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
922
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
923 static PurplePluginInfo info =
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
924 {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
925 PURPLE_PLUGIN_MAGIC, /* Magic */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
926 PURPLE_MAJOR_VERSION, /* Purple Major Version */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
927 PURPLE_MINOR_VERSION, /* Purple Minor Version */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
928 PURPLE_PLUGIN_STANDARD, /* plugin type */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
929 PIDGIN_PLUGIN_TYPE, /* ui requirement */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
930 0, /* flags */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
931 NULL, /* dependencies */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
932 PURPLE_PRIORITY_DEFAULT, /* priority */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
933
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
934 PLUGIN_ID, /* plugin id */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
935 NULL, /* name */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
936 "0.1", /* version */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
937 NULL, /* summary */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
938 NULL, /* description */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
939 PLUGIN_AUTHOR, /* author */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
940 "http://pidgin.im", /* website */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
941
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
942 plugin_load, /* load */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
943 plugin_unload, /* unload */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
944 NULL, /* destroy */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
945
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
946 &ui_info, /* ui_info */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
947 NULL, /* extra_info */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
948 NULL, /* prefs_info */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
949 NULL, /* actions */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
950 NULL, /* reserved 1 */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
951 NULL, /* reserved 2 */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
952 NULL, /* reserved 3 */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
953 NULL /* reserved 4 */
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
954 };
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
955
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
956 static void
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
957 init_plugin(PurplePlugin *plugin) {
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
958 info.name = "Adium IMs";
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
959 info.summary = "Adium-like IMs with Pidgin";
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
960 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
961
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
962 purple_prefs_add_none ("/plugins");
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
963 purple_prefs_add_none ("/plugins/gtk");
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
964 purple_prefs_add_none ("/plugins/gtk/adiumthemes");
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
965 purple_prefs_add_string ("/plugins/gtk/adiumthemes/csspath", "");
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
966 }
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
967
d0be198c4694 other files that missed my main major commit.
tdrhq@soc.pidgin.im
parents:
diff changeset
968 PURPLE_INIT_PLUGIN(webkit, init_plugin, info)