~cairo-dock-team/ubuntu/oneiric/cairo-dock/2.3.0-3

« back to all changes in this revision

Viewing changes to src/cairo-dock-themes-manager.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20100809232612-pocdxliaxjdetm37
Tags: upstream-2.2.0~0beta4
ImportĀ upstreamĀ versionĀ 2.2.0~0beta4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
* This file is a part of the Cairo-Dock project
3
 
*
4
 
* Copyright : (C) see the 'copyright' file.
5
 
* E-mail    : see the 'copyright' file.
6
 
*
7
 
* This program is free software; you can redistribute it and/or
8
 
* modify it under the terms of the GNU General Public License
9
 
* as published by the Free Software Foundation; either version 3
10
 
* of the License, or (at your option) any later version.
11
 
*
12
 
* This program is distributed in the hope that it will be useful,
13
 
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
* GNU General Public License for more details.
16
 
* You should have received a copy of the GNU General Public License
17
 
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 
*/
19
 
 
20
 
 
21
 
#ifndef __CAIRO_DOCK_THEMES_MANAGER__
22
 
#define  __CAIRO_DOCK_THEMES_MANAGER__
23
 
 
24
 
#include <glib.h>
25
 
#include <gtk/gtk.h>
26
 
G_BEGIN_DECLS
27
 
 
28
 
/**@file cairo-dock-themes-manager.h This class provides a convenient way to use themes.
29
 
* Themes can be :
30
 
*   local   (installed as root in a sub-folder of /usr/share/cairo-dock)
31
 
*   user    (located in a sub-folder of ~/.config/cairo-dock)
32
 
*   distant (located on the cairo-dock's server)
33
 
* The class offers a high level of abstraction that allows to manipulate themes without having to care their location, version, etc.
34
 
*/
35
 
 
36
 
/// Types of themes.
37
 
typedef enum {
38
 
        CAIRO_DOCK_LOCAL_THEME=0,
39
 
        CAIRO_DOCK_USER_THEME,
40
 
        CAIRO_DOCK_DISTANT_THEME,
41
 
        CAIRO_DOCK_NEW_THEME,
42
 
        CAIRO_DOCK_UPDATED_THEME,
43
 
        CAIRO_DOCK_ANY_THEME,
44
 
        CAIRO_DOCK_NB_TYPE_THEME
45
 
} CairoDockThemeType;
46
 
 
47
 
/// Definition of a generic theme.
48
 
struct _CairoDockTheme {
49
 
        /// complete path of the theme.
50
 
        gchar *cThemePath;
51
 
        /// size in Mo
52
 
        gdouble fSize;
53
 
        /// author(s)
54
 
        gchar *cAuthor;
55
 
        /// name of the theme
56
 
        gchar *cDisplayedName;
57
 
        /// type of theme : installed, user, distant.
58
 
        CairoDockThemeType iType;
59
 
        /// rating of the theme, between 1 and 5.
60
 
        gint iRating;
61
 
        /// gint sobriety/simplicity of the theme, between 1 and 5.
62
 
        gint iSobriety;
63
 
        /// date of creation of the theme.
64
 
        gint iCreationDate;
65
 
        /// date of latest changes in the theme.
66
 
        gint iLastModifDate;
67
 
};
68
 
 
69
 
/** Destroy a theme and free all its allocated memory.
70
 
*@param pTheme the theme.
71
 
*/
72
 
void cairo_dock_free_theme (CairoDockTheme *pTheme);
73
 
 
74
 
 
75
 
gchar *cairo_dock_uncompress_file (const gchar *cArchivePath, const gchar *cExtractTo, const gchar *cRealArchiveName);
76
 
 
77
 
/** Download a distant file into a given folder, possibly extracting it.
78
 
*@param cServerAdress adress of the server.
79
 
*@param cDistantFilePath path of the file on the server.
80
 
*@param cDistantFileName name of the file.
81
 
*@param cExtractTo a local path where to extract the file, if this one is a .tar.gz/.tar.bz2/.tgz archive, or NULL.
82
 
*@param erreur an error.
83
 
*@return the local path of the downloaded file. If it was an archive, the path of the extracted file. Free the string after using it.
84
 
*/
85
 
gchar *cairo_dock_download_file (const gchar *cServerAdress, const gchar *cDistantFilePath, const gchar *cDistantFileName, const gchar *cExtractTo, GError **erreur);
86
 
 
87
 
