annotate pidgin/gtkconv-theme.c @ 32779:f124ad0022ce

Still making trunk usable again: correctly display plaintext logs
author tomkiewicz@cpw.pidgin.im
date Sun, 20 May 2012 19:08:37 +0000
parents 7cd13ca747fc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32158
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1 /*
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
2 * Conversation Themes for Pidgin
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
3 *
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
4 * Pidgin is the legal property of its developers, whose names are too numerous
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
6 * source distribution.
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
7 *
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
12 *
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
17 *
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
21 */
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
22
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
23 #include "gtkconv-theme.h"
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
24
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
25 #include "conversation.h"
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
26 #include "debug.h"
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
27 #include "prefs.h"
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
28 #include "xmlnode.h"
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
29
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
30 #include "pidgin.h"
32422
d729bc34a180 internal.h is needed to compile on win32
Daniel Atallah <daniel.atallah@gmail.com>
parents: 32362
diff changeset
31 #include "internal.h"
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
32 #include "gtkconv.h"
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
33 #include "gtkwebview.h"
32158
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
34
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
35 #include <stdlib.h>
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
36 #include <string.h>
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
37
32158
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
38 #define PIDGIN_CONV_THEME_GET_PRIVATE(Gobject) \
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
39 (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_CONV_THEME, PidginConvThemePrivate))
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
40
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
41 /******************************************************************************
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
42 * Structs
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
43 *****************************************************************************/
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
44
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
45 typedef struct {
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
46 /* current config options */
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
47 char *variant; /* allowed to be NULL if there are no variants */
32184
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
48 GList *variants;
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
49
32169
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
50 /* Info.plist keys/values */
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
51 GHashTable *info;
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
52
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
53 /* caches */
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
54 char *template_html;
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
55 char *header_html;
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
56 char *footer_html;
32193
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
57 char *topic_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
58 char *status_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
59 char *content_html;
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
60 char *incoming_content_html;
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
61 char *outgoing_content_html;
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
62 char *incoming_next_content_html;
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
63 char *outgoing_next_content_html;
32193
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
64 char *incoming_context_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
65 char *outgoing_context_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
66 char *incoming_next_context_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
67 char *outgoing_next_context_html;
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
68 char *basestyle_css;
32158
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
69 } PidginConvThemePrivate;
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
70
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
71 /******************************************************************************
32169
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
72 * Enums
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
73 *****************************************************************************/
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
74
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
75 enum {
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
76 PROP_ZERO = 0,
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
77 PROP_INFO,
32220
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
78 PROP_VARIANT,
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
79 PROP_LAST
32169
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
80 };
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
81
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
82 /******************************************************************************
32220
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
83 * Globals
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
84 *****************************************************************************/
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
85
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
86 static GObjectClass *parent_class = NULL;
32266
f28a09bfe22c Fix compile with glib<2.26.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32265
diff changeset
87 #if GLIB_CHECK_VERSION(2,26,0)
32220
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
88 static GParamSpec *properties[PROP_LAST];
32266
f28a09bfe22c Fix compile with glib<2.26.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32265
diff changeset
89 #endif
32220
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
90
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
91 /******************************************************************************
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
92 * Helper Functions
32158
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
93 *****************************************************************************/
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
94
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
95 static const GValue *
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
96 get_key(PidginConvThemePrivate *priv, const char *key, gboolean specific)
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
97 {
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
98 GValue *val = NULL;
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
99
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
100 /* Try variant-specific key */
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
101 if (specific && priv->variant) {
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
102 char *name = g_strdup_printf("%s:%s", key, priv->variant);
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
103 val = g_hash_table_lookup(priv->info, name);
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
104 g_free(name);
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
105 }
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
106
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
107 /* Try generic key */
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
108 if (!val) {
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
109 val = g_hash_table_lookup(priv->info, key);
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
110 }
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
111
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
112 return val;
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
113 }
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
114
32359
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
115 /* The template path can either come from the theme, or can
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
116 * be stock Template.html that comes with Pidgin */
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
117 static char *
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
118 get_template_path(const char *dir)
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
119 {
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
120 char *file;
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
121
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
122 file = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL);
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
123
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
124 if (!g_file_test(file, G_FILE_TEST_EXISTS)) {
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
125 g_free(file);
32733
7cd13ca747fc Add a simple theme that replicates our current look.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32422
diff changeset
126 file = g_build_filename(DATADIR, "pidgin", "theme", "Template.html", NULL);
32359
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
127 }
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
128
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
129 return file;
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
130 }
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
131
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
132 static const char *
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
133 get_template_html(PidginConvThemePrivate *priv, const char *dir)
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
134 {
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
135 char *file;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
136
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
137 if (priv->template_html)
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
138 return priv->template_html;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
139
32359
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
140 file = get_template_path(dir);
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
141
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
142 if (!g_file_get_contents(file, &priv->template_html, NULL, NULL)) {
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
143 purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", file);
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
144 priv->template_html = g_strdup("");
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
145 }
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
146 g_free(file);
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
147
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
148 return priv->template_html;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
149 }
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
150
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
151 static const char *
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
152 get_basestyle_css(PidginConvThemePrivate *priv, const char *dir)
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
153 {
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
154 char *file;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
155
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
156 if (priv->basestyle_css)
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
157 return priv->basestyle_css;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
158
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
159 file = g_build_filename(dir, "Contents", "Resources", "main.css", NULL);
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
160 if (!g_file_get_contents(file, &priv->basestyle_css, NULL, NULL))
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
161 priv->basestyle_css = g_strdup("");
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
162 g_free(file);
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
163
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
164 return priv->basestyle_css;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
165 }
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
166
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
167 static const char *
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
168 get_header_html(PidginConvThemePrivate *priv, const char *dir)
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
169 {
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
170 char *file;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
171
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
172 if (priv->header_html)
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
173 return priv->header_html;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
174
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
175 file = g_build_filename(dir, "Contents", "Resources", "Header.html", NULL);
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
176 if (!g_file_get_contents(file, &priv->header_html, NULL, NULL))
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
177 priv->header_html = g_strdup("");
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
178 g_free(file);
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
179
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
180 return priv->header_html;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
181 }
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
182
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
183 static const char *
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
184 get_footer_html(PidginConvThemePrivate *priv, const char *dir)
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
185 {
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
186 char *file;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
187
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
188 if (priv->footer_html)
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
189 return priv->footer_html;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
190
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
191 file = g_build_filename(dir, "Contents", "Resources", "Footer.html", NULL);
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
192 if (!g_file_get_contents(file, &priv->footer_html, NULL, NULL))
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
193 priv->footer_html = g_strdup("");
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
194 g_free(file);
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
195
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
196 return priv->footer_html;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
197 }
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
198
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
199 static const char *
32193
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
200 get_topic_html(PidginConvThemePrivate *priv, const char *dir)
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
201 {
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
202 char *file;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
203
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
204 if (priv->topic_html)
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
205 return priv->topic_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
206
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
207 file = g_build_filename(dir, "Contents", "Resources", "Topic.html", NULL);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
208 if (!g_file_get_contents(file, &priv->topic_html, NULL, NULL)) {
32206
7b6ab83622db Add some missing newlines in debug output.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32198
diff changeset
209 purple_debug_info("webkit", "%s could not find Resources/Topic.html\n", dir);
32193
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
210 priv->topic_html = g_strdup("");
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
211 }
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
212 g_free(file);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
213
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
214 return priv->topic_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
215 }
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
216
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
217 static const char *
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
218 get_content_html(PidginConvThemePrivate *priv, const char *dir)
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
219 {
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
220 char *file;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
221
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
222 if (priv->content_html)
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
223 return priv->content_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
224
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
225 file = g_build_filename(dir, "Contents", "Resources", "Content.html", NULL);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
226 if (!g_file_get_contents(file, &priv->content_html, NULL, NULL)) {
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
227 purple_debug_info("webkit", "%s did not have a Content.html\n", dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
228 priv->content_html = g_strdup("");
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
229 }
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
230 g_free(file);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
231
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
232 return priv->content_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
233 }
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
234
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
235 static const char *
32209
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
236 get_status_html(PidginConvThemePrivate *priv, const char *dir)
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
237 {
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
238 char *file;
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
239
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
240 if (priv->status_html)
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
241 return priv->status_html;
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
242
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
243 file = g_build_filename(dir, "Contents", "Resources", "Status.html", NULL);
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
244 if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) {
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
245 purple_debug_info("webkit", "%s could not find Resources/Status.html\n", dir);
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
246 priv->status_html = g_strdup(get_content_html(priv, dir));
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
247 }
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
248 g_free(file);
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
249
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
250 return priv->status_html;
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
251 }
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
252
e51f656d74e5 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32206
diff changeset
253 static const char *
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
254 get_incoming_content_html(PidginConvThemePrivate *priv, const char *dir)
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
255 {
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
256 char *file;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
257
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
258 if (priv->incoming_content_html)
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
259 return priv->incoming_content_html;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
260
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
261 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Content.html", NULL);
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
262 if (!g_file_get_contents(file, &priv->incoming_content_html, NULL, NULL)) {
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
263 purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", dir);
32193
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
264 priv->incoming_content_html = g_strdup(get_content_html(priv, dir));
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
265 }
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
266 g_free(file);
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
267
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
268 return priv->incoming_content_html;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
269 }
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
270
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
271 static const char *
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
272 get_incoming_next_content_html(PidginConvThemePrivate *priv, const char *dir)
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
273 {
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
274 char *file;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
275
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
276 if (priv->incoming_next_content_html)
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
277 return priv->incoming_next_content_html;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
278
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
279 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContent.html", NULL);
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
280 if (!g_file_get_contents(file, &priv->incoming_next_content_html, NULL, NULL)) {
32193
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
281 priv->incoming_next_content_html = g_strdup(get_incoming_content_html(priv, dir));
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
282 }
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
283 g_free(file);
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
284
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
285 return priv->incoming_next_content_html;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
286 }
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
287
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
288 static const char *
32193
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
289 get_incoming_context_html(PidginConvThemePrivate *priv, const char *dir)
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
290 {
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
291 char *file;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
292
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
293 if (priv->incoming_context_html)
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
294 return priv->incoming_context_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
295
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
296 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Context.html", NULL);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
297 if (!g_file_get_contents(file, &priv->incoming_context_html, NULL, NULL)) {
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
298 purple_debug_info("webkit", "%s did not have a Incoming/Context.html\n", dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
299 priv->incoming_context_html = g_strdup(get_incoming_content_html(priv, dir));
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
300 }
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
301 g_free(file);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
302
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
303 return priv->incoming_context_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
304 }
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
305
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
306 static const char *
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
307 get_incoming_next_context_html(PidginConvThemePrivate *priv, const char *dir)
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
308 {
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
309 char *file;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
310
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
311 if (priv->incoming_next_context_html)
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
312 return priv->incoming_next_context_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
313
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
314 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContext.html", NULL);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
315 if (!g_file_get_contents(file, &priv->incoming_next_context_html, NULL, NULL)) {
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
316 priv->incoming_next_context_html = g_strdup(get_incoming_context_html(priv, dir));
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
317 }
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
318 g_free(file);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
319
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
320 return priv->incoming_next_context_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
321 }
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
322
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
323 static const char *
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
324 get_outgoing_content_html(PidginConvThemePrivate *priv, const char *dir)
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
325 {
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
326 char *file;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
327
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
328 if (priv->outgoing_content_html)
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
329 return priv->outgoing_content_html;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
330
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
331 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Content.html", NULL);
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
332 if (!g_file_get_contents(file, &priv->outgoing_content_html, NULL, NULL)) {
32193
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
333 priv->outgoing_content_html = g_strdup(get_incoming_content_html(priv, dir));
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
334 }
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
335 g_free(file);
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
336
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
337 return priv->outgoing_content_html;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
338 }
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
339
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
340 static const char *
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
341 get_outgoing_next_content_html(PidginConvThemePrivate *priv, const char *dir)
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
342 {
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
343 char *file;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
344
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
345 if (priv->outgoing_next_content_html)
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
346 return priv->outgoing_next_content_html;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
347
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
348 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL);
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
349 if (!g_file_get_contents(file, &priv->outgoing_next_content_html, NULL, NULL)) {
32193
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
350 priv->outgoing_next_content_html = g_strdup(get_outgoing_content_html(priv, dir));
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
351 }
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
352
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
353 return priv->outgoing_next_content_html;
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
354 }
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
355
32193
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
356 static const char *
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
357 get_outgoing_context_html(PidginConvThemePrivate *priv, const char *dir)
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
358 {
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
359 char *file;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
360
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
361 if (priv->outgoing_context_html)
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
362 return priv->outgoing_context_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
363
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
364 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Context.html", NULL);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
365 if (!g_file_get_contents(file, &priv->outgoing_context_html, NULL, NULL)) {
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
366 priv->outgoing_context_html = g_strdup(get_incoming_context_html(priv, dir));
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
367 }
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
368 g_free(file);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
369
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
370 return priv->outgoing_context_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
371 }
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
372
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
373 static const char *
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
374 get_outgoing_next_context_html(PidginConvThemePrivate *priv, const char *dir)
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
375 {
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
376 char *file;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
377
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
378 if (priv->outgoing_next_context_html)
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
379 return priv->outgoing_next_context_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
380
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
381 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContext.html", NULL);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
382 if (!g_file_get_contents(file, &priv->outgoing_next_context_html, NULL, NULL)) {
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
383 priv->outgoing_next_context_html = g_strdup(get_outgoing_context_html(priv, dir));
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
384 }
32362
910475e626be Fix a small leak.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32359
diff changeset
385 g_free(file);
32193
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
386
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
387 return priv->outgoing_next_context_html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
388 }
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
389
32220
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
390 static void
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
391 _set_variant(PidginConvTheme *theme, const char *variant)
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
392 {
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
393 PidginConvThemePrivate *priv;
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
394 const GValue *val;
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
395 char *prefname;
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
396
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
397 g_return_if_fail(theme != NULL);
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
398 g_return_if_fail(variant != NULL);
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
399
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
400 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme);
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
401
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
402 g_free(priv->variant);
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
403 priv->variant = g_strdup(variant);
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
404
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
405 val = get_key(priv, "CFBundleIdentifier", FALSE);
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
406 prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s/variant",
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
407 g_value_get_string(val));
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
408 purple_prefs_set_string(prefname, variant);
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
409 g_free(prefname);
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
410 }
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
411
32221
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
412 /******************************************************************************
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
413 * GObject Stuff
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
414 *****************************************************************************/
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
415
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
416 static void
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
417 pidgin_conv_theme_get_property(GObject *obj, guint param_id, GValue *value,
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
418 GParamSpec *psec)
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
419 {
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
420 PidginConvTheme *theme = PIDGIN_CONV_THEME(obj);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
421
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
422 switch (param_id) {
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
423 case PROP_INFO:
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
424 g_value_set_boxed(value, (gpointer)pidgin_conversation_theme_get_info(theme));
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
425 break;
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
426
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
427 case PROP_VARIANT:
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
428 g_value_set_string(value, pidgin_conversation_theme_get_variant(theme));
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
429 break;
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
430
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
431 default:
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
432 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
433 break;
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
434 }
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
435 }
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
436
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
437 static void
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
438 pidgin_conv_theme_set_property(GObject *obj, guint param_id, const GValue *value,
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
439 GParamSpec *psec)
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
440 {
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
441 PidginConvTheme *theme = PIDGIN_CONV_THEME(obj);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
442
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
443 switch (param_id) {
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
444 case PROP_INFO:
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
445 pidgin_conversation_theme_set_info(theme, g_value_get_boxed(value));
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
446 break;
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
447
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
448 case PROP_VARIANT:
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
449 _set_variant(theme, g_value_get_string(value));
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
450 break;
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
451
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
452 default:
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
453 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
454 break;
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
455 }
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
456 }
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
457
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
458 static void
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
459 pidgin_conv_theme_init(GTypeInstance *instance,
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
460 gpointer klass)
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
461 {
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
462 PidginConvThemePrivate *priv;
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
463
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
464 priv = PIDGIN_CONV_THEME_GET_PRIVATE(instance);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
465 }
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
466
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
467 static void
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
468 pidgin_conv_theme_finalize(GObject *obj)
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
469 {
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
470 PidginConvThemePrivate *priv;
32222
a7f0fdce9a0e Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32221
diff changeset
471 GList *list;
32221
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
472
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
473 priv = PIDGIN_CONV_THEME_GET_PRIVATE(obj);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
474
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
475 g_free(priv->template_html);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
476 g_free(priv->header_html);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
477 g_free(priv->footer_html);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
478 g_free(priv->topic_html);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
479 g_free(priv->status_html);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
480 g_free(priv->content_html);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
481 g_free(priv->incoming_content_html);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
482 g_free(priv->outgoing_content_html);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
483 g_free(priv->incoming_next_content_html);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
484 g_free(priv->outgoing_next_content_html);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
485 g_free(priv->incoming_context_html);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
486 g_free(priv->outgoing_context_html);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
487 g_free(priv->incoming_next_context_html);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
488 g_free(priv->outgoing_next_context_html);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
489 g_free(priv->basestyle_css);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
490
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
491 if (priv->info)
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
492 g_hash_table_destroy(priv->info);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
493
32222
a7f0fdce9a0e Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32221
diff changeset
494 list = priv->variants;
a7f0fdce9a0e Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32221
diff changeset
495 while (list) {
a7f0fdce9a0e Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32221
diff changeset
496 g_free(list->data);
a7f0fdce9a0e Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32221
diff changeset
497 list = g_list_delete_link(list, list);
a7f0fdce9a0e Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32221
diff changeset
498 }
a7f0fdce9a0e Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32221
diff changeset
499 g_free(priv->variant);
a7f0fdce9a0e Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32221
diff changeset
500
32221
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
501 parent_class->finalize(obj);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
502 }
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
503
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
504 static void
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
505 pidgin_conv_theme_class_init(PidginConvThemeClass *klass)
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
506 {
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
507 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
508 GParamSpec *pspec;
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
509
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
510 parent_class = g_type_class_peek_parent(klass);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
511
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
512 g_type_class_add_private(klass, sizeof(PidginConvThemePrivate));
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
513
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
514 obj_class->get_property = pidgin_conv_theme_get_property;
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
515 obj_class->set_property = pidgin_conv_theme_set_property;
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
516 obj_class->finalize = pidgin_conv_theme_finalize;
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
517
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
518 /* INFO */
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
519 pspec = g_param_spec_boxed("info", "Info",
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
520 "The information about this theme",
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
521 G_TYPE_HASH_TABLE,
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
522 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
523 g_object_class_install_property(obj_class, PROP_INFO, pspec);
32266
f28a09bfe22c Fix compile with glib<2.26.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32265
diff changeset
524 #if GLIB_CHECK_VERSION(2,26,0)
32221
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
525 properties[PROP_INFO] = pspec;
32266
f28a09bfe22c Fix compile with glib<2.26.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32265
diff changeset
526 #endif
32221
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
527
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
528 /* VARIANT */
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
529 pspec = g_param_spec_string("variant", "Variant",
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
530 "The current variant for this theme",
32265
7ccd24d49904 The variant property is not construct-only.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32223
diff changeset
531 NULL, G_PARAM_READWRITE);
32221
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
532 g_object_class_install_property(obj_class, PROP_VARIANT, pspec);
32266
f28a09bfe22c Fix compile with glib<2.26.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32265
diff changeset
533 #if GLIB_CHECK_VERSION(2,26,0)
32221
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
534 properties[PROP_VARIANT] = pspec;
32266
f28a09bfe22c Fix compile with glib<2.26.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32265
diff changeset
535 #endif
32221
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
536 }
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
537
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
538 GType
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
539 pidgin_conversation_theme_get_type(void)
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
540 {
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
541 static GType type = 0;
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
542 if (type == 0) {
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
543 static const GTypeInfo info = {
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
544 sizeof(PidginConvThemeClass),
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
545 NULL, /* base_init */
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
546 NULL, /* base_finalize */
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
547 (GClassInitFunc)pidgin_conv_theme_class_init, /* class_init */
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
548 NULL, /* class_finalize */
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
549 NULL, /* class_data */
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
550 sizeof(PidginConvTheme),
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
551 0, /* n_preallocs */
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
552 pidgin_conv_theme_init, /* instance_init */
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
553 NULL, /* value table */
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
554 };
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
555 type = g_type_register_static(PURPLE_TYPE_THEME,
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
556 "PidginConvTheme", &info, 0);
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
557 }
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
558 return type;
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
559 }
5cf6c4a8dcab Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32220
diff changeset
560
32168
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
561 /*****************************************************************************
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
562 * Public API functions
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
563 *****************************************************************************/
dc835fb3dcd3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32162
diff changeset
564
32169
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
565 const GHashTable *
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
566 pidgin_conversation_theme_get_info(const PidginConvTheme *theme)
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
567 {
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
568 PidginConvThemePrivate *priv;
32198
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
569
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
570 g_return_val_if_fail(theme != NULL, NULL);
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
571
32169
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
572 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
573 return priv->info;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
574 }
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
575
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
576 void
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
577 pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info)
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
578 {
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
579 PidginConvThemePrivate *priv;
32198
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
580
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
581 g_return_if_fail(theme != NULL);
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
582
32169
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
583 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
584
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
585 if (priv->info)
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
586 g_hash_table_destroy(priv->info);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
587
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
588 priv->info = info;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
589 }
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32168
diff changeset
590
32195
79d48418ba0b Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32193
diff changeset
591 const GValue *
79d48418ba0b Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32193
diff changeset
592 pidgin_conversation_theme_lookup(PidginConvTheme *theme, const char *key, gboolean specific)
79d48418ba0b Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32193
diff changeset
593 {
79d48418ba0b Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32193
diff changeset
594 PidginConvThemePrivate *priv;
32198
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
595
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
596 g_return_val_if_fail(theme != NULL, NULL);
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
597
32195
79d48418ba0b Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32193
diff changeset
598 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme);
79d48418ba0b Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32193
diff changeset
599
79d48418ba0b Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32193
diff changeset
600 return get_key(priv, key, specific);
79d48418ba0b Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32193
diff changeset
601 }
79d48418ba0b Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32193
diff changeset
602
32193
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
603 const char *
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
604 pidgin_conversation_theme_get_template(PidginConvTheme *theme, PidginConvThemeTemplateType type)
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
605 {
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
606 PidginConvThemePrivate *priv;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
607 const char *dir;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
608 const char *html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
609
32198
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
610 g_return_val_if_fail(theme != NULL, NULL);
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
611
32193
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
612 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
613 dir = purple_theme_get_dir(PURPLE_THEME(theme));
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
614
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
615 switch (type) {
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
616 case PIDGIN_CONVERSATION_THEME_TEMPLATE_MAIN:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
617 html = get_template_html(priv, dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
618 break;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
619 case PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
620 html = get_header_html(priv, dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
621 break;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
622 case PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
623 html = get_footer_html(priv, dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
624 break;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
625 case PIDGIN_CONVERSATION_THEME_TEMPLATE_TOPIC:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
626 html = get_topic_html(priv, dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
627 break;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
628 case PIDGIN_CONVERSATION_THEME_TEMPLATE_STATUS:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
629 html = get_status_html(priv, dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
630 break;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
631 case PIDGIN_CONVERSATION_THEME_TEMPLATE_CONTENT:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
632 html = get_content_html(priv, dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
633 break;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
634 case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
635 html = get_incoming_content_html(priv, dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
636 break;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
637 case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
638 html = get_incoming_next_content_html(priv, dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
639 break;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
640 case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTEXT:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
641 html = get_incoming_context_html(priv, dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
642 break;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
643 case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTEXT:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
644 html = get_incoming_next_context_html(priv, dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
645 break;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
646 case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
647 html = get_outgoing_content_html(priv, dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
648 break;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
649 case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTENT:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
650 html = get_outgoing_next_content_html(priv, dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
651 break;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
652 case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTEXT:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
653 html = get_outgoing_context_html(priv, dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
654 break;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
655 case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTEXT:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
656 html = get_outgoing_next_context_html(priv, dir);
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
657 break;
32196
ceae9fb7ae0b Add template lookup for 'basestyle' CSS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32195
diff changeset
658 case PIDGIN_CONVERSATION_THEME_TEMPLATE_BASESTYLE_CSS:
ceae9fb7ae0b Add template lookup for 'basestyle' CSS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32195
diff changeset
659 html = get_basestyle_css(priv, dir);
ceae9fb7ae0b Add template lookup for 'basestyle' CSS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32195
diff changeset
660 break;
32193
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
661 default:
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
662 purple_debug_error("gtkconv-theme",
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
663 "Requested invalid template type (%d) for theme %s.\n",
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
664 type, purple_theme_get_name(PURPLE_THEME(theme)));
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
665 html = NULL;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
666 }
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
667
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
668 return html;
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
669 }
3294e08d7466 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32188
diff changeset
670
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
671 void
32186
3e27c95ab8e6 Fix a leak. pidgin_conversation_theme_add_variant should only be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32185
diff changeset
672 pidgin_conversation_theme_add_variant(PidginConvTheme *theme, char *variant)
32184
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
673 {
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
674 PidginConvThemePrivate *priv;
32198
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
675
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
676 g_return_if_fail(theme != NULL);
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
677 g_return_if_fail(variant != NULL);
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
678
32184
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
679 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme);
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
680
32186
3e27c95ab8e6 Fix a leak. pidgin_conversation_theme_add_variant should only be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32185
diff changeset
681 priv->variants = g_list_prepend(priv->variants, variant);
32184
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
682 }
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
683
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
684 const char *
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
685 pidgin_conversation_theme_get_variant(PidginConvTheme *theme)
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
686 {
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
687 PidginConvThemePrivate *priv;
32198
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
688
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
689 g_return_val_if_fail(theme != NULL, NULL);
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
690
32184
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
691 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme);
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
692
32223
459ffa11348e Fix a leak. This strdup shouldn't be here.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32222
diff changeset
693 return priv->variant;
32184
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
694 }
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
695
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
696 void
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
697 pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant)
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
698 {
32220
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
699 _set_variant(theme, variant);
32266
f28a09bfe22c Fix compile with glib<2.26.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32265
diff changeset
700 #if GLIB_CHECK_VERSION(2,26,0)
32220
be14cf8a4c91 Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32209
diff changeset
701 g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_VARIANT]);
32266
f28a09bfe22c Fix compile with glib<2.26.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32265
diff changeset
702 #else
f28a09bfe22c Fix compile with glib<2.26.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32265
diff changeset
703 g_object_notify(G_OBJECT(theme), "variant");
f28a09bfe22c Fix compile with glib<2.26.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32265
diff changeset
704 #endif
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
705 }
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
706
32184
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
707 const GList *
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
708 pidgin_conversation_theme_get_variants(PidginConvTheme *theme)
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
709 {
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
710 PidginConvThemePrivate *priv;
32198
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
711
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
712 g_return_val_if_fail(theme != NULL, NULL);
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
713
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
714 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme);
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
715
32184
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32183
diff changeset
716 return priv->variants;
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
717 }
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
718
32197
90264301600f Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32196
diff changeset
719 char *
90264301600f Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32196
diff changeset
720 pidgin_conversation_theme_get_template_path(PidginConvTheme *theme)
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
721 {
32197
90264301600f Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32196
diff changeset
722 const char *dir;
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
723
32198
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
724 g_return_val_if_fail(theme != NULL, NULL);
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
725
32197
90264301600f Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32196
diff changeset
726 dir = purple_theme_get_dir(PURPLE_THEME(theme));
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
727
32359
5111d364fa49 Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32266
diff changeset
728 return get_template_path(dir);
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
729 }
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
730
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
731 char *
32197
90264301600f Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32196
diff changeset
732 pidgin_conversation_theme_get_css_path(PidginConvTheme *theme)
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
733 {
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
734 PidginConvThemePrivate *priv;
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
735 const char *dir;
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
736
32198
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
737 g_return_val_if_fail(theme != NULL, NULL);
3af16402f176 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32197
diff changeset
738
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
739 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme);
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
740
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
741 dir = purple_theme_get_dir(PURPLE_THEME(theme));
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
742 if (!priv->variant) {
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
743 return g_build_filename(dir, "Contents", "Resources", "main.css", NULL);
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
744 } else {
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
745 char *file = g_strdup_printf("%s.css", priv->variant);
32180
7219f52cdfa3 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32172
diff changeset
746 char *ret = g_build_filename(dir, "Contents", "Resources", "Variants", file, NULL);
32162
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
747 g_free(file);
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
748 return ret;
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
749 }
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
750 }
2e8c905a5e74 Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32161
diff changeset
751