|
zacw@1739
|
1 |
/** |
|
zacw@2069
|
2 |
* @file theme-manager.h Theme Manager API |
|
zacw@1739
|
3 |
*/ |
|
zacw@1739
|
4 |
|
|
zacw@1739
|
5 |
/* |
|
zacw@1739
|
6 |
* purple |
|
zacw@1739
|
7 |
* |
|
zacw@1739
|
8 |
* Purple is the legal property of its developers, whose names are too numerous |
|
zacw@1739
|
9 |
* to list here. Please refer to the COPYRIGHT file distributed with this |
|
zacw@1739
|
10 |
* source distribution. |
|
zacw@1739
|
11 |
* |
|
zacw@1739
|
12 |
* This program is free software; you can redistribute it and/or modify |
|
zacw@1739
|
13 |
* it under the terms of the GNU General Public License as published by |
|
zacw@1739
|
14 |
* the Free Software Foundation; either version 2 of the License, or |
|
zacw@1739
|
15 |
* (at your option) any later version. |
|
zacw@1739
|
16 |
* |
|
zacw@1739
|
17 |
* This program is distributed in the hope that it will be useful, |
|
zacw@1739
|
18 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
zacw@1739
|
19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
zacw@1739
|
20 |
* GNU General Public License for more details. |
|
zacw@1739
|
21 |
* |
|
zacw@1739
|
22 |
* You should have received a copy of the GNU General Public License |
|
zacw@1739
|
23 |
* along with this program; if not, write to the Free Software |
|
zacw@1739
|
24 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
zacw@1739
|
25 |
*/ |
|
zacw@1739
|
26 |
|
|
zacw@1739
|
27 |
#ifndef PURPLE_THEME_MANAGER_H |
|
zacw@1739
|
28 |
#define PURPLE_THEME_MANAGER_H |
|
zacw@1739
|
29 |
|
|
zacw@1739
|
30 |
#include <glib-object.h> |
|
zacw@1739
|
31 |
#include <glib.h> |
|
zacw@1739
|
32 |
#include "theme.h" |
|
zacw@1739
|
33 |
#include "theme-loader.h" |
|
zacw@1739
|
34 |
|
|
zacw@1739
|
35 |
typedef void (*PTFunc) (PurpleTheme *); |
|
zacw@1739
|
36 |
|
|
zacw@1739
|
37 |
typedef struct _PurpleThemeManager PurpleThemeManager; |
|
zacw@1739
|
38 |
typedef struct _PurpleThemeManagerClass PurpleThemeManagerClass; |
|
zacw@1739
|
39 |
|
|
zacw@1739
|
40 |
#define PURPLE_TYPE_THEME_MANAGER (purple_theme_manager_get_type()) |
|
zacw@1739
|
41 |
#define PURPLE_THEME_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_THEME_MANAGER, PurpleThemeManager)) |
|
zacw@1739
|
42 |
#define PURPLE_THEME_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_THEME_MANAGER, PurpleThemeManagerClass)) |
|
zacw@1739
|
43 |
#define PURPLE_IS_THEME_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_THEME_MANAGER)) |
|
zacw@1739
|
44 |
#define PURPLE_IS_THEME_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_THEME_MANAGER)) |
|
zacw@1739
|
45 |
#define PURPLE_GET_THEME_MANAGER_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_THEME_MANAGER, PurpleThemeManagerClass)) |
|
zacw@1739
|
46 |
|
|
zacw@1739
|
47 |
struct _PurpleThemeManager { |
|
zacw@1739
|
48 |
GObject parent; |
|
zacw@1739
|
49 |
}; |
|
zacw@1739
|
50 |
|
|
zacw@1739
|
51 |
struct _PurpleThemeManagerClass { |
|
zacw@1739
|
52 |
GObjectClass parent_class; |
|
zacw@1739
|
53 |
}; |
|
zacw@1739
|
54 |
|
|
zacw@1739
|
55 |
/**************************************************************************/ |
|
zacw@1739
|
56 |
/** @name Purple Theme Manager API */ |
|
zacw@1739
|
57 |
/**************************************************************************/ |
|
zacw@1739
|
58 |
G_BEGIN_DECLS |
|
zacw@1739
|
59 |
|
|
zacw@1739
|
60 |
/** |
|
zacw@1739
|
61 |
* GObject foo. |
|
zacw@1739
|
62 |
* |
|
zacw@1739
|
63 |
* @internal. |
|
zacw@1739
|
64 |
*/ |
|
zacw@1739
|
65 |
GType purple_theme_manager_get_type(void); |
|
zacw@1739
|
66 |
|
|
zacw@1739
|
67 |
/** |
|
zacw@1739
|
68 |
* Initalizes the theme manager. |
|
zacw@1739
|
69 |
*/ |
|
zacw@1739
|
70 |
void purple_theme_manager_init(void); |
|
zacw@1739
|
71 |
|
|
zacw@1739
|
72 |
/** |
|
zacw@1739
|
73 |
* Uninitalizes the manager then frees all the themes and loaders it is |
|
zacw@1739
|
74 |
* responsible for. |
|
zacw@1739
|
75 |
*/ |
|
zacw@1739
|
76 |
void purple_theme_manager_uninit(void); |
|
zacw@1739
|
77 |
|
|
zacw@1739
|
78 |
/** |
|
zacw@1739
|
79 |
* Rebuilds all the themes in the theme manager. |
|
zacw@1739
|
80 |
* (Removes all current themes but keeps the added loaders.) |
|
zacw@1739
|
81 |
*/ |
|
zacw@1739
|
82 |
void purple_theme_manager_refresh(void); |
|
zacw@1739
|
83 |
|
|
zacw@1739
|
84 |
/** |
|
zacw@1739
|
85 |
* Finds the PurpleTheme object stored by the theme manager. |
|
zacw@1739
|
86 |
* |
|
zacw@1739
|
87 |
* @param name The name of the PurpleTheme. |
|
zacw@1739
|
88 |
* @param type The type of the PurpleTheme. |
|
zacw@1739
|
89 |
* |
|
zacw@1739
|
90 |
* @returns The PurpleTheme, or NULL if it wasn't found. |
|
zacw@1739
|
91 |
*/ |
|
zacw@1739
|
92 |
PurpleTheme *purple_theme_manager_find_theme(const gchar *name, const gchar *type); |
|
zacw@1739
|
93 |
|
|
zacw@1739
|
94 |
/** |
|
zacw@1739
|
95 |
* Adds a PurpleTheme to the theme manager. If the theme already exists |
|
zacw@1739
|
96 |
* then this function does nothing. |
|
zacw@1739
|
97 |
* |
|
zacw@1739
|
98 |
* @param theme The PurpleTheme to add to the manager. |
|
zacw@1739
|
99 |
*/ |
|
zacw@1739
|
100 |
void purple_theme_manager_add_theme(PurpleTheme *theme); |
|
zacw@1739
|
101 |
|
|
zacw@1739
|
102 |
/** |
|
zacw@1739
|
103 |
* Removes a PurpleTheme from the theme manager and frees the theme. |
|
zacw@1739
|
104 |
* |
|
zacw@1739
|
105 |
* @param theme The PurpleTheme to remove from the manager. |
|
zacw@1739
|
106 |
*/ |
|
zacw@1739
|
107 |
void purple_theme_manager_remove_theme(PurpleTheme *theme); |
|
zacw@1739
|
108 |
|
|
zacw@1739
|
109 |
/** |
|
zacw@1739
|
110 |
* Adds a loader to the theme manager so it knows how to build themes. |
|
zacw@1739
|
111 |
* |
|
zacw@1739
|
112 |
* @param loader The PurpleThemeLoader to add. |
|
zacw@1739
|
113 |
*/ |
|
zacw@1739
|
114 |
void purple_theme_manager_register_type(PurpleThemeLoader *loader); |
|
zacw@1739
|
115 |
|
|
zacw@1739
|
116 |
/** |
|
zacw@1739
|
117 |
* Removes the loader and all themes of the same type from the loader. |
|
zacw@1739
|
118 |
* |
|
zacw@1739
|
119 |
* @param loader The PurpleThemeLoader to be removed. |
|
zacw@1739
|
120 |
*/ |
|
zacw@1739
|
121 |
void purple_theme_manager_unregister_type(PurpleThemeLoader *loader); |
|
zacw@1739
|
122 |
|
|
zacw@1739
|
123 |
/** |
|
zacw@1739
|
124 |
* Calls the given function on each purple theme. |
|
zacw@1739
|
125 |
* |
|
zacw@1739
|
126 |
* @param func The PTFunc to be applied to each theme. |
|
zacw@1739
|
127 |
*/ |
|
zacw@1739
|
128 |
void purple_theme_manager_for_each_theme(PTFunc func); |
|
zacw@1739
|
129 |
|
|
zacw@2535
|
130 |
/** |
|
zacw@2535
|
131 |
* Loads a theme of the given type without adding it to the manager |
|
zacw@2535
|
132 |
* |
|
zacw@2535
|
133 |
* @param theme_dir the directory of the theme to load |
|
zacw@2535
|
134 |
* @param type the type of theme to load |
|
zacw@2535
|
135 |
*/ |
|
zacw@2535
|
136 |
PurpleTheme *purple_theme_manager_load_theme(const gchar *theme_dir, const gchar *type); |
|
zacw@2535
|
137 |
|
|
zacw@1739
|
138 |
G_END_DECLS |
|
zacw@1739
|
139 |
#endif /* PURPLE_THEME_MANAGER_H */ |