pidgin/gtkblist-loader.c

branch
soc.2008.themes
changeset 23658
7a1d0db67fcb
parent 23656
d4acd51c1446
child 23659
8251d0f67df5
equal deleted inserted replaced
23657:41ba956129e0 23658:7a1d0db67fcb
32 *****************************************************************************/ 32 *****************************************************************************/
33 33
34 static gpointer 34 static gpointer
35 pidgin_buddy_list_loader_build(const gchar *dir) 35 pidgin_buddy_list_loader_build(const gchar *dir)
36 { 36 {
37 xmlnode *root_node, *sub_node; 37 xmlnode *root_node, *sub_node, *sub_sub_node;
38 gchar *filename, *filename_full, *data; 38 gchar *filename, *filename_full, *data;
39 const gchar *icon_theme, *bgcolor, *expanded_bgcolor, *minimized_bgcolor, *buddy_bgcolor1, *buddy_bgcolor2;
40 font_color_pair *expanded = g_new0(font_color_pair, 1),
41 *minimized = g_new0(font_color_pair, 1),
42 *online = g_new0(font_color_pair, 1),
43 *away = g_new0(font_color_pair, 1),
44 *offline = g_new0(font_color_pair, 1),
45 *message = g_new0(font_color_pair, 1),
46 *status = g_new0(font_color_pair, 1);
47 gdouble transparency;
48 blist_layout *layout = g_new0(blist_layout, 1);
39 GDir *gdir; 49 GDir *gdir;
40 PidginBuddyListTheme *theme; 50 PidginBuddyListTheme *theme;
41 51
42 /* Find the theme file */ 52 /* Find the theme file */
43 gdir = g_dir_open(dir, 0, NULL); 53 gdir = g_dir_open(dir, 0, NULL);
56 66
57 /* Parse the tree */ 67 /* Parse the tree */
58 sub_node = xmlnode_get_child(root_node, "description"); 68 sub_node = xmlnode_get_child(root_node, "description");
59 data = xmlnode_get_data(sub_node); 69 data = xmlnode_get_data(sub_node);
60 70
71 /* <inon_theme> */
72 sub_node = xmlnode_get_child(root_node, "icon_theme");
73 icon_theme = xmlnode_get_attrib(sub_node, "name");
74
75 /* <buddy_list> */
76 sub_node = xmlnode_get_child(root_node, "buddy_list");
77 bgcolor = xmlnode_get_attrib(sub_node, "color");
78 transparency = atof(xmlnode_get_attrib(sub_node, "transparency"));
79
80 /* <groups> */
81 sub_node = xmlnode_get_child(root_node, "groups");
82 sub_sub_node = xmlnode_get_child(root_node, "expanded");
83 expanded->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
84 expanded->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color"));
85 expanded_bgcolor = g_strdup(xmlnode_get_attrib(sub_sub_node, "background"));
86
87 sub_sub_node = xmlnode_get_child(root_node, "minimized");
88 minimized->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
89 minimized->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color"));
90 minimized_bgcolor = xmlnode_get_attrib(sub_sub_node, "background");
91
92 /* <buddys> */
93 sub_node = xmlnode_get_child(root_node, "buddys");
94 sub_sub_node = xmlnode_get_child(root_node, "placement");
95 layout->buddy_icon = atoi(xmlnode_get_attrib(sub_sub_node, "status_icon"));
96 layout->text = atoi(xmlnode_get_attrib(sub_sub_node, "name"));
97 layout->buddy_icon = atoi(xmlnode_get_attrib(sub_sub_node, "buddy_icon"));
98 layout->protocol_icon = atoi(xmlnode_get_attrib(sub_sub_node, "protocol_icon"));
99 layout->emblem = atoi(xmlnode_get_attrib(sub_sub_node, "emblem"));
100 layout->show_status = (gboolean) atoi(xmlnode_get_attrib(sub_sub_node, "status_icon"));
101
102 sub_sub_node = xmlnode_get_child(root_node, "background");
103 buddy_bgcolor1 = xmlnode_get_attrib(sub_sub_node, "color1");
104 buddy_bgcolor2 = xmlnode_get_attrib(sub_sub_node, "color2");
105
106 sub_sub_node = xmlnode_get_child(root_node, "online_text");
107 online->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
108 online->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color"));
109
110 sub_sub_node = xmlnode_get_child(root_node, "away_text");
111 away->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
112 away->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color"));
113
114 sub_sub_node = xmlnode_get_child(root_node, "offline_text");
115 offline->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
116 offline->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color"));
117
118 sub_sub_node = xmlnode_get_child(root_node, "message_text");
119 message->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
120 message->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color"));
121
122 sub_sub_node = xmlnode_get_child(root_node, "status_text");
123 status->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
124 status->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color"));
125
126 /* the new theme */
61 theme = g_object_new(PIDGIN_TYPE_BUDDY_LIST_THEME, 127 theme = g_object_new(PIDGIN_TYPE_BUDDY_LIST_THEME,
62 "type", "blist", 128 "type", "blist",
63 "name", xmlnode_get_attrib(root_node, "name"), 129 "name", xmlnode_get_attrib(root_node, "name"),
64 "author", xmlnode_get_attrib(root_node, "author"), 130 "author", xmlnode_get_attrib(root_node, "author"),
65 "image", xmlnode_get_attrib(root_node, "image"), 131 "image", xmlnode_get_attrib(root_node, "image"),
66 "directory", dir, 132 "directory", dir,
67 "description", data, NULL); 133 "description", data,
134 "icon-theme", icon_theme,
135 "background-color", bgcolor,
136 "opacity", transparency,
137 "layout", layout,
138 "expanded-color", expanded_bgcolor,
139 "expanded-text", expanded,
140 "minimized-color", minimized_bgcolor,
141 "minimized-text", minimized,
142 "buddy-bgcolor1", buddy_bgcolor1,
143 "buddy-bgcolor2", buddy_bgcolor2,
144 "online", online,
145 "away", away,
146 "offline", offline,
147 "message", message,
148 "status", status, NULL);
68 149
69 xmlnode_free(sub_node); 150 xmlnode_free(sub_node);
70 151
71 xmlnode_free(root_node); 152 xmlnode_free(root_node);
72 g_dir_close(gdir); 153 g_dir_close(gdir);

mercurial