libpurple/theme-loader.c

Sun, 10 Aug 2008 03:27:12 +0000

author
Justin Rodriguez <ffdragon@soc.pidgin.im>
date
Sun, 10 Aug 2008 03:27:12 +0000
branch
soc.2008.themes
changeset 23971
9764690b14f2
parent 23970
85dcf9218f63
child 25005
e86ff053dd10
permissions
-rw-r--r--

Changed PurpleTheme build function to only return PurpleTheme*

23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
1 /*
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
2 * ThemeLoaders for LibPurple
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
3 *
b7d99d231b93 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
b7d99d231b93 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
b7d99d231b93 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.
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
7 *
b7d99d231b93 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
b7d99d231b93 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
b7d99d231b93 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
b7d99d231b93 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.
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
12 *
b7d99d231b93 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,
b7d99d231b93 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
b7d99d231b93 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
b7d99d231b93 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.
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
17 *
b7d99d231b93 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
b7d99d231b93 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
b7d99d231b93 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
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
21 *
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
22 */
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
23
b7d99d231b93 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"
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
25
b7d99d231b93 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) \
b7d99d231b93 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))
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
28
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
29 void purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type);
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
30 /******************************************************************************
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
31 * Structs
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
32 *****************************************************************************/
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
33 typedef struct {
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
34 gchar *type;
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
35 } PurpleThemeLoaderPrivate;
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
36
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
37 /******************************************************************************
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
38 * Globals
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
39 *****************************************************************************/
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
40
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
41 static GObjectClass *parent_class = NULL;
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
42
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
43 /******************************************************************************
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
44 * Enums
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
45 *****************************************************************************/
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
46
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
47 enum {
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
48 PROP_ZERO = 0,
b7d99d231b93 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_TYPE,
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
50 };
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
51
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
52 /******************************************************************************
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
53 * GObject Stuff *
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
54 *****************************************************************************/
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
55
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
56 static void
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
57 purple_theme_loader_get_property(GObject *obj, guint param_id, GValue *value,
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
58 GParamSpec *psec)
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
59 {
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
60 PurpleThemeLoader *theme_loader = PURPLE_THEME_LOADER(obj);
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
61
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
62 switch(param_id) {
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
63 case PROP_TYPE:
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
64 g_value_set_string(value, purple_theme_loader_get_type_string(theme_loader));
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
65 default:
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
66 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
67 break;
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
68 }
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
69 }
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
70
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
71 static void
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
72 purple_theme_loader_set_property(GObject *obj, guint param_id, const GValue *value,
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
73 GParamSpec *psec)
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
74 {
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
75 PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
76
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
77 switch(param_id) {
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
78 case PROP_TYPE:
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
79 purple_theme_loader_set_type_string(loader, g_value_get_string(value));
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
80 break;
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
81 default:
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
82 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
83 break;
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
84 }
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
85 }
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
86
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
87 static void
23647
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
88 purple_theme_loader_init(GTypeInstance *instance,
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
89 gpointer klass)
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
90 {
23653
79934bf9a349 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: 23647
diff changeset
91 PurpleThemeLoader *loader = PURPLE_THEME_LOADER(instance);
79934bf9a349 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: 23647
diff changeset
92 loader->priv = g_new0(PurpleThemeLoaderPrivate, 1);
23647
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
93 }
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
94
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
95 static void
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
96 purple_theme_loader_finalize(GObject *obj)
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
97 {
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
98 PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
99 PurpleThemeLoaderPrivate *priv = PURPLE_THEME_LOADER_GET_PRIVATE(loader);
23645
6901039a86fb Fixed purple sound loader class init function (bug on startup) and added shell sound theme selector
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23644
diff changeset
100
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
101 g_free(priv->type);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
102
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
103 parent_class->finalize (obj);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
104 }
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
105
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
106 static void
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
107 purple_theme_loader_class_init (PurpleThemeLoaderClass *klass)
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
108 {
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
109 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
110 GParamSpec *pspec;
23645
6901039a86fb Fixed purple sound loader class init function (bug on startup) and added shell sound theme selector
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23644
diff changeset
111
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
112 parent_class = g_type_class_peek_parent (klass);
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
113
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
114 obj_class->get_property = purple_theme_loader_get_property;
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
115 obj_class->set_property = purple_theme_loader_set_property;
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
116 obj_class->finalize = purple_theme_loader_finalize;
23645
6901039a86fb Fixed purple sound loader class init function (bug on startup) and added shell sound theme selector
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23644
diff changeset
117
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
118 /* TYPE STRING (read only) */
23646
ec4f4e6508b1 fixed some gobject stuff
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23645
diff changeset
119 pspec = g_param_spec_string("type", "Type",
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
120 "The string represtenting the type of the theme",
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
121 NULL,
23646
ec4f4e6508b1 fixed some gobject stuff
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23645
diff changeset
122 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
123 g_object_class_install_property(obj_class, PROP_TYPE, pspec);
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
124 }
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
125
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
126
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
127 GType
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
128 purple_theme_loader_get_type (void)
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
129 {
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
130 static GType type = 0;
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
131 if (type == 0) {
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
132 static const GTypeInfo info = {
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
133 sizeof (PurpleThemeLoaderClass),
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
134 NULL, /* base_init */
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
135 NULL, /* base_finalize */
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
136 (GClassInitFunc)purple_theme_loader_class_init, /* class_init */
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
137 NULL, /* class_finalize */
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
138 NULL, /* class_data */
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
139 sizeof (PurpleThemeLoader),
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
140 0, /* n_preallocs */
23647
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
141 purple_theme_loader_init, /* instance_init */
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
142 NULL, /* value table */
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
143 };
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
144 type = g_type_register_static (G_TYPE_OBJECT,
23647
b856721ba8dd more gobject fixed
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23646
diff changeset
145 "PurpleThemeLoader",
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
146 &info, G_TYPE_FLAG_ABSTRACT);
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
147 }
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
148 return type;
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
149 }
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
150
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
151
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
152 /*****************************************************************************
23640
0d64f321a266 Added skeleton (non-working) sound loader class
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23634
diff changeset
153 * Public API functions
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
154 *****************************************************************************/
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
155
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
156
23653
79934bf9a349 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: 23647
diff changeset
157 const gchar *
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
158 purple_theme_loader_get_type_string (PurpleThemeLoader *theme_loader)
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
159 {
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
160 PurpleThemeLoaderPrivate *priv = NULL;
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
161
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
162 g_return_val_if_fail(PURPLE_IS_THEME_LOADER(theme_loader), NULL);
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
163
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
164 priv = PURPLE_THEME_LOADER_GET_PRIVATE(theme_loader);
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
165 return priv->type;
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
166 }
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
167
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
168 /* < private > */
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
169 void
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
170 purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type)
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
171 {
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
172 PurpleThemeLoaderPrivate *priv;
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
173
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
174 g_return_if_fail(PURPLE_IS_THEME_LOADER(loader));
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
175
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
176 priv = PURPLE_THEME_LOADER_GET_PRIVATE(loader);
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
177
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
178 g_free(priv->type);
23653
79934bf9a349 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: 23647
diff changeset
179 priv->type = g_strdup(type);
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
180 }
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
181
23971
9764690b14f2 Changed PurpleTheme build function to only return PurpleTheme*
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23970
diff changeset
182 PurpleTheme *
23970
85dcf9218f63 fixes initialize icon theme bug by pre-loading the theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23653
diff changeset
183 purple_theme_loader_build(PurpleThemeLoader *loader, const gchar *dir)
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
184 {
23642
ea82d96e4ebd Fixed some things needed for proper gobfication (init/finalize/etc)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23640
diff changeset
185 return PURPLE_THEME_LOADER_GET_CLASS(loader)->purple_theme_loader_build(dir);
23633
b7d99d231b93 Added theme loader class abstract whose only (current/planned) function is to build themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents:
diff changeset
186 }

mercurial