pidgin/gtkblist-loader.c

Fri, 01 Aug 2008 17:04:49 +0000

author
Justin Rodriguez <ffdragon@soc.pidgin.im>
date
Fri, 01 Aug 2008 17:04:49 +0000
branch
soc.2008.themes
changeset 23666
a36697aac125
parent 23665
c9944e9b97e1
child 23971
9764690b14f2
permissions
-rw-r--r--

fixed some small font bugs, the coloring when selected, and a segfault

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
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
24 #include <stdlib.h>
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
25
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
26 #include "xmlnode.h"
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
27
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
28 #include "gtkblist-loader.h"
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
29 #include "gtkblist-theme.h"
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 /******************************************************************************
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
32 * Globals
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
33 *****************************************************************************/
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23660
diff changeset
34 #define DEFAULT_TEXT_COLOR "black"
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
35 /*****************************************************************************
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
36 * Buddy List Theme Builder
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
37 *****************************************************************************/
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
38
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
39 static gpointer
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
40 pidgin_blist_loader_build(const gchar *dir)
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
41 {
23658
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
42 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
43 gchar *filename, *filename_full, *data;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
44 const gchar *icon_theme = NULL, *temp;
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
45 gboolean sucess = TRUE;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
46 GdkColor *bgcolor, *expanded_bgcolor, *collapsed_bgcolor, *contact_color;
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23660
diff changeset
47 GdkColor color;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
48 FontColorPair *expanded, *collapsed, *contact, *online, *away, *offline, *idle, *message, *status;
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23660
diff changeset
49 PidginBlistLayout *layout;
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
50 GDir *gdir;
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
51 PidginBlistTheme *theme;
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
52
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
53 /* Find the theme file */
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
54 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
55 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
56
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
57 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
58 g_free(filename);
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
59
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
60 if (filename == NULL){
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
61 g_dir_close(gdir);
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
62 return NULL;
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
63 }
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
64
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
65 /* Build the xml tree */
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
66 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
67
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
68 root_node = xmlnode_from_file(dir, filename, "blist themes", "blist-loader");
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
69 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
70
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23660
diff changeset
71 /* init all structs and colors */
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
72 bgcolor = g_new0(GdkColor, 1);
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
73 expanded_bgcolor = g_new0(GdkColor, 1);
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
74 collapsed_bgcolor = g_new0(GdkColor, 1);
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23660
diff changeset
75
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23660
diff changeset
76 layout = g_new0(PidginBlistLayout, 1);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23660
diff changeset
77
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
78 contact_color = g_new0(GdkColor, 1);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
79
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
80 expanded = g_new0(FontColorPair, 1);
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
81 collapsed = g_new0(FontColorPair, 1);
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
82 contact = g_new0(FontColorPair, 1);
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
83 online = g_new0(FontColorPair, 1);
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
84 away = g_new0(FontColorPair, 1);
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
85 offline = g_new0(FontColorPair, 1);
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
86 idle = g_new0(FontColorPair, 1);
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23660
diff changeset
87 message = g_new0(FontColorPair, 1);
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
88 status = g_new0(FontColorPair, 1);
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
89
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
90 /* Parse the tree */
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
91 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
92 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
93
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
94 /* <icon_theme> */
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
95 if ((sucess = (sub_node = xmlnode_get_child(root_node, "icon_theme")) != NULL))
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
96 icon_theme = xmlnode_get_attrib(sub_node, "name");
23658
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
97
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
98 /* <blist> */
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
99 if ((sucess = sucess && (sub_node = xmlnode_get_child(root_node, "blist")) != NULL)) {
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
100 if ((temp = xmlnode_get_attrib(sub_node, "color")) != NULL && gdk_color_parse(temp, bgcolor))
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
101 gdk_colormap_alloc_color(gdk_colormap_get_system(), bgcolor, FALSE, TRUE);
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
102 else {
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
103 g_free(bgcolor);
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
104 bgcolor = NULL;
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
105 }
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
106 }
23658
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
107
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
108 /* <groups> */
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
109 if ((sucess = sucess && (sub_node = xmlnode_get_child(root_node, "groups")) != NULL
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
110 && (sub_sub_node = xmlnode_get_child(sub_node, "expanded")) != NULL)) {
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
111
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
112 expanded->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
113
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
114 if ((temp = xmlnode_get_attrib(sub_sub_node, "text_color")) != NULL && gdk_color_parse(temp, &color))
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
115 expanded->color = g_strdup(temp);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
116 else expanded->color = g_strdup(DEFAULT_TEXT_COLOR);
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
117
23658
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
118
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
119 if ((temp = xmlnode_get_attrib(sub_sub_node, "background")) != NULL && gdk_color_parse(temp, expanded_bgcolor))
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
120 gdk_colormap_alloc_color(gdk_colormap_get_system(), expanded_bgcolor, FALSE, TRUE);
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
121 else {
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
122 g_free(expanded_bgcolor);
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
123 expanded_bgcolor = NULL;
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
124 }
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
125 }
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
126
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
127 if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "collapsed")) != NULL)) {
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
128
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
129 collapsed->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
130
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
131 if((temp = xmlnode_get_attrib(sub_sub_node, "text_color")) != NULL && gdk_color_parse(temp, &color))
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
132 collapsed->color = g_strdup(temp);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
133 else collapsed->color = g_strdup(DEFAULT_TEXT_COLOR);
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23660
diff changeset
134
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
135 if ((temp = xmlnode_get_attrib(sub_sub_node, "background")) != NULL && gdk_color_parse(temp, collapsed_bgcolor))
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
136 gdk_colormap_alloc_color(gdk_colormap_get_system(), collapsed_bgcolor, FALSE, TRUE);
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
137 else {
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
138 g_free(collapsed_bgcolor);
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
139 collapsed_bgcolor = NULL;
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
140 }
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
141 }
23658
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
142
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
143 /* <buddys> */
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
144 if ((sucess = sucess && (sub_node = xmlnode_get_child(root_node, "buddys")) != NULL &&
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
145 (sub_sub_node = xmlnode_get_child(sub_node, "placement")) != NULL)) {
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
146
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
147 layout->status_icon = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) : 0;
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
148 layout->text = (temp = xmlnode_get_attrib(sub_sub_node, "name")) != NULL ? atoi(temp) : 1;
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
149 layout->emblem = (temp = xmlnode_get_attrib(sub_sub_node, "emblem")) != NULL ? atoi(temp) : 2;
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
150 layout->protocol_icon = (temp = xmlnode_get_attrib(sub_sub_node, "protocol_icon")) != NULL ? atoi(temp) : 3;
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
151 layout->buddy_icon = (temp = xmlnode_get_attrib(sub_sub_node, "buddy_icon")) != NULL ? atoi(temp) : 4;
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
152 layout->show_status = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) != 0 : 1;
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
153 }
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
154
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
155 if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "background")) != NULL)) {
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
156 if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), contact_color))
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
157 gdk_colormap_alloc_color(gdk_colormap_get_system(), contact_color, FALSE, TRUE);
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
158 else {
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
159 g_free(contact_color);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
160 contact_color = NULL;
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
161 }
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
162 }
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
163
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
164 if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "contact_text")) != NULL)) {
23666
a36697aac125 fixed some small font bugs, the coloring when selected, and a segfault
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23665
diff changeset
165 contact->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
166 if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color))
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
167 contact->color = g_strdup(temp);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
168 else contact->color = g_strdup(DEFAULT_TEXT_COLOR);
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
169 }
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
170
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
171 if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "online_text")) != NULL)) {
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
172 online->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
173 if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color))
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
174 online->color = g_strdup(temp);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
175 else online->color = g_strdup(DEFAULT_TEXT_COLOR);
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
176 }
23658
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
177
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
178 if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "away_text")) != NULL)) {
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
179 away->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
180 if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color))
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
181 away->color = g_strdup(temp);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
182 else away->color = g_strdup(DEFAULT_TEXT_COLOR);
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
183 }
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
184
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
185 if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "offline_text")) != NULL)) {
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
186 offline->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
187 if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color))
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
188 online->color = g_strdup(temp);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
189 else online->color = g_strdup(DEFAULT_TEXT_COLOR);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
190 }
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
191
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
192 if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "idle_text")) != NULL)) {
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
193 idle->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
194 if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color))
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
195 idle->color = g_strdup(temp);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
196 else online->color = g_strdup(DEFAULT_TEXT_COLOR);
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
197 }
23658
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
198
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
199 if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "message_text")) != NULL)) {
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
200 message->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
201 if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color))
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
202 message->color = g_strdup(temp);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
203 else message->color = g_strdup(DEFAULT_TEXT_COLOR);
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
204 }
23658
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
205
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
206 if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "status_text")) != NULL)) {
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
207 status->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
208 if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color))
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
209 status->color = g_strdup(temp);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
210 else status->color = g_strdup(DEFAULT_TEXT_COLOR);
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
211 }
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
212
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
213 /* name is required for theme manager */
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
214 sucess = sucess && xmlnode_get_attrib(root_node, "name") != NULL;
23658
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
215
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
216 /* the new theme */
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
217 theme = g_object_new(PIDGIN_TYPE_BLIST_THEME,
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
218 "type", "blist",
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
219 "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
220 "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
221 "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
222 "directory", dir,
23658
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
223 "description", data,
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
224 "icon-theme", icon_theme,
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
225 "background-color", bgcolor,
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
226 "layout", layout,
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
227 "expanded-color", expanded_bgcolor,
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
228 "expanded-text", expanded,
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
229 "collapsed-color", collapsed_bgcolor,
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
230 "collapsed-text", collapsed,
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
231 "contact-color", contact_color,
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
232 "contact", contact,
23658
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
233 "online", online,
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
234 "away", away,
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
235 "offline", offline,
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
236 "idle", idle,
23658
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
237 "message", message,
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
238 "status", status, NULL);
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
239
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
240 /* malformed xml file */
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
241 if (!sucess) {
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
242 g_object_unref(theme);
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
243 theme = NULL;
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
244 }
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23663
diff changeset
245
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
246 xmlnode_free(sub_node);
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
247 xmlnode_free(root_node);
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
248 g_dir_close(gdir);
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
249 g_free(filename_full);
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
250 g_free(data);
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
251 return theme;
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
252 }
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
253
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
254 /******************************************************************************
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
255 * GObject Stuff
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
256 *****************************************************************************/
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
257
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
258 static void
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
259 pidgin_blist_theme_loader_class_init (PidginBlistThemeLoaderClass *klass)
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
260 {
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
261 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
262
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
263 loader_klass->purple_theme_loader_build = pidgin_blist_loader_build;
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
264 }
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
265
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
266
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
267 GType
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
268 pidgin_blist_theme_loader_get_type (void)
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
269 {
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
270 static GType type = 0;
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
271 if (type == 0) {
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
272 static const GTypeInfo info = {
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
273 sizeof (PidginBlistThemeLoaderClass),
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
274 NULL, /* base_init */
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
275 NULL, /* base_finalize */
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
276 (GClassInitFunc)pidgin_blist_theme_loader_class_init, /* class_init */
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
277 NULL, /* class_finalize */
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
278 NULL, /* class_data */
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
279 sizeof (PidginBlistThemeLoader),
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
280 0, /* n_preallocs */
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
281 NULL, /* instance_init */
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
282 NULL, /* value table */
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
283 };
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
284 type = g_type_register_static (PURPLE_TYPE_THEME_LOADER,
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23658
diff changeset
285 "PidginBlistThemeLoader",
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
286 &info, 0);
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
287 }
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
288 return type;
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
289 }
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
290
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
291

mercurial