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
));
68 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj
, param_id
, psec
);
74 purple_theme_loader_set_property(GObject
*obj
, guint param_id
, const GValue
*value
,
77 PurpleThemeLoader
*loader
= PURPLE_THEME_LOADER(obj
);
81 purple_theme_loader_set_type_string(loader
, g_value_get_string(value
));
84 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj
, param_id
, psec
);
90 purple_theme_loader_init(GTypeInstance
*instance
,
93 PurpleThemeLoader
*loader
= PURPLE_THEME_LOADER(instance
);
94 loader
->priv
= g_new0(PurpleThemeLoaderPrivate
, 1);
98 purple_theme_loader_finalize(GObject
*obj
)
100 PurpleThemeLoader
*loader
= PURPLE_THEME_LOADER(obj
);
101 PurpleThemeLoaderPrivate
*priv
= PURPLE_THEME_LOADER_GET_PRIVATE(loader
);
106 parent_class
->finalize(obj
);
110 purple_theme_loader_class_init(PurpleThemeLoaderClass
*klass
)
112 GObjectClass
*obj_class
= G_OBJECT_CLASS(klass
);
115 parent_class
= g_type_class_peek_parent(klass
);
117 obj_class
->get_property
= purple_theme_loader_get_property
;
118 obj_class
->set_property
= purple_theme_loader_set_property
;
119 obj_class
->finalize
= purple_theme_loader_finalize
;
121 /* TYPE STRING (read only) */
122 pspec
= g_param_spec_string("type", "Type",
123 "The string representing the type of the theme",
125 G_PARAM_READWRITE
| G_PARAM_CONSTRUCT_ONLY
);
126 g_object_class_install_property(obj_class
, PROP_TYPE
, pspec
);
130 purple_theme_loader_get_type(void)
132 static GType type
= 0;
134 static const GTypeInfo info
= {
135 sizeof(PurpleThemeLoaderClass
),
136 NULL
, /* base_init */
137 NULL
, /* base_finalize */
138 (GClassInitFunc
)purple_theme_loader_class_init
, /* class_init */
139 NULL
, /* class_finalize */
140 NULL
, /* class_data */
141 sizeof(PurpleThemeLoader
),
143 purple_theme_loader_init
, /* instance_init */
144 NULL
, /* value table */
146 type
= g_type_register_static(G_TYPE_OBJECT
,
147 "PurpleThemeLoader", &info
, G_TYPE_FLAG_ABSTRACT
);
152 /*****************************************************************************
153 * Public API functions
154 *****************************************************************************/
157 purple_theme_loader_get_type_string(PurpleThemeLoader
*theme_loader
)
159 PurpleThemeLoaderPrivate
*priv
= NULL
;
161 g_return_val_if_fail(PURPLE_IS_THEME_LOADER(theme_loader
), NULL
);
163 priv
= PURPLE_THEME_LOADER_GET_PRIVATE(theme_loader
);
169 purple_theme_loader_set_type_string(PurpleThemeLoader
*loader
, const gchar
*type
)
171 PurpleThemeLoaderPrivate
*priv
;
173 g_return_if_fail(PURPLE_IS_THEME_LOADER(loader
));
175 priv
= PURPLE_THEME_LOADER_GET_PRIVATE(loader
);
178 priv
->type
= g_strdup(type
);
182 purple_theme_loader_build(PurpleThemeLoader
*loader
, const gchar
*dir
)
184 return PURPLE_THEME_LOADER_GET_CLASS(loader
)->purple_theme_loader_build(dir
);