Fri, 11 Jul 2008 19:13:24 +0000
build function for pidgin buddy list theme loader
|
23656
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
1 | /* |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
2 | * GTKBlistThemeLoader for Pidgin |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
3 | * |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
4 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
6 | * source distribution. |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
7 | * |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
11 | * (at your option) any later version. |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
12 | * |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
16 | * GNU General Public License for more details. |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
17 | * |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
21 | * |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
22 | */ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
23 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
24 | #include "gtkblist-loader.h" |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
25 | #include "gtkblist-theme.h" |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
26 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
27 | /****************************************************************************** |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
28 | * Globals |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
29 | *****************************************************************************/ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
30 | /***************************************************************************** |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
31 | * Sound Theme Builder |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
32 | *****************************************************************************/ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
33 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
34 | static gpointer |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
35 | pidgin_buddy_list_loader_build(const gchar *dir) |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
36 | { |
|
23658
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
37 | xmlnode *root_node, *sub_node, *sub_sub_node; |
|
23656
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
38 | gchar *filename, *filename_full, *data; |
|
23658
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
39 | const gchar *icon_theme, *bgcolor, *expanded_bgcolor, *minimized_bgcolor, *buddy_bgcolor1, *buddy_bgcolor2; |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
40 | font_color_pair *expanded = g_new0(font_color_pair, 1), |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
41 | *minimized = g_new0(font_color_pair, 1), |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
42 | *online = g_new0(font_color_pair, 1), |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
43 | *away = g_new0(font_color_pair, 1), |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
44 | *offline = g_new0(font_color_pair, 1), |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
45 | *message = g_new0(font_color_pair, 1), |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
46 | *status = g_new0(font_color_pair, 1); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
47 | gdouble transparency; |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
48 | blist_layout *layout = g_new0(blist_layout, 1); |
|
23656
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
49 | GDir *gdir; |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
50 | PidginBuddyListTheme *theme; |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
51 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
52 | /* Find the theme file */ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
53 | gdir = g_dir_open(dir, 0, NULL); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
54 | g_return_val_if_fail(gdir != NULL, NULL); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
55 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
56 | while ((filename = g_strdup(g_dir_read_name(gdir))) != NULL && ! g_str_has_suffix(filename, ".xml")) |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
57 | g_free(filename); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
58 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
59 | g_return_val_if_fail(filename != NULL, NULL); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
60 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
61 | /* Build the xml tree */ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
62 | filename_full = g_build_filename(dir, filename, NULL); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
63 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
64 | root_node = xmlnode_from_file(dir, filename, "sound themes", "sound-loader"); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
65 | g_return_val_if_fail(root_node != NULL, NULL); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
66 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
67 | /* Parse the tree */ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
68 | sub_node = xmlnode_get_child(root_node, "description"); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
69 | data = xmlnode_get_data(sub_node); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
70 | |
|
23658
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
71 | /* <inon_theme> */ |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
72 | sub_node = xmlnode_get_child(root_node, "icon_theme"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
73 | icon_theme = xmlnode_get_attrib(sub_node, "name"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
74 | |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
75 | /* <buddy_list> */ |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
76 | sub_node = xmlnode_get_child(root_node, "buddy_list"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
77 | bgcolor = xmlnode_get_attrib(sub_node, "color"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
78 | transparency = atof(xmlnode_get_attrib(sub_node, "transparency")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
79 | |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
80 | /* <groups> */ |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
81 | sub_node = xmlnode_get_child(root_node, "groups"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
82 | sub_sub_node = xmlnode_get_child(root_node, "expanded"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
83 | expanded->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
84 | expanded->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
85 | expanded_bgcolor = g_strdup(xmlnode_get_attrib(sub_sub_node, "background")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
86 | |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
87 | sub_sub_node = xmlnode_get_child(root_node, "minimized"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
88 | minimized->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
89 | minimized->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
90 | minimized_bgcolor = xmlnode_get_attrib(sub_sub_node, "background"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
91 | |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
92 | /* <buddys> */ |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
93 | sub_node = xmlnode_get_child(root_node, "buddys"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
94 | sub_sub_node = xmlnode_get_child(root_node, "placement"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
95 | layout->buddy_icon = atoi(xmlnode_get_attrib(sub_sub_node, "status_icon")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
96 | layout->text = atoi(xmlnode_get_attrib(sub_sub_node, "name")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
97 | layout->buddy_icon = atoi(xmlnode_get_attrib(sub_sub_node, "buddy_icon")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
98 | layout->protocol_icon = atoi(xmlnode_get_attrib(sub_sub_node, "protocol_icon")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
99 | layout->emblem = atoi(xmlnode_get_attrib(sub_sub_node, "emblem")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
100 | layout->show_status = (gboolean) atoi(xmlnode_get_attrib(sub_sub_node, "status_icon")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
101 | |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
102 | sub_sub_node = xmlnode_get_child(root_node, "background"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
103 | buddy_bgcolor1 = xmlnode_get_attrib(sub_sub_node, "color1"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
104 | buddy_bgcolor2 = xmlnode_get_attrib(sub_sub_node, "color2"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
105 | |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
106 | sub_sub_node = xmlnode_get_child(root_node, "online_text"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
107 | online->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
108 | online->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
109 | |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
110 | sub_sub_node = xmlnode_get_child(root_node, "away_text"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
111 | away->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
112 | away->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
113 | |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
114 | sub_sub_node = xmlnode_get_child(root_node, "offline_text"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
115 | offline->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
116 | offline->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
117 | |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
118 | sub_sub_node = xmlnode_get_child(root_node, "message_text"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
119 | message->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
120 | message->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
121 | |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
122 | sub_sub_node = xmlnode_get_child(root_node, "status_text"); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
123 | status->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
124 | status->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color")); |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
125 | |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
126 | /* the new theme */ |
|
23656
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
127 | theme = g_object_new(PIDGIN_TYPE_BUDDY_LIST_THEME, |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
128 | "type", "blist", |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
129 | "name", xmlnode_get_attrib(root_node, "name"), |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
130 | "author", xmlnode_get_attrib(root_node, "author"), |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
131 | "image", xmlnode_get_attrib(root_node, "image"), |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
132 | "directory", dir, |
|
23658
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
133 | "description", data, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
134 | "icon-theme", icon_theme, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
135 | "background-color", bgcolor, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
136 | "opacity", transparency, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
137 | "layout", layout, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
138 | "expanded-color", expanded_bgcolor, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
139 | "expanded-text", expanded, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
140 | "minimized-color", minimized_bgcolor, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
141 | "minimized-text", minimized, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
142 | "buddy-bgcolor1", buddy_bgcolor1, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
143 | "buddy-bgcolor2", buddy_bgcolor2, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
144 | "online", online, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
145 | "away", away, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
146 | "offline", offline, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
147 | "message", message, |
|
7a1d0db67fcb
build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
23656
diff
changeset
|
148 | "status", status, NULL); |
|
23656
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
149 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
150 | xmlnode_free(sub_node); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
151 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
152 | xmlnode_free(root_node); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
153 | g_dir_close(gdir); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
154 | g_free(filename_full); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
155 | g_free(data); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
156 | return theme; |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
157 | } |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
158 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
159 | /****************************************************************************** |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
160 | * GObject Stuff |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
161 | *****************************************************************************/ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
162 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
163 | static void |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
164 | pidgin_buddy_list_theme_loader_class_init (PidginBuddyListThemeLoaderClass *klass) |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
165 | { |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
166 | PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
167 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
168 | loader_klass->purple_theme_loader_build = pidgin_buddy_list_loader_build; |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
169 | } |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
170 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
171 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
172 | GType |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
173 | pidgin_buddy_list_theme_loader_get_type (void) |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
174 | { |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
175 | static GType type = 0; |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
176 | if (type == 0) { |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
177 | static const GTypeInfo info = { |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
178 | sizeof (PidginBuddyListThemeLoaderClass), |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
179 | NULL, /* base_init */ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
180 | NULL, /* base_finalize */ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
181 | (GClassInitFunc)pidgin_buddy_list_theme_loader_class_init, /* class_init */ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
182 | NULL, /* class_finalize */ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
183 | NULL, /* class_data */ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
184 | sizeof (PidginBuddyListThemeLoader), |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
185 | 0, /* n_preallocs */ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
186 | NULL, /* instance_init */ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
187 | NULL, /* value table */ |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
188 | }; |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
189 | type = g_type_register_static (PURPLE_TYPE_THEME_LOADER, |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
190 | "PidginBuddyListThemeLoader", |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
191 | &info, 0); |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
192 | } |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
193 | return type; |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
194 | } |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
195 | |
|
d4acd51c1446
start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
196 |