Mercurial > pidgin.yaz
annotate pidgin/gtkblist-theme-loader.c @ 29943:9cb96fe7e414
propagate from branch 'im.pidgin.pidgin' (head 6d8a9a520e4ea4c291e8e4ddbd59bcdb988f3965)
to branch 'im.pidgin.cpw.rekkanoryo.ggupdate' (head fca920a325e72a4e07459eff26c4b6af242edb99)
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Sat, 06 Mar 2010 16:33:10 +0000 |
parents | 57ae03fdb86f |
children | a8cc50c2279f |
rev | line source |
---|---|
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 /* |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 * GTKBlistThemeLoader for Pidgin |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 * |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 * Pidgin is the legal property of its developers, whose names are too numerous |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 * source distribution. |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 * |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 * |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 * |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 */ |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 |
27298
f1385d462205
Fix win32 compile
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27286
diff
changeset
|
23 #include "internal.h" |
f1385d462205
Fix win32 compile
Daniel Atallah <daniel.atallah@gmail.com>
parents:
27286
diff
changeset
|
24 |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 #include <stdlib.h> |
26636
548871664d3b
PidginBlistTheme now copies all its parameters instead of taking ownership.
Paul Aurich <paul@darkrain42.org>
parents:
26632
diff
changeset
|
26 #include <string.h> |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 #include "xmlnode.h" |
27284
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
29 #include "debug.h" |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
30 #include "util.h" |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 #include "gtkblist-theme-loader.h" |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 #include "gtkblist-theme.h" |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 /****************************************************************************** |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 * Globals |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 *****************************************************************************/ |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
38 |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 #define DEFAULT_TEXT_COLOR "black" |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
40 |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 /***************************************************************************** |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
42 * Buddy List Theme Builder |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 *****************************************************************************/ |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 |
26654
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
45 static PidginThemeFont * |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
46 pidgin_theme_font_parse(xmlnode *node) |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
47 { |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
48 const char *font; |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
49 const char *colordesc; |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
50 GdkColor color; |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
51 |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
52 font = xmlnode_get_attrib(node, "font"); |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
53 |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
54 if ((colordesc = xmlnode_get_attrib(node, "color")) == NULL || |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
55 !gdk_color_parse(colordesc, &color)) |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
56 gdk_color_parse(DEFAULT_TEXT_COLOR, &color); |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
57 |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
58 return pidgin_theme_font_new(font, &color); |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
59 } |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
60 |
29362
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
61 static GdkColor * |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
62 parse_color(xmlnode *node, const char *tag) |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
63 { |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
64 const char *temp = xmlnode_get_attrib(node, tag); |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
65 GdkColor color; |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
66 |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
67 if (temp && gdk_color_parse(temp, &color)) { |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
68 gdk_colormap_alloc_color(gdk_colormap_get_system(), &color, FALSE, TRUE); |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
69 return gdk_color_copy(&color); |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
70 } else { |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
71 return NULL; |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
72 } |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
73 } |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
74 |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 static PurpleTheme * |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 pidgin_blist_loader_build(const gchar *dir) |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 { |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 xmlnode *root_node = NULL, *sub_node, *sub_sub_node; |
27284
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
79 gchar *filename_full, *data = NULL; |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
80 const gchar *temp, *name; |
25389
dc2584ebaa1a
Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <paul@darkrain42.org>
parents:
25268
diff
changeset
|
81 gboolean success = TRUE; |
29362
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
82 GdkColor *bgcolor, *expanded_bgcolor, *collapsed_bgcolor, *contact_color; |
26654
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
83 PidginThemeFont *expanded, *collapsed, *contact, *online, *away, *offline, *idle, *message, *message_nick_said, *status; |
26636
548871664d3b
PidginBlistTheme now copies all its parameters instead of taking ownership.
Paul Aurich <paul@darkrain42.org>
parents:
26632
diff
changeset
|
84 PidginBlistLayout layout; |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 PidginBlistTheme *theme; |
26654
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
86 int i; |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
87 struct { |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
88 const char *tag; |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
89 PidginThemeFont **font; |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
90 } lookups[] = { |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
91 {"contact_text", &contact}, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
92 {"online_text", &online}, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
93 {"away_text", &away}, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
94 {"offline_text", &offline}, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
95 {"idle_text", &idle}, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
96 {"message_text", &message}, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
97 {"message_nick_said_text", &message_nick_said}, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
98 {"status_text", &status}, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
99 {NULL, NULL} |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
100 }; |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 |
29377
57ae03fdb86f
Fix uninitialized use of these colors, now that they're pointers.
Paul Aurich <paul@darkrain42.org>
parents:
29362
diff
changeset
|
102 bgcolor = expanded_bgcolor = collapsed_bgcolor = contact_color = NULL; |
26775
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
103 expanded = NULL; |
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
104 collapsed = NULL; |
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
105 contact = NULL; |
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
106 online = NULL; |
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
107 away = NULL; |
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
108 offline = NULL; |
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
109 idle = NULL; |
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
110 message = NULL; |
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
111 message_nick_said = NULL; |
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
112 status = NULL; |
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
113 |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 /* Find the theme file */ |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 g_return_val_if_fail(dir != NULL, NULL); |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 filename_full = g_build_filename(dir, "theme.xml", NULL); |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
119 root_node = xmlnode_from_file(dir, "theme.xml", "buddy list themes", "blist-loader"); |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 g_free(filename_full); |
27284
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
122 if (root_node == NULL) |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
123 return NULL; |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 sub_node = xmlnode_get_child(root_node, "description"); |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 data = xmlnode_get_data(sub_node); |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 |
27284
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
128 name = xmlnode_get_attrib(root_node, "name"); |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
129 |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 /* <blist> */ |
27284
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
131 success = name && purple_strequal(xmlnode_get_attrib(root_node, "type"), "pidgin buddy list"); |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
132 |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
133 if (!success) |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
134 purple_debug_warning("gtkblist-theme-loader", "Missing attribute or problem with the root element\n"); |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
135 |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
136 if (success) { |
29362
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
137 if ((success = (sub_node = xmlnode_get_child(root_node, "blist")) != NULL)) |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
138 bgcolor = parse_color(sub_node, "color"); |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
139 else |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
140 purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <blist>.\n"); |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 } |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
142 |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
143 /* <groups> */ |
27284
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
144 if (success) { |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
145 if ((success = (sub_node = xmlnode_get_child(root_node, "groups")) != NULL |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
146 && (sub_sub_node = xmlnode_get_child(sub_node, "expanded")) != NULL)) { |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
147 expanded = pidgin_theme_font_parse(sub_sub_node); |
29362
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
148 expanded_bgcolor = parse_color(sub_sub_node, "background"); |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
149 } else |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
150 purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <groups> <expanded>.\n"); |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
151 } |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 |
27284
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
153 if (success) { |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
154 if ((success = sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "collapsed")) != NULL)) { |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
155 collapsed = pidgin_theme_font_parse(sub_sub_node); |
29362
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
156 collapsed_bgcolor = parse_color(sub_sub_node, "background"); |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
157 } else |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
158 purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <groups> <collapsed>.\n"); |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 } |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
161 /* <buddys> */ |
27284
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
162 if (success) { |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
163 if ((success = (sub_node = xmlnode_get_child(root_node, "buddys")) != NULL && |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
164 (sub_sub_node = xmlnode_get_child(sub_node, "placement")) != NULL)) { |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
165 |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
166 layout.status_icon = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) : 0; |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
167 layout.text = (temp = xmlnode_get_attrib(sub_sub_node, "name")) != NULL ? atoi(temp) : 1; |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
168 layout.emblem = (temp = xmlnode_get_attrib(sub_sub_node, "emblem")) != NULL ? atoi(temp) : 2; |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
169 layout.protocol_icon = (temp = xmlnode_get_attrib(sub_sub_node, "protocol_icon")) != NULL ? atoi(temp) : 3; |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
170 layout.buddy_icon = (temp = xmlnode_get_attrib(sub_sub_node, "buddy_icon")) != NULL ? atoi(temp) : 4; |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
171 layout.show_status = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) != 0 : 1; |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
172 |
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
173 } else purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <buddys> <placement>.\n"); |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
174 } |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 |
27284
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
176 if (success) { |
29362
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
177 if ((success = (sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "background")) != NULL))) |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
178 contact_color = parse_color(sub_sub_node, "color"); |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
179 else |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
180 purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <buddys> <background>.\n"); |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
181 } |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
182 |
26654
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
183 for (i = 0; success && lookups[i].tag; i++) { |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
184 if ((success = (sub_node != NULL && |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
185 (sub_sub_node = xmlnode_get_child(sub_node, lookups[i].tag)) != NULL))) { |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
186 *(lookups[i].font) = pidgin_theme_font_parse(sub_sub_node); |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
187 } else { |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
188 *(lookups[i].font) = NULL; |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
189 } |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
190 } |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
191 |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
192 /* name is required for theme manager */ |
25389
dc2584ebaa1a
Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <paul@darkrain42.org>
parents:
25268
diff
changeset
|
193 success = (success && xmlnode_get_attrib(root_node, "name") != NULL); |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
194 |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
195 /* the new theme */ |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
196 theme = g_object_new(PIDGIN_TYPE_BLIST_THEME, |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
197 "type", "blist", |
27284
9ad4b5200f24
Better error checking on the theme loaders.
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
26775
diff
changeset
|
198 "name", name, |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
199 "author", xmlnode_get_attrib(root_node, "author"), |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
200 "image", xmlnode_get_attrib(root_node, "image"), |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
201 "directory", dir, |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
202 "description", data, |
29362
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
203 "background-color", bgcolor, |
26636
548871664d3b
PidginBlistTheme now copies all its parameters instead of taking ownership.
Paul Aurich <paul@darkrain42.org>
parents:
26632
diff
changeset
|
204 "layout", &layout, |
29362
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
205 "expanded-color", expanded_bgcolor, |
26654
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
206 "expanded-text", expanded, |
29362
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
207 "collapsed-color", collapsed_bgcolor, |
26654
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
208 "collapsed-text", collapsed, |
29362
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
209 "contact-color", contact_color, |
26654
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
210 "contact", contact, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
211 "online", online, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
212 "away", away, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
213 "offline", offline, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
214 "idle", idle, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
215 "message", message, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
216 "message_nick_said", message_nick_said, |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
217 "status", status, NULL); |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 |
26654
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
219 for (i = 0; lookups[i].tag; i++) { |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
220 if (*lookups[i].font) { |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
221 pidgin_theme_font_free(*lookups[i].font); |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
222 } |
f099e7f2739c
Several changes:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26636
diff
changeset
|
223 } |
26775
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
224 |
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
225 pidgin_theme_font_free(expanded); |
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
226 pidgin_theme_font_free(collapsed); |
46b1d6eca6ef
Avoid dereferencing unitialized memory or leaking PidginThemeFonts
Paul Aurich <paul@darkrain42.org>
parents:
26654
diff
changeset
|
227 |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
228 xmlnode_free(root_node); |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
229 g_free(data); |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 /* malformed xml file - also frees all partial data*/ |
25389
dc2584ebaa1a
Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <paul@darkrain42.org>
parents:
25268
diff
changeset
|
232 if (!success) { |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
233 g_object_unref(theme); |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
234 theme = NULL; |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
235 } |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 |
29362
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
237 if (bgcolor) |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
238 gdk_color_free(bgcolor); |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
239 if (expanded_bgcolor) |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
240 gdk_color_free(expanded_bgcolor); |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
241 if (collapsed_bgcolor) |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
242 gdk_color_free(collapsed_bgcolor); |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
243 if (contact_color) |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
244 gdk_color_free(contact_color); |
1956b27ed87c
blist theme: Do not treat missing colors as black.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27298
diff
changeset
|
245 |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
246 return PURPLE_THEME(theme); |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
247 } |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
248 |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 /****************************************************************************** |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
250 * GObject Stuff |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
251 *****************************************************************************/ |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 static void |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
254 pidgin_blist_theme_loader_class_init(PidginBlistThemeLoaderClass *klass) |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 { |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
256 PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass); |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
258 loader_klass->purple_theme_loader_build = pidgin_blist_loader_build; |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 } |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
261 GType |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 pidgin_blist_theme_loader_get_type(void) |
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
263 { |
25402
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
264 static GType type = 0; |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
265 if (type == 0) { |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
266 static const GTypeInfo info = { |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
267 sizeof(PidginBlistThemeLoaderClass), |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
268 NULL, /* base_init */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
269 NULL, /* base_finalize */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
270 (GClassInitFunc)pidgin_blist_theme_loader_class_init, /* class_init */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
271 NULL, /* class_finalize */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
272 NULL, /* class_data */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
273 sizeof(PidginBlistThemeLoader), |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
274 0, /* n_preallocs */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
275 NULL, /* instance_init */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
276 NULL, /* value table */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
277 }; |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
278 type = g_type_register_static(PURPLE_TYPE_THEME_LOADER, |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
279 "PidginBlistThemeLoader", &info, 0); |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
280 } |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25389
diff
changeset
|
281 return type; |
25268
7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
282 } |