annotate pidgin/gtkconv-theme-loader.c @ 32813:03efb97b552b

Convert to using purple_blist_node_ accessor functions.
author andrew.victor@mxit.com
date Tue, 01 Nov 2011 17:28:17 +0000
parents 73d04f4b18ee
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32619
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1 /*
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
2 * PidginConvThemeLoader for Pidgin
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
3 *
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
4 * Pidgin is the legal property of its developers, whose names are too numerous
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
6 * source distribution.
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
7 *
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
12 *
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
17 *
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
21 */
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
22
32651
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
23 #include "pidgin.h"
32619
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
24 #include "gtkconv-theme-loader.h"
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
25 #include "gtkconv-theme.h"
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
26
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
27 #include "xmlnode.h"
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
28 #include "debug.h"
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
29
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
30 /*****************************************************************************
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
31 * Conversation Theme Builder
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
32 *****************************************************************************/
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
33
32630
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
34 static GHashTable *
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
35 read_info_plist(xmlnode *plist)
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
36 {
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
37 GHashTable *info;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
38 xmlnode *key, *value;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
39 gboolean fail = FALSE;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
40
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
41 info = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
42
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
43 for (key = xmlnode_get_child(plist, "dict/key");
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
44 key;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
45 key = xmlnode_get_next_twin(key)) {
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
46 char *keyname;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
47 GValue *val;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
48
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
49 ;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
50 for (value = key->next; value && value->type != XMLNODE_TYPE_TAG; value = value->next)
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
51 ;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
52 if (!value) {
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
53 fail = TRUE;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
54 break;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
55 }
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
56
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
57 val = g_new0(GValue, 1);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
58 if (g_str_equal(value->name, "string")) {
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
59 g_value_init(val, G_TYPE_STRING);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
60 g_value_take_string(val, xmlnode_get_data_unescaped(value));
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
61
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
62 } else if (g_str_equal(value->name, "true")) {
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
63 g_value_init(val, G_TYPE_BOOLEAN);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
64 g_value_set_boolean(val, TRUE);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
65
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
66 } else if (g_str_equal(value->name, "false")) {
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
67 g_value_init(val, G_TYPE_BOOLEAN);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
68 g_value_set_boolean(val, FALSE);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
69
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
70 } else if (g_str_equal(value->name, "real")) {
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
71 char *temp = xmlnode_get_data_unescaped(value);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
72 g_value_init(val, G_TYPE_FLOAT);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
73 g_value_set_float(val, atof(temp));
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
74 g_free(temp);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
75
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
76 } else if (g_str_equal(value->name, "integer")) {
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
77 char *temp = xmlnode_get_data_unescaped(value);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
78 g_value_init(val, G_TYPE_INT);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
79 g_value_set_int(val, atoi(temp));
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
80 g_free(temp);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
81
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
82 } else {
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
83 /* NOTE: We don't support array, data, date, or dict as values,
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
84 since they don't seem to be needed for styles. */
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
85 g_free(val);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
86 fail = TRUE;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
87 break;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
88 }
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
89
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
90 keyname = xmlnode_get_data_unescaped(key);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
91 g_hash_table_insert(info, keyname, val);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
92 }
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
93
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
94 if (fail) {
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
95 g_hash_table_destroy(info);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
96 info = NULL;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
97 }
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
98
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
99 return info;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
100 }
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
101
32619
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
102 static PurpleTheme *
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
103 pidgin_conv_loader_build(const gchar *dir)
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
104 {
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
105 PidginConvTheme *theme = NULL;
32630
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
106 char *contents;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
107 xmlnode *plist;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
108 GHashTable *info;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
109 GValue *val;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
110 int MessageViewVersion;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
111 const char *CFBundleName;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
112 const char *CFBundleIdentifier;
32645
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
113 GDir *variants;
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
114 char *variant_dir;
32619
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
115
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
116 g_return_val_if_fail(dir != NULL, NULL);
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
117
32630
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
118 /* Load Info.plist for theme information */
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
119 contents = g_build_filename(dir, "Contents", NULL);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
120 plist = xmlnode_from_file(contents, "Info.plist", "Info.plist", "gtkconv-theme-loader");
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
121 g_free(contents);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
122 if (plist == NULL) {
32648
a56483e407d4 Use a consistent debugging domain.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32645
diff changeset
123 purple_debug_error("gtkconv-theme-loader",
a56483e407d4 Use a consistent debugging domain.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32645
diff changeset
124 "Failed to load Contents/Info.plist in %s\n", dir);
32630
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
125 return NULL;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
126 }
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
127
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
128 info = read_info_plist(plist);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
129 xmlnode_free(plist);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
130 if (info == NULL) {
32648
a56483e407d4 Use a consistent debugging domain.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32645
diff changeset
131 purple_debug_error("gtkconv-theme-loader",
a56483e407d4 Use a consistent debugging domain.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32645
diff changeset
132 "Failed to load Contents/Info.plist in %s\n", dir);
32630
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
133 return NULL;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
134 }
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
135
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
136 /* Check for required keys: CFBundleName */
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
137 val = g_hash_table_lookup(info, "CFBundleName");
32649
1caf13175039 Be a bit stricter about types in Info.plist.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32648
diff changeset
138 if (!val || !G_VALUE_HOLDS_STRING(val)) {
32648
a56483e407d4 Use a consistent debugging domain.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32645
diff changeset
139 purple_debug_error("gtkconv-theme-loader",
32649
1caf13175039 Be a bit stricter about types in Info.plist.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32648
diff changeset
140 "%s/Contents/Info.plist missing required string key CFBundleName.\n",
32648
a56483e407d4 Use a consistent debugging domain.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32645
diff changeset
141 dir);
32630
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
142 g_hash_table_destroy(info);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
143 return NULL;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
144 }
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
145 CFBundleName = g_value_get_string(val);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
146
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
147 /* Check for required keys: CFBundleIdentifier */
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
148 val = g_hash_table_lookup(info, "CFBundleIdentifier");
32649
1caf13175039 Be a bit stricter about types in Info.plist.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32648
diff changeset
149 if (!val || !G_VALUE_HOLDS_STRING(val)) {
32648
a56483e407d4 Use a consistent debugging domain.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32645
diff changeset
150 purple_debug_error("gtkconv-theme-loader",
32649
1caf13175039 Be a bit stricter about types in Info.plist.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32648
diff changeset
151 "%s/Contents/Info.plist missing required string key CFBundleIdentifier.\n",
32648
a56483e407d4 Use a consistent debugging domain.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32645
diff changeset
152 dir);
32630
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
153 g_hash_table_destroy(info);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
154 return NULL;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
155 }
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
156 CFBundleIdentifier = g_value_get_string(val);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
157
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
158 /* Check for required keys: MessageViewVersion */
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
159 val = g_hash_table_lookup(info, "MessageViewVersion");
32649
1caf13175039 Be a bit stricter about types in Info.plist.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32648
diff changeset
160 if (!val || !G_VALUE_HOLDS_INT(val)) {
32648
a56483e407d4 Use a consistent debugging domain.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32645
diff changeset
161 purple_debug_error("gtkconv-theme-loader",
32649
1caf13175039 Be a bit stricter about types in Info.plist.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32648
diff changeset
162 "%s/Contents/Info.plist missing required integer key MessageViewVersion.\n",
32648
a56483e407d4 Use a consistent debugging domain.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32645
diff changeset
163 dir);
32630
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
164 g_hash_table_destroy(info);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
165 return NULL;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
166 }
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
167
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
168 MessageViewVersion = g_value_get_int(val);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
169 if (MessageViewVersion < 3) {
32648
a56483e407d4 Use a consistent debugging domain.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32645
diff changeset
170 purple_debug_error("gtkconv-theme-loader",
a56483e407d4 Use a consistent debugging domain.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32645
diff changeset
171 "%s is a legacy style (version %d) and will not be loaded.\n",
a56483e407d4 Use a consistent debugging domain.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32645
diff changeset
172 CFBundleName, MessageViewVersion);
32630
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
173 g_hash_table_destroy(info);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
174 return NULL;
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
175 }
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
176
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
177 theme = g_object_new(PIDGIN_TYPE_CONV_THEME,
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
178 "type", "conversation",
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
179 "name", CFBundleName,
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
180 "directory", dir,
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
181 "info", info, NULL);
2ca29cd62db8 Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32619
diff changeset
182
32645
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
183 /* Read list of variants */
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
184 variant_dir = g_build_filename(dir, "Contents", "Resources", "Variants", NULL);
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
185 variants = g_dir_open(variant_dir, 0, NULL);
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
186 g_free(variant_dir);
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
187
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
188 if (variants) {
32651
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
189 char *prefname;
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
190 const char *default_variant = NULL;
32645
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
191 const char *file;
32651
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
192
32671
73d04f4b18ee Make sure our pref parents exist, or else saved variants will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32653
diff changeset
193 /* Make sure prefs exist */
73d04f4b18ee Make sure our pref parents exist, or else saved variants will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32653
diff changeset
194 prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s",
73d04f4b18ee Make sure our pref parents exist, or else saved variants will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32653
diff changeset
195 CFBundleIdentifier);
73d04f4b18ee Make sure our pref parents exist, or else saved variants will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32653
diff changeset
196 purple_prefs_add_none(prefname);
73d04f4b18ee Make sure our pref parents exist, or else saved variants will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32653
diff changeset
197 g_free(prefname);
73d04f4b18ee Make sure our pref parents exist, or else saved variants will
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32653
diff changeset
198
32651
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
199 /* Try user-set variant */
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
200 prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s/variant",
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
201 CFBundleIdentifier);
32653
cc6efa22cdf3 Avoid an error log for non-existent prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32651
diff changeset
202 if (purple_prefs_exists(prefname))
cc6efa22cdf3 Avoid an error log for non-existent prefs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32651
diff changeset
203 default_variant = purple_prefs_get_string(prefname);
32651
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
204 g_free(prefname);
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
205
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
206 if (default_variant && *default_variant) {
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
207 pidgin_conversation_theme_set_variant(theme, default_variant);
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
208
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
209 } else {
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
210 /* Try theme default */
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
211 val = g_hash_table_lookup(info, "DefaultVariant");
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
212 if (val && G_VALUE_HOLDS_STRING(val)) {
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
213 default_variant = g_value_get_string(val);
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
214 if (default_variant && *default_variant)
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
215 pidgin_conversation_theme_set_variant(theme, default_variant);
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
216 else
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
217 default_variant = NULL;
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
218 } else
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
219 default_variant = NULL;
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
220 }
32645
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
221
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
222 while ((file = g_dir_read_name(variants)) != NULL) {
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
223 const char *end = g_strrstr(file, ".css");
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
224 char *name;
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
225
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
226 if ((end == NULL) || (*(end + 4) != '\0'))
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
227 continue;
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
228
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
229 name = g_strndup(file, end - file);
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
230 pidgin_conversation_theme_add_variant(theme, name);
32651
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
231
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
232 /* Set variant with first found */
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
233 if (!default_variant) {
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
234 pidgin_conversation_theme_set_variant(theme, name);
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
235 default_variant = name;
8716216050ee Set the default variant when loading the theme. The priorities
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32649
diff changeset
236 }
32645
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
237 }
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
238
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
239 g_dir_close(variants);
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
240 }
a7a6770f26e2 Load the list of variants when building the theme.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32630
diff changeset
241
32619
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
242 return PURPLE_THEME(theme);
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
243 }
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
244
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
245 /******************************************************************************
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
246 * GObject Stuff
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
247 *****************************************************************************/
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
248
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
249 static void
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
250 pidgin_conv_theme_loader_class_init(PidginConvThemeLoaderClass *klass)
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
251 {
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
252 PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass);
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
253
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
254 loader_klass->purple_theme_loader_build = pidgin_conv_loader_build;
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
255 }
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
256
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
257
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
258 GType
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
259 pidgin_conversation_theme_loader_get_type(void)
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
260 {
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
261 static GType type = 0;
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
262 if (type == 0) {
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
263 static const GTypeInfo info = {
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
264 sizeof(PidginConvThemeLoaderClass),
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
265 NULL, /* base_init */
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
266 NULL, /* base_finalize */
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
267 (GClassInitFunc)pidgin_conv_theme_loader_class_init, /* class_init */
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
268 NULL, /* class_finalize */
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
269 NULL, /* class_data */
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
270 sizeof (PidginConvThemeLoader),
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
271 0, /* n_preallocs */
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
272 NULL, /* instance_init */
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
273 NULL, /* value table */
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
274 };
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
275 type = g_type_register_static(PURPLE_TYPE_THEME_LOADER,
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
276 "PidginConvThemeLoader", &info, 0);
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
277 }
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
278 return type;
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
279 }
17c27a527004 Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
280