pidgin/gtkblist-theme-loader.c

Mon, 06 Apr 2020 23:35:44 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 06 Apr 2020 23:35:44 -0500
changeset 40381
bfd6a61974ac
parent 39548
dfd989c8236e
child 40360
e21f3bbcc2a5
permissions
-rw-r--r--

Toggle the enabled status of chat actions based on connected accounts that implement that interface

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
27458
d48df8e69f08 Fix win32 compile
Daniel Atallah <datallah@pidgin.im>
parents: 27446
diff changeset
23 #include "internal.h"
d48df8e69f08 Fix win32 compile
Daniel Atallah <datallah@pidgin.im>
parents: 27446
diff changeset
24
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
25 #include <stdlib.h>
26785
a4411d5d13d1 PidginBlistTheme now copies all its parameters instead of taking ownership.
Paul Aurich <darkrain42@pidgin.im>
parents: 26781
diff changeset
26 #include <string.h>
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
27
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
28 #include "xmlnode.h"
27444
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
29 #include "debug.h"
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
30 #include "util.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
31
24377
8d0bfda8402d renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 23972
diff changeset
32 #include "gtkblist-theme-loader.h"
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
33 #include "gtkblist-theme.h"
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
34
39548
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37992
diff changeset
35 /**
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37992
diff changeset
36 * PidginBlistThemeLoader:
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37992
diff changeset
37 *
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37992
diff changeset
38 * A pidgin buddy list theme loader. extends PurpleThemeLoader (theme-loader.h)
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37992
diff changeset
39 * This is a class designed to build sound themes
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37992
diff changeset
40 */
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37992
diff changeset
41 struct _PidginBlistThemeLoader
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37992
diff changeset
42 {
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37992
diff changeset
43 PurpleThemeLoader parent;
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37992
diff changeset
44 };
dfd989c8236e Use G_DECLARE* for Pidgin theme objects.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37992
diff changeset
45
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
46 /******************************************************************************
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
47 * Globals
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
48 *****************************************************************************/
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
49
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23660
diff changeset
50 #define DEFAULT_TEXT_COLOR "black"
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
51
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
52 /*****************************************************************************
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
53 * 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
54 *****************************************************************************/
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
55
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
56 static PidginThemeFont *
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
57 pidgin_theme_font_parse(PurpleXmlNode *node)
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
58 {
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
59 const char *font;
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
60 const char *colordesc;
37992
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37989
diff changeset
61 GdkRGBA color;
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
62
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
63 font = purple_xmlnode_get_attrib(node, "font");
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
64
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
65 if ((colordesc = purple_xmlnode_get_attrib(node, "color")) == NULL ||
37992
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37989
diff changeset
66 !gdk_rgba_parse(&color, colordesc))
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37989
diff changeset
67 gdk_rgba_parse(&color, DEFAULT_TEXT_COLOR);
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
68
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
69 return pidgin_theme_font_new(font, &color);
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
70 }
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
71
37992
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37989
diff changeset
72 static GdkRGBA *
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
73 parse_color(PurpleXmlNode *node, const char *tag)
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
74 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
75 const char *temp = purple_xmlnode_get_attrib(node, tag);
37992
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37989
diff changeset
76 GdkRGBA color;
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
77
37992
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37989
diff changeset
78 if (temp && gdk_rgba_parse(&color, temp)) {
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37989
diff changeset
79 return gdk_rgba_copy(&color);
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
80 } else {
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
81 return NULL;
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
82 }
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
83 }
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
84
23971
9764690b14f2 Changed PurpleTheme build function to only return PurpleTheme*
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23666
diff changeset
85 static PurpleTheme *
32957
b1967ccba26c Change theme loaders to use the correct subdirectory now that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
86 pidgin_blist_loader_build(const gchar *theme_dir)
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
87 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
88 PurpleXmlNode *root_node = NULL, *sub_node, *sub_sub_node;
32957
b1967ccba26c Change theme loaders to use the correct subdirectory now that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
89 gchar *dir, *filename_full, *data = NULL;
27444
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
90 const gchar *temp, *name;
25863
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 24377
diff changeset
91 gboolean success = TRUE;
37992
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37989
diff changeset
92 GdkRGBA *bgcolor, *expanded_bgcolor, *collapsed_bgcolor, *contact_color;
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
93 PidginThemeFont *expanded, *collapsed, *contact, *online, *away, *offline, *idle, *message, *message_nick_said, *status;
26785
a4411d5d13d1 PidginBlistTheme now copies all its parameters instead of taking ownership.
Paul Aurich <darkrain42@pidgin.im>
parents: 26781
diff changeset
94 PidginBlistLayout layout;
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
95 PidginBlistTheme *theme;
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
96 int i;
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
97 struct {
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
98 const char *tag;
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
99 PidginThemeFont **font;
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
100 } lookups[] = {
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
101 {"contact_text", &contact},
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
102 {"online_text", &online},
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
103 {"away_text", &away},
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
104 {"offline_text", &offline},
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
105 {"idle_text", &idle},
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
106 {"message_text", &message},
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
107 {"message_nick_said_text", &message_nick_said},
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
108 {"status_text", &status},
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
109 {NULL, NULL}
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
110 };
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
111
29308
8de5d48b1581 Fix uninitialized use of these colors, now that they're pointers.
Paul Aurich <darkrain42@pidgin.im>
parents: 29295
diff changeset
112 bgcolor = expanded_bgcolor = collapsed_bgcolor = contact_color = NULL;
26870
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
113 expanded = NULL;
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
114 collapsed = NULL;
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
115 contact = NULL;
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
116 online = NULL;
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
117 away = NULL;
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
118 offline = NULL;
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
119 idle = NULL;
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
120 message = NULL;
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
121 message_nick_said = NULL;
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
122 status = NULL;
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
123
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
124 /* Find the theme file */
32957
b1967ccba26c Change theme loaders to use the correct subdirectory now that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
125 g_return_val_if_fail(theme_dir != NULL, NULL);
b1967ccba26c Change theme loaders to use the correct subdirectory now that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
126 dir = g_build_filename(theme_dir, "purple", "blist", NULL);
23972
90e0da03c053 theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23971
diff changeset
127 filename_full = g_build_filename(dir, "theme.xml", NULL);
90e0da03c053 theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23971
diff changeset
128
90e0da03c053 theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23971
diff changeset
129 if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR))
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
130 root_node = purple_xmlnode_from_file(dir, "theme.xml", "buddy list themes", "blist-loader");
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
131
23972
90e0da03c053 theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23971
diff changeset
132 g_free(filename_full);
32957
b1967ccba26c Change theme loaders to use the correct subdirectory now that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
133 if (root_node == NULL) {
b1967ccba26c Change theme loaders to use the correct subdirectory now that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
134 g_free(dir);
27444
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
135 return NULL;
32957
b1967ccba26c Change theme loaders to use the correct subdirectory now that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
136 }
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
137
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
138 sub_node = purple_xmlnode_get_child(root_node, "description");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
139 data = purple_xmlnode_get_data(sub_node);
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
140
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
141 name = purple_xmlnode_get_attrib(root_node, "name");
27444
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
142
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
143 /* <blist> */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
144 success = name && purple_strequal(purple_xmlnode_get_attrib(root_node, "type"), "pidgin buddy list");
27444
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
145
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
146 if (!success)
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
147 purple_debug_warning("gtkblist-theme-loader", "Missing attribute or problem with the root element\n");
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
148
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
149 if (success) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
150 if ((success = (sub_node = purple_xmlnode_get_child(root_node, "blist")) != NULL))
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
151 bgcolor = parse_color(sub_node, "color");
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 29308
diff changeset
152 else
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
153 purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <blist>.\n");
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
154 }
23658
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
155
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
156 /* <groups> */
27444
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
157 if (success) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
158 if ((success = (sub_node = purple_xmlnode_get_child(root_node, "groups")) != NULL
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
159 && (sub_sub_node = purple_xmlnode_get_child(sub_node, "expanded")) != NULL)) {
27444
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
160 expanded = pidgin_theme_font_parse(sub_sub_node);
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
161 expanded_bgcolor = parse_color(sub_sub_node, "background");
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
162 } else
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
163 purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <groups> <expanded>.\n");
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
164 }
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
165
27444
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
166 if (success) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
167 if ((success = sub_node != NULL && (sub_sub_node = purple_xmlnode_get_child(sub_node, "collapsed")) != NULL)) {
27444
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
168 collapsed = pidgin_theme_font_parse(sub_sub_node);
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
169 collapsed_bgcolor = parse_color(sub_sub_node, "background");
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
170 } else
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
171 purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <groups> <collapsed>.\n");
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
172 }
23658
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
173
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
174 /* <buddys> */
27444
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
175 if (success) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
176 if ((success = (sub_node = purple_xmlnode_get_child(root_node, "buddys")) != NULL &&
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
177 (sub_sub_node = purple_xmlnode_get_child(sub_node, "placement")) != NULL)) {
27444
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
178
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
179 layout.status_icon = (temp = purple_xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) : 0;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
180 layout.text = (temp = purple_xmlnode_get_attrib(sub_sub_node, "name")) != NULL ? atoi(temp) : 1;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
181 layout.emblem = (temp = purple_xmlnode_get_attrib(sub_sub_node, "emblem")) != NULL ? atoi(temp) : 2;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
182 layout.protocol_icon = (temp = purple_xmlnode_get_attrib(sub_sub_node, "protocol_icon")) != NULL ? atoi(temp) : 3;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
183 layout.buddy_icon = (temp = purple_xmlnode_get_attrib(sub_sub_node, "buddy_icon")) != NULL ? atoi(temp) : 4;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
184 layout.show_status = (temp = purple_xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) != 0 : 1;
27444
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
185
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
186 } else purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <buddys> <placement>.\n");
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
187 }
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
188
27444
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
189 if (success) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
190 if ((success = (sub_node != NULL && (sub_sub_node = purple_xmlnode_get_child(sub_node, "background")) != NULL)))
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
191 contact_color = parse_color(sub_sub_node, "color");
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
192 else
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
193 purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <buddys> <background>.\n");
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
194 }
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
195
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
196 for (i = 0; success && lookups[i].tag; i++) {
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
197 if ((success = (sub_node != NULL &&
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
198 (sub_sub_node = purple_xmlnode_get_child(sub_node, lookups[i].tag)) != NULL))) {
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
199 *(lookups[i].font) = pidgin_theme_font_parse(sub_sub_node);
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
200 } else {
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
201 *(lookups[i].font) = NULL;
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
202 }
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
203 }
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
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
205 /* name is required for theme manager */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
206 success = (success && purple_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
207
7a1d0db67fcb build function for pidgin buddy list theme loader
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
208 /* 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
209 theme = g_object_new(PIDGIN_TYPE_BLIST_THEME,
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
210 "type", "blist",
27444
21add455833a Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 26870
diff changeset
211 "name", name,
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
212 "author", purple_xmlnode_get_attrib(root_node, "author"),
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
213 "image", purple_xmlnode_get_attrib(root_node, "image"),
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
214 "directory", dir,
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
215 "description", data,
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
216 "background-color", bgcolor,
26785
a4411d5d13d1 PidginBlistTheme now copies all its parameters instead of taking ownership.
Paul Aurich <darkrain42@pidgin.im>
parents: 26781
diff changeset
217 "layout", &layout,
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
218 "expanded-color", expanded_bgcolor,
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
219 "expanded-text", expanded,
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
220 "collapsed-color", collapsed_bgcolor,
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
221 "collapsed-text", collapsed,
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
222 "contact-color", contact_color,
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
223 "contact", contact,
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
224 "online", online,
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
225 "away", away,
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
226 "offline", offline,
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
227 "idle", idle,
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
228 "message", message,
35060
195dbb3b6432 pidgin: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 34935
diff changeset
229 "message-nick-said", message_nick_said,
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
230 "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
231
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
232 for (i = 0; lookups[i].tag; i++) {
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
233 if (*lookups[i].font) {
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
234 pidgin_theme_font_free(*lookups[i].font);
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
235 }
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
236 }
26870
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
237
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
238 pidgin_theme_font_free(expanded);
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
239 pidgin_theme_font_free(collapsed);
517c90cd1d34 Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <darkrain42@pidgin.im>
parents: 26803
diff changeset
240
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 33170
diff changeset
241 purple_xmlnode_free(root_node);
23972
90e0da03c053 theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23971
diff changeset
242 g_free(data);
32957
b1967ccba26c Change theme loaders to use the correct subdirectory now that the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
243 g_free(dir);
23972
90e0da03c053 theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23971
diff changeset
244
90e0da03c053 theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23971
diff changeset
245 /* malformed xml file - also frees all partial data*/
25863
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 24377
diff changeset
246 if (!success) {
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
247 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
248 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
249 }
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
250
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
251 if (bgcolor)
37992
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37989
diff changeset
252 gdk_rgba_free(bgcolor);
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
253 if (expanded_bgcolor)
37992
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37989
diff changeset
254 gdk_rgba_free(expanded_bgcolor);
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
255 if (collapsed_bgcolor)
37992
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37989
diff changeset
256 gdk_rgba_free(collapsed_bgcolor);
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
257 if (contact_color)
37992
0185eb26ac7d Use GdkRGBA instead of GdkColor.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 37989
diff changeset
258 gdk_rgba_free(contact_color);
29295
42c43b85e294 blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27458
diff changeset
259
23971
9764690b14f2 Changed PurpleTheme build function to only return PurpleTheme*
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23666
diff changeset
260 return PURPLE_THEME(theme);
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
261 }
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
262
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
263 /******************************************************************************
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
264 * GObject Stuff
23656
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 static void
23972
90e0da03c053 theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23971
diff changeset
268 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
269 {
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
270 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
271
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
272 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
273 }
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
274
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
275 GType
23972
90e0da03c053 theme loader cleanup, and remove a few warnings
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23971
diff changeset
276 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
277 {
25875
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
278 static GType type = 0;
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
279 if (type == 0) {
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
280 static const GTypeInfo info = {
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
281 sizeof(PidginBlistThemeLoaderClass),
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
282 NULL, /* base_init */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
283 NULL, /* base_finalize */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
284 (GClassInitFunc)pidgin_blist_theme_loader_class_init, /* class_init */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
285 NULL, /* class_finalize */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
286 NULL, /* class_data */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
287 sizeof(PidginBlistThemeLoader),
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
288 0, /* n_preallocs */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
289 NULL, /* instance_init */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
290 NULL, /* value table */
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
291 };
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
292 type = g_type_register_static(PURPLE_TYPE_THEME_LOADER,
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
293 "PidginBlistThemeLoader", &info, 0);
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
294 }
a98b16817658 Lots of minor whitespace and comment changes:
Mark Doliner <markdoliner@pidgin.im>
parents: 25863
diff changeset
295 return type;
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
296 }

mercurial