2 * ThemeLoaders for libpurple
4 * Pidgin is the legal property of its developers, whose names are too numerous
5 * to list here. Please refer to the COPYRIGHT file distributed with this
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
24 #include "theme-loader.h"
26 #define PURPLE_THEME_LOADER_GET_PRIVATE(PurpleThemeLoader) \
27 ((PurpleThemeLoaderPrivate *) ((PurpleThemeLoader)->priv))
29 void purple_theme_loader_set_type_string(PurpleThemeLoader
*loader
, const gchar
*type
);
31 /******************************************************************************
33 *****************************************************************************/
36 } PurpleThemeLoaderPrivate
;
38 /******************************************************************************
40 *****************************************************************************/
42 static GObjectClass
*parent_class
= NULL
;
44 /******************************************************************************
46 *****************************************************************************/
53 /******************************************************************************
55 *****************************************************************************/
58 purple_theme_loader_get_property(GObject
*obj
, guint param_id
, GValue
*value
,
61 PurpleThemeLoader
*theme_loader
= PURPLE_THEME_LOADER(obj
);
65 g_value_set_string(value
, purple_theme_loader_get_type_string(theme_loader
));
67 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj
, param_id
, psec
);
73 purple_theme_loader_set_property(GObject
*obj
, guint param_id
, const GValue
*value
,
76 PurpleThemeLoader
*loader
= PURPLE_THEME_LOADER(obj
);
80 purple_theme_loader_set_type_string(loader
, g_value_get_string(value
));
83 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj
, param_id
, psec
);
89 purple_theme_loader_init(GTypeInstance
*instance
,
92 PurpleThemeLoader
*loader
= PURPLE_THEME_LOADER(instance
);
93 loader
->priv
= g_new0(PurpleThemeLoaderPrivate
, 1);
97 purple_theme_loader_finalize(GObject
*obj
)
99 PurpleThemeLoader
*loader
= PURPLE_THEME_LOADER(obj
);
100 PurpleThemeLoaderPrivate
*priv
= PURPLE_THEME_LOADER_GET_PRIVATE(loader
);
105 parent_class
->finalize(obj
);
109 purple_theme_loader_class_init(PurpleThemeLoaderClass
*klass
)
111 GObjectClass
*obj_class
= G_OBJECT_CLASS(klass
);
114 parent_class
= g_type_class_peek_parent(klass
);
116 obj_class
->get_property
= purple_theme_loader_get_property
;
117 obj_class
->set_property
= purple_theme_loader_set_property
;
118 obj_class
->finalize
= purple_theme_loader_finalize
;
120 /* TYPE STRING (read only) */
121 pspec
= g_param_spec_string("type", "Type",
122 "The string representing the type of the theme",
124 G_PARAM_READWRITE
| G_PARAM_CONSTRUCT_ONLY
);
125 g_object_class_install_property(obj_class
, PROP_TYPE
, pspec
);
129 purple_theme_loader_get_type(void)
131 static GType type
= 0;
133 static const GTypeInfo info
= {
134 sizeof(PurpleThemeLoaderClass
),
135 NULL
, /* base_init */
136 NULL
, /* base_finalize */
137 (GClassInitFunc
)purple_theme_loader_class_init
, /* class_init */
138 NULL
, /* class_finalize */
139 NULL
, /* class_data */
140 sizeof(PurpleThemeLoader
),
142 purple_theme_loader_init
, /* instance_init */
143 NULL
, /* value table */
145 type
= g_type_register_static(G_TYPE_OBJECT
,
146 "PurpleThemeLoader", &info
, G_TYPE_FLAG_ABSTRACT
);
151 /*****************************************************************************
152 * Public API functions
153 *****************************************************************************/
156 purple_theme_loader_get_type_string(PurpleThemeLoader
*theme_loader
)
158 PurpleThemeLoaderPrivate
*priv
= NULL
;
160 g_return_val_if_fail(PURPLE_IS_THEME_LOADER(theme_loader
), NULL
);
162 priv
= PURPLE_THEME_LOADER_GET_PRIVATE(theme_loader
);
168 purple_theme_loader_set_type_string(PurpleThemeLoader
*loader
, const gchar
*type
)
170 PurpleThemeLoaderPrivate
*priv
;
172 g_return_if_fail(PURPLE_IS_THEME_LOADER(loader
));
174 priv
= PURPLE_THEME_LOADER_GET_PRIVATE(loader
);
177 priv
->type
= g_strdup(type
);
181 purple_theme_loader_build(PurpleThemeLoader
*loader
, const gchar
*dir
)
183 return PURPLE_THEME_LOADER_GET_CLASS(loader
)->purple_theme_loader_build(dir
);