/** Asynchronously download a distant file into a given folder, possibly extracting it. This function is non-blocking, you'll get a CairoTask that you can discard at any time, and you'll get the path of the downloaded file as the first argument of the callback (the second being the data you passed to this function).
88
 
*@param cServerAdress adress of the server.
89
 
*@param cDistantFilePath path of the file on the server.
90
 
*@param cDistantFileName name of the file.
91
 
*@param cExtractTo a local path where to extract the file, if this one is a .tar.gz/.tar.bz2/.tgz archive, or NULL.
92
 
*@param pCallback function called when the download is finished. It takes the path of the downloaded file (it belongs to the task so don't free it) and the data you've set here.
93
 
*@param data data to be passed to the callback.
94
 
*@return the Task that is doing the job. Keep it and use \ref cairo_dock_discard_task whenever you want to discard the download (for instance if the user cancels it).
95
 
*/
96
 
CairoDockTask *cairo_dock_download_file_async (const gchar *cServerAdress, const gchar *cDistantFilePath, const gchar *cDistantFileName, const gchar *cExtractTo, GFunc pCallback, gpointer data);
97
 
 
98
 
/** Retrieve the content of a distant text file.
99
 
*@param cServerAdress adress of the server.
100
 
*@param cDistantFilePath path of the file on the server.
101
 
*@param cDistantFileName name of the file.
102
 
*@param erreur an error.
103
 
*@return the content of the file. Free the string after using it.
104
 
*/
105
 
gchar *cairo_dock_get_distant_file_content (const gchar *cServerAdress, const gchar *cDistantFilePath, const gchar *cDistantFileName, GError **erreur);
106
 
 
107
 
/** Asynchronously retrieve the content of a distant text file. This function is non-blocking, you'll get a CairoTask that you can discard at any time, and you'll get the content of the downloaded file as the first argument of the callback (the second being the data you passed to this function).
108
 
*@param cServerAdress adress of the server.
109
 
*@param cDistantFilePath path of the file on the server.
110
 
*@param cDistantFileName name of the file.
111
 
*@param pCallback function called when the download is finished. It takes the content of the downloaded file (it belongs to the task so don't free it) and the data you've set here.
112
 
*@param data data to be passed to the callback.
113
 
*@return the Task that is doing the job. Keep it and use \ref cairo_dock_discard_task whenever you want to discard the download (for instance if the user cancels it).
114
 
*/
115
 
CairoDockTask *cairo_dock_get_distant_file_content_async (const gchar *cServerAdress, const gchar *cDistantFilePath, const gchar *cDistantFileName, GFunc pCallback, gpointer data);
116
 
 
117
 
 
118
 
GHashTable *cairo_dock_list_local_themes (const gchar *cThemesDir, GHashTable *hProvidedTable, gboolean bUpdateThemeValidity, GError **erreur);
119
 
 
120
 
GHashTable *cairo_dock_list_net_themes (const gchar *cServerAdress, const gchar *cDirectory, const gchar *cListFileName, GHashTable *hProvidedTable, GError **erreur);
121
 
 
122
 
/** Get a list of themes from differente sources.
123
 
*@param cShareThemesDir path of a local folder containg themes or NULL.
124
 
*@param cUserThemesDir path of a user folder containg themes or NULL.
125
 
*@param cDistantThemesDir path of a distant folder containg themes or NULL.
126
 
*@return a hash table of (name, #_CairoDockTheme).
127
 
*/
128
 
GHashTable *cairo_dock_list_themes (const gchar *cShareThemesDir, const gchar *cUserThemesDir, const gchar *cDistantThemesDir);
129
 
 
130
 
/** Asynchronously get a list of themes from differente sources. This function is non-blocking, you'll get a CairoTask that you can discard at any time, and you'll get a hash-table of the themes as the first argument of the callback (the second being the data you passed to this function).
131
 
*@param cShareThemesDir path of a local folder containg themes or NULL.
132
 
*@param cUserThemesDir path of a user folder containg themes or NULL.
133
 
*@param cDistantThemesDir path of a distant folder containg themes or NULL.
134
 
*@param pCallback function called when the listing is finished. It takes the hash-table of the found themes (it belongs to the task so don't free it) and the data you've set here.
135
 
*@param data data to be passed to the callback.
136
 
*@return the Task that is doing the job. Keep it and use \ref cairo_dock_discard_task whenever you want to discard the download (for instance if the user cancels it).*/
137
 
CairoDockTask *cairo_dock_list_themes_async (const gchar *cShareThemesDir, const gchar *cUserThemesDir, const gchar *cDistantThemesDir, GFunc pCallback, gpointer data);
138
 
 
139
 
 
140
 
