pidgin/gtkconv-theme.c

Fri, 29 Mar 2019 20:05:41 -0400

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Fri, 29 Mar 2019 20:05:41 -0400
changeset 39523
415b0705e48b
parent 39461
a4ae05d3be93
child 39548
dfd989c8236e
permissions
-rw-r--r--

sametime: Move MIME handling to a separate file.

32536
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1 /*
91b09760ab0c 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
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
3 *
91b09760ab0c 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
91b09760ab0c 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
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
6 * source distribution.
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
7 *
91b09760ab0c 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
91b09760ab0c 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
91b09760ab0c 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
91b09760ab0c 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.
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
12 *
91b09760ab0c 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,
91b09760ab0c 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
91b09760ab0c 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
91b09760ab0c 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.
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
17 *
91b09760ab0c 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
91b09760ab0c 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
91b09760ab0c 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
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
21 */
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
22
33898
0f4b2e3ac978 win32: fix all warnings about improper winsock2.h include point
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33892
diff changeset
23 #include "internal.h"
35074
0d56a4091806 Use glibcompat.h for "notify" in gtkconv-theme.c
Ankit Vani <a@nevitus.org>
parents: 35064
diff changeset
24 #include "glibcompat.h"
33898
0f4b2e3ac978 win32: fix all warnings about improper winsock2.h include point
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33892
diff changeset
25
32536
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
26 #include "gtkconv-theme.h"
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
27
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
28 #include "conversation.h"
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
29 #include "debug.h"
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
30 #include "prefs.h"
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
31 #include "xmlnode.h"
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
32
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
33 #include "pidgin.h"
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
34 #include "gtkconv.h"
32536
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
35
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
36 #include <stdlib.h>
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
37 #include <string.h>
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
38
32536
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
39 /******************************************************************************
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
40 * Structs
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
41 *****************************************************************************/
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
42
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
43 typedef struct {
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
44 /* current config options */
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
45 char *variant; /* allowed to be NULL if there are no variants */
32562
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
46 GList *variants;
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
47
32545
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
48 /* Info.plist keys/values */
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
49 GHashTable *info;
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
50
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
51 /* caches */
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
52 char *template_html;
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
53 char *header_html;
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
54 char *footer_html;
32571
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
55 char *topic_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
56 char *status_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
57 char *content_html;
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
58 char *incoming_content_html;
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
59 char *outgoing_content_html;
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
60 char *incoming_next_content_html;
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
61 char *outgoing_next_content_html;
32571
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
62 char *incoming_context_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
63 char *outgoing_context_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
64 char *incoming_next_context_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
65 char *outgoing_next_context_html;
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
66 char *basestyle_css;
33384
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
67
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
68 GArray *nick_colors;
32536
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
69 } PidginConvThemePrivate;
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
70
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
71 /******************************************************************************
32545
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
72 * Enums
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
73 *****************************************************************************/
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
74
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
75 enum {
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
76 PROP_ZERO = 0,
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
77 PROP_INFO,
32598
e824d9bbe6ff Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32587
diff changeset
78 PROP_VARIANT,
e824d9bbe6ff Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32587
diff changeset
79 PROP_LAST
32545
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
80 };
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
81
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
82 /******************************************************************************
32598
e824d9bbe6ff Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32587
diff changeset
83 * Globals
e824d9bbe6ff Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32587
diff changeset
84 *****************************************************************************/
e824d9bbe6ff Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32587
diff changeset
85
e824d9bbe6ff Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32587
diff changeset
86 static GParamSpec *properties[PROP_LAST];
e824d9bbe6ff Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32587
diff changeset
87
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
88 G_DEFINE_TYPE_WITH_PRIVATE(PidginConvTheme, pidgin_conversation_theme,
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
89 PURPLE_TYPE_THEME);
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
90
32598
e824d9bbe6ff Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32587
diff changeset
91 /******************************************************************************
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
92 * Helper Functions
32536
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
93 *****************************************************************************/
91b09760ab0c Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
94
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
95 static const GValue *
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
96 get_key(PidginConvThemePrivate *priv, const char *key, gboolean specific)
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
97 {
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
98 GValue *val = NULL;
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
99
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
100 /* Try variant-specific key */
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
101 if (specific && priv->variant) {
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
102 char *name = g_strdup_printf("%s:%s", key, priv->variant);
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
103 val = g_hash_table_lookup(priv->info, name);
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
104 g_free(name);
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
105 }
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
106
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
107 /* Try generic key */
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
108 if (!val) {
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
109 val = g_hash_table_lookup(priv->info, key);
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
110 }
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
111
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
112 return val;
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
113 }
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
114
32725
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
115 /* The template path can either come from the theme, or can
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
116 * be stock Template.html that comes with Pidgin */
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
117 static char *
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
118 get_template_path(const char *dir)
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
119 {
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
120 char *file;
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
121
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
122 file = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL);
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
123
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
124 if (!g_file_test(file, G_FILE_TEST_EXISTS)) {
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
125 g_free(file);
35850
1abeda205d6c cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35082
diff changeset
126 file = g_build_filename(PURPLE_DATADIR,
1abeda205d6c cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35082
diff changeset
127 "pidgin", "theme", "Template.html", NULL);
32725
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
128 }
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
129
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
130 return file;
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
131 }
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
132
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
133 static const char *
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
134 get_template_html(PidginConvThemePrivate *priv, const char *dir)
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
135 {
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
136 char *file;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
137
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
138 if (priv->template_html)
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
139 return priv->template_html;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
140
32725
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
141 file = get_template_path(dir);
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
142
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
143 if (!g_file_get_contents(file, &priv->template_html, NULL, NULL)) {
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
144 purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", file);
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
145 priv->template_html = g_strdup("");
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
146 }
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
147 g_free(file);
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
148
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
149 return priv->template_html;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
150 }
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
151
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
152 static const char *
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
153 get_basestyle_css(PidginConvThemePrivate *priv, const char *dir)
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
154 {
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
155 char *file;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
156
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
157 if (priv->basestyle_css)
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
158 return priv->basestyle_css;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
159
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
160 file = g_build_filename(dir, "Contents", "Resources", "main.css", NULL);
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
161 if (!g_file_get_contents(file, &priv->basestyle_css, NULL, NULL))
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
162 priv->basestyle_css = g_strdup("");
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
163 g_free(file);
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
164
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
165 return priv->basestyle_css;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
166 }
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
167
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
168 static const char *
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
169 get_header_html(PidginConvThemePrivate *priv, const char *dir)
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
170 {
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
171 char *file;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
172
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
173 if (priv->header_html)
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
174 return priv->header_html;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
175
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
176 file = g_build_filename(dir, "Contents", "Resources", "Header.html", NULL);
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
177 if (!g_file_get_contents(file, &priv->header_html, NULL, NULL))
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
178 priv->header_html = g_strdup("");
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
179 g_free(file);
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
180
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
181 return priv->header_html;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
182 }
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
183
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
184 static const char *
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
185 get_footer_html(PidginConvThemePrivate *priv, const char *dir)
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
186 {
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
187 char *file;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
188
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
189 if (priv->footer_html)
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
190 return priv->footer_html;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
191
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
192 file = g_build_filename(dir, "Contents", "Resources", "Footer.html", NULL);
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
193 if (!g_file_get_contents(file, &priv->footer_html, NULL, NULL))
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
194 priv->footer_html = g_strdup("");
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
195 g_free(file);
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
196
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
197 return priv->footer_html;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
198 }
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
199
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
200 static const char *
32571
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
201 get_topic_html(PidginConvThemePrivate *priv, const char *dir)
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
202 {
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
203 char *file;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
204
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
205 if (priv->topic_html)
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
206 return priv->topic_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
207
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
208 file = g_build_filename(dir, "Contents", "Resources", "Topic.html", NULL);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
209 if (!g_file_get_contents(file, &priv->topic_html, NULL, NULL)) {
32584
7bf37989b484 Add some missing newlines in debug output.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32576
diff changeset
210 purple_debug_info("webkit", "%s could not find Resources/Topic.html\n", dir);
32571
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
211 priv->topic_html = g_strdup("");
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
212 }
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
213 g_free(file);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
214
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
215 return priv->topic_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
216 }
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
217
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
218 static const char *
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
219 get_content_html(PidginConvThemePrivate *priv, const char *dir)
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
220 {
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
221 char *file;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
222
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
223 if (priv->content_html)
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
224 return priv->content_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
225
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
226 file = g_build_filename(dir, "Contents", "Resources", "Content.html", NULL);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
227 if (!g_file_get_contents(file, &priv->content_html, NULL, NULL)) {
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
228 purple_debug_info("webkit", "%s did not have a Content.html\n", dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
229 priv->content_html = g_strdup("");
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
230 }
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
231 g_free(file);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
232
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
233 return priv->content_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
234 }
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
235
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
236 static const char *
32587
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
237 get_status_html(PidginConvThemePrivate *priv, const char *dir)
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
238 {
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
239 char *file;
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
240
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
241 if (priv->status_html)
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
242 return priv->status_html;
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
243
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
244 file = g_build_filename(dir, "Contents", "Resources", "Status.html", NULL);
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
245 if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) {
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
246 purple_debug_info("webkit", "%s could not find Resources/Status.html\n", dir);
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
247 priv->status_html = g_strdup(get_content_html(priv, dir));
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
248 }
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
249 g_free(file);
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
250
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
251 return priv->status_html;
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
252 }
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
253
27e41510a278 Fix fallback of Status.html to Content.html.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32584
diff changeset
254 static const char *
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
255 get_incoming_content_html(PidginConvThemePrivate *priv, const char *dir)
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
256 {
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
257 char *file;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
258
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
259 if (priv->incoming_content_html)
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
260 return priv->incoming_content_html;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
261
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
262 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Content.html", NULL);
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
263 if (!g_file_get_contents(file, &priv->incoming_content_html, NULL, NULL)) {
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
264 purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", dir);
32571
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
265 priv->incoming_content_html = g_strdup(get_content_html(priv, dir));
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
266 }
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
267 g_free(file);
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
268
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
269 return priv->incoming_content_html;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
270 }
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
271
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
272 static const char *
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
273 get_incoming_next_content_html(PidginConvThemePrivate *priv, const char *dir)
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
274 {
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
275 char *file;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
276
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
277 if (priv->incoming_next_content_html)
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
278 return priv->incoming_next_content_html;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
279
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
280 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContent.html", NULL);
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
281 if (!g_file_get_contents(file, &priv->incoming_next_content_html, NULL, NULL)) {
32571
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
282 priv->incoming_next_content_html = g_strdup(get_incoming_content_html(priv, dir));
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
283 }
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
284 g_free(file);
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
285
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
286 return priv->incoming_next_content_html;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
287 }
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
288
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
289 static const char *
32571
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
290 get_incoming_context_html(PidginConvThemePrivate *priv, const char *dir)
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
291 {
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
292 char *file;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
293
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
294 if (priv->incoming_context_html)
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
295 return priv->incoming_context_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
296
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
297 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Context.html", NULL);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
298 if (!g_file_get_contents(file, &priv->incoming_context_html, NULL, NULL)) {
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
299 purple_debug_info("webkit", "%s did not have a Incoming/Context.html\n", dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
300 priv->incoming_context_html = g_strdup(get_incoming_content_html(priv, dir));
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
301 }
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
302 g_free(file);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
303
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
304 return priv->incoming_context_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
305 }
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
306
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
307 static const char *
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
308 get_incoming_next_context_html(PidginConvThemePrivate *priv, const char *dir)
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
309 {
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
310 char *file;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
311
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
312 if (priv->incoming_next_context_html)
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
313 return priv->incoming_next_context_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
314
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
315 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContext.html", NULL);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
316 if (!g_file_get_contents(file, &priv->incoming_next_context_html, NULL, NULL)) {
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
317 priv->incoming_next_context_html = g_strdup(get_incoming_context_html(priv, dir));
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
318 }
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
319 g_free(file);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
320
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
321 return priv->incoming_next_context_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
322 }
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
323
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
324 static const char *
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
325 get_outgoing_content_html(PidginConvThemePrivate *priv, const char *dir)
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
326 {
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
327 char *file;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
328
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
329 if (priv->outgoing_content_html)
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
330 return priv->outgoing_content_html;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
331
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
332 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Content.html", NULL);
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
333 if (!g_file_get_contents(file, &priv->outgoing_content_html, NULL, NULL)) {
32571
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
334 priv->outgoing_content_html = g_strdup(get_incoming_content_html(priv, dir));
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
335 }
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
336 g_free(file);
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
337
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
338 return priv->outgoing_content_html;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
339 }
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
340
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
341 static const char *
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
342 get_outgoing_next_content_html(PidginConvThemePrivate *priv, const char *dir)
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
343 {
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
344 char *file;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
345
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
346 if (priv->outgoing_next_content_html)
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
347 return priv->outgoing_next_content_html;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
348
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
349 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL);
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
350 if (!g_file_get_contents(file, &priv->outgoing_next_content_html, NULL, NULL)) {
32571
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
351 priv->outgoing_next_content_html = g_strdup(get_outgoing_content_html(priv, dir));
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
352 }
39461
a4ae05d3be93 Fix several g_build_filename leaks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39239
diff changeset
353 g_free(file);
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
354
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
355 return priv->outgoing_next_content_html;
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
356 }
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
357
32571
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
358 static const char *
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
359 get_outgoing_context_html(PidginConvThemePrivate *priv, const char *dir)
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
360 {
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
361 char *file;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
362
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
363 if (priv->outgoing_context_html)
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
364 return priv->outgoing_context_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
365
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
366 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Context.html", NULL);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
367 if (!g_file_get_contents(file, &priv->outgoing_context_html, NULL, NULL)) {
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
368 priv->outgoing_context_html = g_strdup(get_incoming_context_html(priv, dir));
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
369 }
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
370 g_free(file);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
371
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
372 return priv->outgoing_context_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
373 }
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
374
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
375 static const char *
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
376 get_outgoing_next_context_html(PidginConvThemePrivate *priv, const char *dir)
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
377 {
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
378 char *file;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
379
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
380 if (priv->outgoing_next_context_html)
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
381 return priv->outgoing_next_context_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
382
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
383 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContext.html", NULL);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
384 if (!g_file_get_contents(file, &priv->outgoing_next_context_html, NULL, NULL)) {
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
385 priv->outgoing_next_context_html = g_strdup(get_outgoing_context_html(priv, dir));
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
386 }
32728
bc0b95512380 Fix a small leak.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32725
diff changeset
387 g_free(file);
32571
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
388
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
389 return priv->outgoing_next_context_html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
390 }
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
391
32599
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
392 /******************************************************************************
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
393 * GObject Stuff
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
394 *****************************************************************************/
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
395
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
396 static void
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
397 pidgin_conv_theme_get_property(GObject *obj, guint param_id, GValue *value,
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
398 GParamSpec *psec)
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
399 {
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
400 PidginConvTheme *theme = PIDGIN_CONV_THEME(obj);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
401
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
402 switch (param_id) {
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
403 case PROP_INFO:
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
404 g_value_set_boxed(value, (gpointer)pidgin_conversation_theme_get_info(theme));
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
405 break;
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
406
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
407 case PROP_VARIANT:
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
408 g_value_set_string(value, pidgin_conversation_theme_get_variant(theme));
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
409 break;
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
410
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
411 default:
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
412 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
413 break;
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
414 }
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
415 }
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
416
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
417 static void
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
418 pidgin_conv_theme_set_property(GObject *obj, guint param_id, const GValue *value,
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
419 GParamSpec *psec)
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
420 {
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
421 PidginConvTheme *theme = PIDGIN_CONV_THEME(obj);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
422
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
423 switch (param_id) {
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
424 case PROP_INFO:
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
425 pidgin_conversation_theme_set_info(theme, g_value_get_boxed(value));
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
426 break;
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
427
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
428 case PROP_VARIANT:
35064
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
429 pidgin_conversation_theme_set_variant(theme, g_value_get_string(value));
32599
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
430 break;
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
431
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
432 default:
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
433 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
434 break;
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
435 }
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
436 }
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
437
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
438 static void
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
439 pidgin_conversation_theme_init(PidginConvTheme *theme)
32599
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
440 {
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
441 }
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
442
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
443 static void
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
444 pidgin_conv_theme_finalize(GObject *obj)
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
445 {
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
446 PidginConvThemePrivate *priv;
32600
26c310f9e08b Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32599
diff changeset
447 GList *list;
32599
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
448
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
449 priv = pidgin_conversation_theme_get_instance_private(
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
450 PIDGIN_CONV_THEME(obj));
32599
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
451
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
452 g_free(priv->template_html);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
453 g_free(priv->header_html);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
454 g_free(priv->footer_html);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
455 g_free(priv->topic_html);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
456 g_free(priv->status_html);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
457 g_free(priv->content_html);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
458 g_free(priv->incoming_content_html);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
459 g_free(priv->outgoing_content_html);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
460 g_free(priv->incoming_next_content_html);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
461 g_free(priv->outgoing_next_content_html);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
462 g_free(priv->incoming_context_html);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
463 g_free(priv->outgoing_context_html);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
464 g_free(priv->incoming_next_context_html);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
465 g_free(priv->outgoing_next_context_html);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
466 g_free(priv->basestyle_css);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
467
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
468 if (priv->info)
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
469 g_hash_table_destroy(priv->info);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
470
32600
26c310f9e08b Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32599
diff changeset
471 list = priv->variants;
26c310f9e08b Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32599
diff changeset
472 while (list) {
26c310f9e08b Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32599
diff changeset
473 g_free(list->data);
26c310f9e08b Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32599
diff changeset
474 list = g_list_delete_link(list, list);
26c310f9e08b Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32599
diff changeset
475 }
26c310f9e08b Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32599
diff changeset
476 g_free(priv->variant);
26c310f9e08b Don't leak variant name and list.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32599
diff changeset
477
33642
a99637d00287 Fix an assertion.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33384
diff changeset
478 if (priv->nick_colors)
a99637d00287 Fix an assertion.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33384
diff changeset
479 g_array_unref(priv->nick_colors);
33384
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
480
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
481 G_OBJECT_CLASS(pidgin_conversation_theme_parent_class)->finalize(obj);
32599
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
482 }
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
483
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
484 static void
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
485 pidgin_conversation_theme_class_init(PidginConvThemeClass *klass)
32599
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
486 {
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
487 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
488
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
489 obj_class->get_property = pidgin_conv_theme_get_property;
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
490 obj_class->set_property = pidgin_conv_theme_set_property;
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
491 obj_class->finalize = pidgin_conv_theme_finalize;
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
492
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
493 /* INFO */
35074
0d56a4091806 Use glibcompat.h for "notify" in gtkconv-theme.c
Ankit Vani <a@nevitus.org>
parents: 35064
diff changeset
494 properties[PROP_INFO] = g_param_spec_boxed("info", "Info",
32599
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
495 "The information about this theme",
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
496 G_TYPE_HASH_TABLE,
35060
195dbb3b6432 pidgin: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 33941
diff changeset
497 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
32599
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
498
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
499 /* VARIANT */
35074
0d56a4091806 Use glibcompat.h for "notify" in gtkconv-theme.c
Ankit Vani <a@nevitus.org>
parents: 35064
diff changeset
500 properties[PROP_VARIANT] = g_param_spec_string("variant", "Variant",
32599
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
501 "The current variant for this theme",
35060
195dbb3b6432 pidgin: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 33941
diff changeset
502 NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
35082
05a66637ec23 pidgin: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents: 35074
diff changeset
503
05a66637ec23 pidgin: use g_object_class_install_properties instead of repeated g_object_class_install_property
Ankit Vani <a@nevitus.org>
parents: 35074
diff changeset
504 g_object_class_install_properties(obj_class, PROP_LAST, properties);
32599
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
505 }
670b01df8023 Rearrange to drop the prototypes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32598
diff changeset
506
32544
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
507 /*****************************************************************************
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
508 * Public API functions
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
509 *****************************************************************************/
4cf095ee82e3 Copy theme-to-conversation loading stuff into the GObject code.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32540
diff changeset
510
32545
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
511 const GHashTable *
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
512 pidgin_conversation_theme_get_info(PidginConvTheme *theme)
32545
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
513 {
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
514 PidginConvThemePrivate *priv;
32576
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
515
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
516 g_return_val_if_fail(theme != NULL, NULL);
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
517
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
518 priv = pidgin_conversation_theme_get_instance_private(theme);
32545
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
519 return priv->info;
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
520 }
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
521
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
522 void
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
523 pidgin_conversation_theme_set_info(PidginConvTheme *theme, GHashTable *info)
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
524 {
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
525 PidginConvThemePrivate *priv;
32576
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
526
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
527 g_return_if_fail(theme != NULL);
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
528
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
529 priv = pidgin_conversation_theme_get_instance_private(theme);
32545
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
530
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
531 if (priv->info)
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
532 g_hash_table_destroy(priv->info);
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
533
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
534 priv->info = info;
35060
195dbb3b6432 pidgin: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 33941
diff changeset
535
35074
0d56a4091806 Use glibcompat.h for "notify" in gtkconv-theme.c
Ankit Vani <a@nevitus.org>
parents: 35064
diff changeset
536 g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_INFO]);
32545
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
537 }
1b21192ab58a Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32544
diff changeset
538
32573
83bf257530d0 Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32571
diff changeset
539 const GValue *
83bf257530d0 Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32571
diff changeset
540 pidgin_conversation_theme_lookup(PidginConvTheme *theme, const char *key, gboolean specific)
83bf257530d0 Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32571
diff changeset
541 {
83bf257530d0 Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32571
diff changeset
542 PidginConvThemePrivate *priv;
32576
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
543
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
544 g_return_val_if_fail(theme != NULL, NULL);
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
545
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
546 priv = pidgin_conversation_theme_get_instance_private(theme);
32573
83bf257530d0 Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32571
diff changeset
547
83bf257530d0 Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32571
diff changeset
548 return get_key(priv, key, specific);
83bf257530d0 Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32571
diff changeset
549 }
83bf257530d0 Add a function for lookup of Info.plist entries.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32571
diff changeset
550
32571
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
551 const char *
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
552 pidgin_conversation_theme_get_template(PidginConvTheme *theme, PidginConvThemeTemplateType type)
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
553 {
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
554 PidginConvThemePrivate *priv;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
555 const char *dir;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
556 const char *html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
557
32576
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
558 g_return_val_if_fail(theme != NULL, NULL);
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
559
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
560 priv = pidgin_conversation_theme_get_instance_private(theme);
32571
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
561 dir = purple_theme_get_dir(PURPLE_THEME(theme));
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
562
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
563 switch (type) {
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
564 case PIDGIN_CONVERSATION_THEME_TEMPLATE_MAIN:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
565 html = get_template_html(priv, dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
566 break;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
567 case PIDGIN_CONVERSATION_THEME_TEMPLATE_HEADER:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
568 html = get_header_html(priv, dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
569 break;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
570 case PIDGIN_CONVERSATION_THEME_TEMPLATE_FOOTER:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
571 html = get_footer_html(priv, dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
572 break;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
573 case PIDGIN_CONVERSATION_THEME_TEMPLATE_TOPIC:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
574 html = get_topic_html(priv, dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
575 break;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
576 case PIDGIN_CONVERSATION_THEME_TEMPLATE_STATUS:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
577 html = get_status_html(priv, dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
578 break;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
579 case PIDGIN_CONVERSATION_THEME_TEMPLATE_CONTENT:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
580 html = get_content_html(priv, dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
581 break;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
582 case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTENT:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
583 html = get_incoming_content_html(priv, dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
584 break;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
585 case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTENT:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
586 html = get_incoming_next_content_html(priv, dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
587 break;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
588 case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_CONTEXT:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
589 html = get_incoming_context_html(priv, dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
590 break;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
591 case PIDGIN_CONVERSATION_THEME_TEMPLATE_INCOMING_NEXT_CONTEXT:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
592 html = get_incoming_next_context_html(priv, dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
593 break;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
594 case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTENT:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
595 html = get_outgoing_content_html(priv, dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
596 break;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
597 case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTENT:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
598 html = get_outgoing_next_content_html(priv, dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
599 break;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
600 case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_CONTEXT:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
601 html = get_outgoing_context_html(priv, dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
602 break;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
603 case PIDGIN_CONVERSATION_THEME_TEMPLATE_OUTGOING_NEXT_CONTEXT:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
604 html = get_outgoing_next_context_html(priv, dir);
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
605 break;
32574
56dc04a81f4b Add template lookup for 'basestyle' CSS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32573
diff changeset
606 case PIDGIN_CONVERSATION_THEME_TEMPLATE_BASESTYLE_CSS:
56dc04a81f4b Add template lookup for 'basestyle' CSS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32573
diff changeset
607 html = get_basestyle_css(priv, dir);
56dc04a81f4b Add template lookup for 'basestyle' CSS.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32573
diff changeset
608 break;
32571
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
609 default:
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
610 purple_debug_error("gtkconv-theme",
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
611 "Requested invalid template type (%d) for theme %s.\n",
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
612 type, purple_theme_get_name(PURPLE_THEME(theme)));
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
613 html = NULL;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
614 }
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
615
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
616 return html;
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
617 }
04b564092222 Add an accessor for template data. Also, fix some fallbacks.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32566
diff changeset
618
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
619 void
32564
b711e92242da Fix a leak. pidgin_conversation_theme_add_variant should only be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32563
diff changeset
620 pidgin_conversation_theme_add_variant(PidginConvTheme *theme, char *variant)
32562
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
621 {
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
622 PidginConvThemePrivate *priv;
32576
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
623
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
624 g_return_if_fail(theme != NULL);
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
625 g_return_if_fail(variant != NULL);
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
626
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
627 priv = pidgin_conversation_theme_get_instance_private(theme);
32562
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
628
32564
b711e92242da Fix a leak. pidgin_conversation_theme_add_variant should only be
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32563
diff changeset
629 priv->variants = g_list_prepend(priv->variants, variant);
32562
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
630 }
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
631
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
632 const char *
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
633 pidgin_conversation_theme_get_variant(PidginConvTheme *theme)
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
634 {
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
635 PidginConvThemePrivate *priv;
32576
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
636
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
637 g_return_val_if_fail(theme != NULL, NULL);
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
638
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
639 priv = pidgin_conversation_theme_get_instance_private(theme);
32562
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
640
32601
36daedfec84a Fix a leak. This strdup shouldn't be here.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32600
diff changeset
641 return priv->variant;
32562
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
642 }
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
643
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
644 void
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
645 pidgin_conversation_theme_set_variant(PidginConvTheme *theme, const char *variant)
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
646 {
35064
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
647 PidginConvThemePrivate *priv;
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
648 const GValue *val;
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
649 char *prefname;
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
650
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
651 g_return_if_fail(theme != NULL);
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
652 g_return_if_fail(variant != NULL);
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
653
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
654 priv = pidgin_conversation_theme_get_instance_private(theme);
35064
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
655
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
656 g_free(priv->variant);
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
657 priv->variant = g_strdup(variant);
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
658
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
659 val = get_key(priv, "CFBundleIdentifier", FALSE);
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
660 prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s/variant",
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
661 g_value_get_string(val));
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
662 purple_prefs_set_string(prefname, variant);
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
663 g_free(prefname);
995be3523e7c Removed unnecessary static function _set_variant
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
664
32598
e824d9bbe6ff Make the current variant a property.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32587
diff changeset
665 g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_VARIANT]);
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
666 }
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
667
32562
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
668 const GList *
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
669 pidgin_conversation_theme_get_variants(PidginConvTheme *theme)
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
670 {
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
671 PidginConvThemePrivate *priv;
32576
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
672
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
673 g_return_val_if_fail(theme != NULL, NULL);
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
674
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
675 priv = pidgin_conversation_theme_get_instance_private(theme);
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
676
32562
9c094ffe9333 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32561
diff changeset
677 return priv->variants;
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
678 }
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
679
32575
eb4fc932fae9 Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32574
diff changeset
680 char *
eb4fc932fae9 Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32574
diff changeset
681 pidgin_conversation_theme_get_template_path(PidginConvTheme *theme)
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
682 {
32575
eb4fc932fae9 Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32574
diff changeset
683 const char *dir;
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
684
32576
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
685 g_return_val_if_fail(theme != NULL, NULL);
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
686
32575
eb4fc932fae9 Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32574
diff changeset
687 dir = purple_theme_get_dir(PURPLE_THEME(theme));
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
688
32725
b8c479aec53b Fix fallback to builtin Template.html file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32639
diff changeset
689 return get_template_path(dir);
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
690 }
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
691
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
692 char *
32575
eb4fc932fae9 Apply conversation theme when opening the GTK conversation. All the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32574
diff changeset
693 pidgin_conversation_theme_get_css_path(PidginConvTheme *theme)
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
694 {
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
695 PidginConvThemePrivate *priv;
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
696 const char *dir;
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
697
32576
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
698 g_return_val_if_fail(theme != NULL, NULL);
06ed3d7e9e72 Add some NULL checks. Now it should not crash even if you don't have
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32575
diff changeset
699
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
700 priv = pidgin_conversation_theme_get_instance_private(theme);
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
701
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
702 dir = purple_theme_get_dir(PURPLE_THEME(theme));
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
703 if (!priv->variant) {
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
704 return g_build_filename(dir, "Contents", "Resources", "main.css", NULL);
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
705 } else {
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
706 char *file = g_strdup_printf("%s.css", priv->variant);
32558
e9065eebef24 Lookup style key information from the hash table instead of the struct
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32549
diff changeset
707 char *ret = g_build_filename(dir, "Contents", "Resources", "Variants", file, NULL);
32540
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
708 g_free(file);
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
709 return ret;
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
710 }
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
711 }
1e50f90abb9b Attempt to move the message style object from the plugin into the new
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32539
diff changeset
712
33384
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
713 GArray *
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
714 pidgin_conversation_theme_get_nick_colors(PidginConvTheme *theme)
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
715 {
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
716 PidginConvThemePrivate *priv;
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
717 const char *dir;
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
718
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
719 g_return_val_if_fail(theme != NULL, NULL);
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
720
39238
53cfb9400de8 Port Pidgin away from deprecated g_type_class_add_private()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39212
diff changeset
721 priv = pidgin_conversation_theme_get_instance_private(theme);
33384
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
722
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
723 dir = purple_theme_get_dir(PURPLE_THEME(theme));
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
724 if (NULL == priv->nick_colors)
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
725 {
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
726 char *file = g_build_filename(dir, "Contents", "Resources", "Incoming", "SenderColors.txt", NULL);
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
727 char *contents;
37992
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35901
diff changeset
728 priv->nick_colors = g_array_new(FALSE, FALSE, sizeof(GdkRGBA));
33384
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
729 if (g_file_get_contents(file, &contents, NULL, NULL)) {
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
730 int i;
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
731 gchar ** color_strings = g_strsplit_set(contents, "\r\n:", -1);
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
732
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
733 for(i=0; color_strings[i]; i++)
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
734 {
37992
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35901
diff changeset
735 GdkRGBA color;
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35901
diff changeset
736 if (gdk_rgba_parse(&color, color_strings[i])) {
33384
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
737 g_array_append_val(priv->nick_colors, color);
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
738 }
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
739 }
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
740
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
741 g_strfreev(color_strings);
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
742 g_free(contents);
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
743 }
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
744 g_free(file);
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
745 }
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
746
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
747 if(priv->nick_colors->len)
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
748 return g_array_ref(priv->nick_colors);
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
749 else
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
750 return NULL;
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
751 }
215f0b668ac6 now loads the SenderColors.txt file from the theme if it exists, otherwise falls back to the built-in runtime-generated list
Nathan Walp <nwalp@pidgin.im>
parents: 32960
diff changeset
752

mercurial