Mercurial > pidgin.yaz
annotate pidgin/gtkconv-theme-loader.c @ 32637:5aa171c8776b
Fix a bunch of tiny problems generating our doxygen documentation
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 18 Sep 2011 20:46:06 +0000 |
parents | 2ca29cd62db8 |
children | a7a6770f26e2 |
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 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
23 #include "gtkconv-theme-loader.h" |
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.h" |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
25 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
26 #include "xmlnode.h" |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
27 #include "debug.h" |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
28 |
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 * Conversation Theme Builder |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
31 *****************************************************************************/ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
32 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
33 static GHashTable * |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
34 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
|
35 { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
36 GHashTable *info; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
37 xmlnode *key, *value; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
38 gboolean fail = FALSE; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
39 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
40 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
|
41 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
42 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
|
43 key; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
44 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
|
45 char *keyname; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
46 GValue *val; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
47 |
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 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
|
50 ; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
51 if (!value) { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
52 fail = TRUE; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
53 break; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
54 } |
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 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
|
57 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
|
58 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
|
59 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
|
60 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
61 } 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
|
62 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
|
63 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
|
64 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
65 } 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
|
66 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
|
67 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
|
68 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
69 } 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
|
70 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
|
71 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
|
72 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
|
73 g_free(temp); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
74 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
75 } 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
|
76 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
|
77 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
|
78 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
|
79 g_free(temp); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
80 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
81 } else { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
82 /* 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
|
83 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
|
84 g_free(val); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
85 fail = TRUE; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
86 break; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
87 } |
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 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
|
90 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
|
91 } |
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 if (fail) { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
94 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
|
95 info = NULL; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
96 } |
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 return info; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
99 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
100 |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
101 static PurpleTheme * |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
102 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
|
103 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
104 PidginConvTheme *theme = NULL; |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
105 char *contents; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
106 xmlnode *plist; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
107 GHashTable *info; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
108 GValue *val; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
109 int MessageViewVersion; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
110 const char *CFBundleName; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
111 const char *CFBundleIdentifier; |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
112 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
113 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
|
114 |
32630
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
115 /* 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
|
116 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
|
117 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
|
118 g_free(contents); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
119 if (plist == NULL) { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
120 purple_debug_error("gtkconv-theme", "Failed to load Contents/Info.plist in %s\n", dir); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
121 return NULL; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
122 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
123 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
124 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
|
125 xmlnode_free(plist); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
126 if (info == NULL) { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
127 purple_debug_error("gtkconv-theme", "Failed to load Contents/Info.plist in %s\n", dir); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
128 return NULL; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
129 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
130 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
131 /* 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
|
132 val = g_hash_table_lookup(info, "CFBundleName"); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
133 if (!val) { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
134 purple_debug_error("gtkconv-theme", "%s/Contents/Info.plist missing required key CFBundleName.\n", dir); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
135 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
|
136 return NULL; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
137 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
138 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
|
139 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
140 /* 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
|
141 val = g_hash_table_lookup(info, "CFBundleIdentifier"); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
142 if (!val) { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
143 purple_debug_error("gtkconv-theme", "%s/Contents/Info.plist missing required key CFBundleIdentifier.\n", dir); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
144 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
|
145 return NULL; |
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 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
|
148 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
149 /* 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
|
150 val = g_hash_table_lookup(info, "MessageViewVersion"); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
151 if (!val) { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
152 purple_debug_error("gtkconv-theme", "%s/Contents/Info.plist missing required key MessageViewVersion.\n", dir); |
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 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
157 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
|
158 if (MessageViewVersion < 3) { |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
159 purple_debug_error("gtkconv-theme", "%s is a legacy style (version %d) and will not be loaded.\n", |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
160 CFBundleName, MessageViewVersion); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
161 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
|
162 return NULL; |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
163 } |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
164 |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
165 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
|
166 "type", "conversation", |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
167 "name", CFBundleName, |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
168 "directory", dir, |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
169 "info", info, NULL); |
2ca29cd62db8
Move conversation theme loading into the PidginConvThemeLoader GObject
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32619
diff
changeset
|
170 |
32619
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
171 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
|
172 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
173 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
174 /****************************************************************************** |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
175 * GObject Stuff |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
176 *****************************************************************************/ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
177 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
178 static void |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
179 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
|
180 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
181 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
|
182 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
183 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
|
184 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
185 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
186 |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
187 GType |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
188 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
|
189 { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
190 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
|
191 if (type == 0) { |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
192 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
|
193 sizeof(PidginConvThemeLoaderClass), |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
194 NULL, /* base_init */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
195 NULL, /* base_finalize */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
196 (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
|
197 NULL, /* class_finalize */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
198 NULL, /* class_data */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
199 sizeof (PidginConvThemeLoader), |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
200 0, /* n_preallocs */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
201 NULL, /* instance_init */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
202 NULL, /* value table */ |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
203 }; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
204 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
|
205 "PidginConvThemeLoader", &info, 0); |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
206 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
207 return type; |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
208 } |
17c27a527004
Add some boilerplate Conversation theme GObjects. These don't do
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff
changeset
|
209 |