/** Look for a theme with a given name into differente sources. If the theme is found on the server and is not present on the disk, or is not up to date, then it is downloaded and the local path is returned.
141
 
*@param cThemeName name of the theme.
142
 
*@param cShareThemesDir path of a local folder containg themes or NULL.
143
 
*@param cUserThemesDir path of a user folder containg themes or NULL.
144
 
*@param cDistantThemesDir path of a distant folder containg themes or NULL.
145
 
*@param iGivenType type of theme, or CAIRO_DOCK_ANY_THEME if any type of theme should be considered.
146
 
*@return a newly allocated string containing the complete local path of the theme. If the theme is distant, it is downloaded and extracted into this folder.
147
 
*/
148
 
gchar *cairo_dock_get_theme_path (const gchar *cThemeName, const gchar *cShareThemesDir, const gchar *cUserThemesDir, const gchar *cDistantThemesDir, CairoDockThemeType iGivenType);
149
 
 
150
 
 
151
 
void cairo_dock_mark_theme_as_modified (gboolean bModified);
152
 
gboolean cairo_dock_theme_need_save (void);
153
 
 
154
 
 
155
 
CairoDockThemeType cairo_dock_extract_theme_type_from_name (const gchar *cThemeName);
156
 
 
157
 
/** Export the current theme to a given name. Exported themes can be imported directly from the Theme Manager.
158
 
 * @param cNewThemeName name to export the theme to.
159
 
 * @param bSaveBehavior whether to save the behavior paremeters too.
160
 
 * @param bSaveLaunchers whether to save the launchers too.
161
 
 * @return TRUE if the theme could be exported succefuly.
162
 
 */
163
 
gboolean cairo_dock_export_current_theme (const gchar *cNewThemeName, gboolean bSaveBehavior, gboolean bSaveLaunchers);
164
 
 
165
 
/** Create a package of the current theme. Packages can be distributed easily, and imported into the dock by a mere drag and drop into the Theme Manager. The package is placed in the Home.
166
 
 * @param cThemeName name of the package.
167
 
 * @return TRUE if the theme could be packaged succefuly.
168
 
 */
169
 
gboolean cairo_dock_package_current_theme (const gchar *cThemeName);
170
 
 
171
 
/** Extract a package into the themes folder. Does not load it.
172
 
 * @param cPackagePath path of a package. If the package is distant, it is first downoladed.
173
 
 * @return the path of the theme folder, or NULL if anerror occured.
174
 
 */
175
 
gchar * cairo_dock_depackage_theme (const gchar *cPackagePath);
176
 
 
177
 
/** Remove some exported themes from the hard-disk.
178
 
 * @param cThemesList a list of theme names, NULL-terminated.
179
 
 * @return TRUE if the themes has been succefuly deleted.
180
 
 */
181
 
gboolean cairo_dock_delete_themes (gchar **cThemesList);
182
 
 
183
 
/** Import a theme, which can be : a local theme, a user theme, a distant theme, or even the path to a packaged theme.
184
 
 * @param cThemeName name of the theme to import.
185
 
 * @param bLoadBehavior whether to import the behavior parameters too.
186
 
 * @param bLoadLaunchers whether to import the launchers too.
187
 
 * @return TRUE if the theme could be imported succefuly.
188
 
 */
189
 
gboolean cairo_dock_import_theme (const gchar *cThemeName, gboolean bLoadBehavior, gboolean bLoadLaunchers);
190
 
 
191
 
/** Asynchronously import a theme, which can be : a local theme, a user theme, a distant theme, or even the path to a packaged theme. This function is non-blocking, you'll get a CairoTask that you can discard at any time, and you'll get the result of the import as the first argument of the callback (the second being the data you passed to this function).
192
 
 * @param cThemeName name of the theme to import.
193
 
 * @param bLoadBehavior whether to import the behavior parameters too.
194
 
 * @param bLoadLaunchers whether to import the launchers too.
195
 
 * @param pCallback function called when the download is finished. It takes the result of the import (TRUE for a successful import) and the data you've set here.
196
 
 * @param data data to be passed to the callback.
197
 
 * @return the Task that is doing the job. Keep it and use \ref cairo_dock_discard_task whenever you want to discard the download (for instance if the user cancels it).
198
 
 
199
 
 */
200
 
CairoDockTask *cairo_dock_import_theme_async (const gchar *cThemeName, gboolean bLoadBehavior, gboolean bLoadLaunchers, GFunc pCallback, gpointer data);
201
 
 
202
 
/** Load the current theme. This will (re)load all the parameters of Cairo-Dock and all the plug-ins, as if you just started the dock.
203
 
*/
204
 
void cairo_dock_load_current_theme (void);
205
 
#define cairo_dock_load_theme(...) cairo_dock_load_current_theme ()
206
 
 
207
 
 
208
 
/* Build and show the Theme Manager window.
209
 
 */
210
 
void cairo_dock_manage_themes (void);
211
 
 
212
 
 
213
 
G_END_DECLS
214
 
#endif