Mercurial > pidgin
annotate libpurple/theme-loader.c @ 31588:06ed9020b784
jabber: Treat empty <group/> elements as "Buddies", not ""
This ultimately led to duplicates in the list, because
we had one entry in the GSList as "", and one as NULL, both of which are
invalid group names, which resulted in the core blithely replacing
them with "Buddies" and generating duplicates.
I've tested with and without, and can reproduce the issues without the change.
Log:
<item subscription='both' name='person' jid='person@example.com'><group></group><group></group></item>
(19:32:23) jabber: jabber_roster_parse(): Removing person@example.com from group 'Buddies' on the local list
(19:32:23) GLib: g_string_append: assertion `val != NULL' failed
(19:32:23) jabber: jabber_roster_parse(): Adding person@example.com to groups: ,
(19:32:23) g_log: purple_find_group: assertion `(name != NULL) && (*name != '\0')' failed
(19:32:23) g_log: purple_group_new: assertion `name != NULL' failed
(19:32:23) g_log: purple_blist_add_group: assertion `group != NULL' failed
(19:32:23) g_log: purple_find_group: assertion `(name != NULL) && (*name != '\0')' failed
(19:32:23) g_log: purple_group_new: assertion `*name != '\0'' failed
(19:32:23) g_log: purple_blist_add_group: assertion `group != NULL' failed
Since I had to look it up, purple_blist_add_buddy replaces (group == NULL) with "Buddies".
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Wed, 11 May 2011 01:58:03 +0000 |
parents | ac1ad1fa5ecf |
children | 4d92a431d0a1 |
rev | line source |
---|---|
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
1 /* |
25911
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
2 * ThemeLoaders for libpurple |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
3 * |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
4 * Pidgin is the legal property of its developers, whose names are too numerous |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
6 * source distribution. |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
7 * |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
11 * (at your option) any later version. |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
12 * |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
17 * |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
21 */ |
25911
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
22 |
25858
1eacf60a73dd
Fix some theme manager assertion failures.
Richard Laager <rlaager@wiktel.com>
parents:
25121
diff
changeset
|
23 #include "internal.h" |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
24 #include "theme-loader.h" |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
25 |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
26 #define PURPLE_THEME_LOADER_GET_PRIVATE(PurpleThemeLoader) \ |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
27 ((PurpleThemeLoaderPrivate *) ((PurpleThemeLoader)->priv)) |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
28 |
25085
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
29 void purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type); |
25911
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
30 |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
31 /****************************************************************************** |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
32 * Structs |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
33 *****************************************************************************/ |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
34 typedef struct { |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
35 gchar *type; |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
36 } PurpleThemeLoaderPrivate; |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
37 |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
38 /****************************************************************************** |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
39 * Globals |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
40 *****************************************************************************/ |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
41 |
25085
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
42 static GObjectClass *parent_class = NULL; |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
43 |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
44 /****************************************************************************** |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
45 * Enums |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
46 *****************************************************************************/ |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
47 |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
48 enum { |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
49 PROP_ZERO = 0, |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
50 PROP_TYPE, |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
51 }; |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
52 |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
53 /****************************************************************************** |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
54 * GObject Stuff * |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
55 *****************************************************************************/ |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
56 |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
57 static void |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
58 purple_theme_loader_get_property(GObject *obj, guint param_id, GValue *value, |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
59 GParamSpec *psec) |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
60 { |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
61 PurpleThemeLoader *theme_loader = PURPLE_THEME_LOADER(obj); |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
62 |
25911
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
63 switch (param_id) { |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
64 case PROP_TYPE: |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
65 g_value_set_string(value, purple_theme_loader_get_type_string(theme_loader)); |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
66 default: |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
67 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
68 break; |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
69 } |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
70 } |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
71 |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
72 static void |
25085
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
73 purple_theme_loader_set_property(GObject *obj, guint param_id, const GValue *value, |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
74 GParamSpec *psec) |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
75 { |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
76 PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj); |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
77 |
25911
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
78 switch (param_id) { |
25085
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
79 case PROP_TYPE: |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
80 purple_theme_loader_set_type_string(loader, g_value_get_string(value)); |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
81 break; |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
82 default: |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
83 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec); |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
84 break; |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
85 } |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
86 } |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
87 |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
88 static void |
25090
5a02912e0bac
more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25089
diff
changeset
|
89 purple_theme_loader_init(GTypeInstance *instance, |
5a02912e0bac
more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25089
diff
changeset
|
90 gpointer klass) |
5a02912e0bac
more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25089
diff
changeset
|
91 { |
25096
fbf72bbd1084
Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25090
diff
changeset
|
92 PurpleThemeLoader *loader = PURPLE_THEME_LOADER(instance); |
fbf72bbd1084
Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25090
diff
changeset
|
93 loader->priv = g_new0(PurpleThemeLoaderPrivate, 1); |
25090
5a02912e0bac
more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25089
diff
changeset
|
94 } |
5a02912e0bac
more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25089
diff
changeset
|
95 |
5a02912e0bac
more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25089
diff
changeset
|
96 static void |
25085
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
97 purple_theme_loader_finalize(GObject *obj) |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
98 { |
25911
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
99 PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj); |
25085
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
100 PurpleThemeLoaderPrivate *priv = PURPLE_THEME_LOADER_GET_PRIVATE(loader); |
25088
9ffbfbcf307d
Fixed purple sound loader class init function (bug on startup) and added shell sound theme selector
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25087
diff
changeset
|
101 |
25085
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
102 g_free(priv->type); |
28441
ac1ad1fa5ecf
Fix another leak. Various iterations of:
Paul Aurich <paul@darkrain42.org>
parents:
28163
diff
changeset
|
103 g_free(priv); |
25085
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
104 |
25911
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
105 parent_class->finalize(obj); |
25085
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
106 } |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
107 |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
108 static void |
25911
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
109 purple_theme_loader_class_init(PurpleThemeLoaderClass *klass) |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
110 { |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
111 GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
112 GParamSpec *pspec; |
25911
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
113 |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
114 parent_class = g_type_class_peek_parent(klass); |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
115 |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
116 obj_class->get_property = purple_theme_loader_get_property; |
25085
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
117 obj_class->set_property = purple_theme_loader_set_property; |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
118 obj_class->finalize = purple_theme_loader_finalize; |
25088
9ffbfbcf307d
Fixed purple sound loader class init function (bug on startup) and added shell sound theme selector
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25087
diff
changeset
|
119 |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
120 /* TYPE STRING (read only) */ |
25089
d60c3d1c6966
fixed some gobject stuff
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25088
diff
changeset
|
121 pspec = g_param_spec_string("type", "Type", |
28163
a444fe876e52
Fix some typos.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
122 "The string representing the type of the theme", |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
123 NULL, |
25089
d60c3d1c6966
fixed some gobject stuff
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25088
diff
changeset
|
124 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
125 g_object_class_install_property(obj_class, PROP_TYPE, pspec); |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
126 } |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
127 |
25911
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
128 GType |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
129 purple_theme_loader_get_type(void) |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
130 { |
25911
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
131 static GType type = 0; |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
132 if (type == 0) { |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
133 static const GTypeInfo info = { |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
134 sizeof(PurpleThemeLoaderClass), |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
135 NULL, /* base_init */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
136 NULL, /* base_finalize */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
137 (GClassInitFunc)purple_theme_loader_class_init, /* class_init */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
138 NULL, /* class_finalize */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
139 NULL, /* class_data */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
140 sizeof(PurpleThemeLoader), |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
141 0, /* n_preallocs */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
142 purple_theme_loader_init, /* instance_init */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
143 NULL, /* value table */ |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
144 }; |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
145 type = g_type_register_static(G_TYPE_OBJECT, |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
146 "PurpleThemeLoader", &info, G_TYPE_FLAG_ABSTRACT); |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
147 } |
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
148 return type; |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
149 } |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
150 |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
151 /***************************************************************************** |
25911
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
152 * Public API functions |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
153 *****************************************************************************/ |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
154 |
25096
fbf72bbd1084
Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25090
diff
changeset
|
155 const gchar * |
25911
0c7b74fc558e
Lots of minor whitespace and comment changes:
Mark Doliner <mark@kingant.net>
parents:
25858
diff
changeset
|
156 purple_theme_loader_get_type_string(PurpleThemeLoader *theme_loader) |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
157 { |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
158 PurpleThemeLoaderPrivate *priv = NULL; |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
159 |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
160 g_return_val_if_fail(PURPLE_IS_THEME_LOADER(theme_loader), NULL); |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
161 |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
162 priv = PURPLE_THEME_LOADER_GET_PRIVATE(theme_loader); |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
163 return priv->type; |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
164 } |
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
165 |
25085
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
166 /* < private > */ |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
167 void |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
168 purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type) |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
169 { |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
170 PurpleThemeLoaderPrivate *priv; |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
171 |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
172 g_return_if_fail(PURPLE_IS_THEME_LOADER(loader)); |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
173 |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
174 priv = PURPLE_THEME_LOADER_GET_PRIVATE(loader); |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
175 |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
176 g_free(priv->type); |
25096
fbf72bbd1084
Fixed up a few typos, readability, leaks, and bugs, all minor and mostly in theme and theme loader classes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25090
diff
changeset
|
177 priv->type = g_strdup(type); |
25085
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
178 } |
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
179 |
25121
b37ccfd1697b
Changed PurpleTheme build function to only return PurpleTheme*
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25120
diff
changeset
|
180 PurpleTheme * |
25120
2d436084d866
fixes initialize icon theme bug by pre-loading the theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25096
diff
changeset
|
181 purple_theme_loader_build(PurpleThemeLoader *loader, const gchar *dir) |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
182 { |
25085
fecc8e2612c4
Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
25083
diff
changeset
|
183 return PURPLE_THEME_LOADER_GET_CLASS(loader)->purple_theme_loader_build(dir); |
25076
68b7691aa3ed
Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff
changeset
|
184 } |