Mercurial > pidgin.yaz
comparison pidgin/gtkicon-theme-loader.c @ 25268:7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
renmaed gtkicon-loader.[ch] to gtkicon-theme-loader.[ch]
other updates as necessary due to the renames
author | Gary Kramlich <grim@reaperworld.com> |
---|---|
date | Thu, 28 Aug 2008 13:13:39 +0000 |
parents | |
children | 0c7b74fc558e |
comparison
equal
deleted
inserted
replaced
25267:e0a596a0a020 | 25268:7ddaa405936e |
---|---|
1 /* | |
2 * PidginIconThemeLoader for Pidgin | |
3 * | |
4 * Pidgin is the legal property of its developers, whose names are too numerous | |
5 * to list here. Please refer to the COPYRIGHT file distributed with this | |
6 * source distribution. | |
7 * | |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | |
21 * | |
22 */ | |
23 | |
24 #include "gtkicon-theme-loader.h" | |
25 #include "gtkstatus-icon-theme.h" | |
26 | |
27 #include "xmlnode.h" | |
28 | |
29 /***************************************************************************** | |
30 * Icon Theme Builder | |
31 *****************************************************************************/ | |
32 | |
33 static PurpleTheme * | |
34 pidgin_icon_loader_build(const gchar *dir) | |
35 { | |
36 xmlnode *root_node = NULL, *sub_node; | |
37 gchar *filename_full, *data; | |
38 PidginIconTheme *theme = NULL; | |
39 | |
40 /* Find the theme file */ | |
41 g_return_val_if_fail(dir != NULL, NULL); | |
42 filename_full = g_build_filename(dir, "theme.xml", NULL); | |
43 | |
44 if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) | |
45 root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-loader"); | |
46 | |
47 g_free(filename_full); | |
48 g_return_val_if_fail(root_node != NULL, NULL); | |
49 | |
50 /* Parse the tree */ | |
51 sub_node = xmlnode_get_child(root_node, "description"); | |
52 data = xmlnode_get_data(sub_node); | |
53 | |
54 if (xmlnode_get_attrib(root_node, "name") != NULL) { | |
55 theme = g_object_new(PIDGIN_TYPE_STATUS_ICON_THEME, | |
56 "type", "status-icon", | |
57 "name", xmlnode_get_attrib(root_node, "name"), | |
58 "author", xmlnode_get_attrib(root_node, "author"), | |
59 "image", xmlnode_get_attrib(root_node, "image"), | |
60 "directory", dir, | |
61 "description", data, NULL); | |
62 | |
63 sub_node = xmlnode_get_child(root_node, "icon"); | |
64 | |
65 while (sub_node){ | |
66 pidgin_icon_theme_set_icon(theme, | |
67 xmlnode_get_attrib(sub_node, "id"), | |
68 xmlnode_get_attrib(sub_node, "file")); | |
69 sub_node = xmlnode_get_next_twin(sub_node); | |
70 } | |
71 } | |
72 | |
73 xmlnode_free(root_node); | |
74 g_free(data); | |
75 return PURPLE_THEME(theme); | |
76 } | |
77 | |
78 /****************************************************************************** | |
79 * GObject Stuff | |
80 *****************************************************************************/ | |
81 | |
82 static void | |
83 pidgin_icon_theme_loader_class_init (PidginIconThemeLoaderClass *klass) | |
84 { | |
85 PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass); | |
86 | |
87 loader_klass->purple_theme_loader_build = pidgin_icon_loader_build; | |
88 } | |
89 | |
90 | |
91 GType | |
92 pidgin_icon_theme_loader_get_type (void) | |
93 { | |
94 static GType type = 0; | |
95 if (type == 0) { | |
96 static const GTypeInfo info = { | |
97 sizeof (PidginIconThemeLoaderClass), | |
98 NULL, /* base_init */ | |
99 NULL, /* base_finalize */ | |
100 (GClassInitFunc)pidgin_icon_theme_loader_class_init, /* class_init */ | |
101 NULL, /* class_finalize */ | |
102 NULL, /* class_data */ | |
103 sizeof (PidginIconThemeLoader), | |
104 0, /* n_preallocs */ | |
105 NULL, /* instance_init */ | |
106 NULL, /* value table */ | |
107 }; | |
108 type = g_type_register_static (PURPLE_TYPE_THEME_LOADER, | |
109 "PidginIconThemeLoader", | |
110 &info, 0); | |
111 } | |
112 return type; | |
113 } | |
114 | |
115 |