2 * @file theme-manager.h Theme Manager API
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
27 #ifndef PURPLE_THEME_MANAGER_H
28 #define PURPLE_THEME_MANAGER_H
30 #include <glib-object.h>
33 #include "theme-loader.h"
35 typedef void (*PTFunc
) (PurpleTheme
*);
37 typedef struct _PurpleThemeManager PurpleThemeManager
;
38 typedef struct _PurpleThemeManagerClass PurpleThemeManagerClass
;
40 #define PURPLE_TYPE_THEME_MANAGER (purple_theme_manager_get_type())
41 #define PURPLE_THEME_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_THEME_MANAGER, PurpleThemeManager))
42 #define PURPLE_THEME_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_THEME_MANAGER, PurpleThemeManagerClass))
43 #define PURPLE_IS_THEME_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_THEME_MANAGER))
44 #define PURPLE_IS_THEME_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_THEME_MANAGER))
45 #define PURPLE_GET_THEME_MANAGER_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_THEME_MANAGER, PurpleThemeManagerClass))
47 struct _PurpleThemeManager
{
51 struct _PurpleThemeManagerClass
{
52 GObjectClass parent_class
;
55 /**************************************************************************/
56 /** @name Purple Theme Manager API */
57 /**************************************************************************/
65 GType
purple_theme_manager_get_type(void);
68 * Initalizes the theme manager.
70 void purple_theme_manager_init(void);
73 * Uninitalizes the manager then frees all the themes and loaders it is
76 void purple_theme_manager_uninit(void);
79 * Rebuilds all the themes in the theme manager.
80 * (Removes all current themes but keeps the added loaders.)
82 void purple_theme_manager_refresh(void);
85 * Finds the PurpleTheme object stored by the theme manager.
87 * @param name The name of the PurpleTheme.
88 * @param type The type of the PurpleTheme.
90 * @returns The PurpleTheme, or NULL if it wasn't found.
92 PurpleTheme
*purple_theme_manager_find_theme(const gchar
*name
, const gchar
*type
);
95 * Adds a PurpleTheme to the theme manager. If the theme already exists
96 * then this function does nothing.
98 * @param theme The PurpleTheme to add to the manager.
100 void purple_theme_manager_add_theme(PurpleTheme
*theme
);
103 * Removes a PurpleTheme from the theme manager and frees the theme.
105 * @param theme The PurpleTheme to remove from the manager.
107 void purple_theme_manager_remove_theme(PurpleTheme
*theme
);
110 * Adds a loader to the theme manager so it knows how to build themes.
112 * @param loader The PurpleThemeLoader to add.
114 void purple_theme_manager_register_type(PurpleThemeLoader
*loader
);
117 * Removes the loader and all themes of the same type from the loader.
119 * @param loader The PurpleThemeLoader to be removed.
121 void purple_theme_manager_unregister_type(PurpleThemeLoader
*loader
);
124 * Calls the given function on each purple theme.
126 * @param func The PTFunc to be applied to each theme.
128 void purple_theme_manager_for_each_theme(PTFunc func
);
131 * Loads a theme of the given type without adding it to the manager
133 * @param theme_dir the directory of the theme to load
134 * @param type the type of theme to load
136 PurpleTheme
*purple_theme_manager_load_theme(const gchar
*theme_dir
, const gchar
*type
);
139 #endif /* PURPLE_THEME_MANAGER_H */