2
* Themes manager for Cairo-Dock
2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) 2009 by Fabrice Rey
5
* E-mail : fabounet@users.berlios.de
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
7
7
* This program is free software; you can redistribute it and/or
8
8
* modify it under the terms of the GNU General Public License
13
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
15
* GNU General Public License for more details.
16
* http://www.gnu.org/licenses/licenses.html#GPL
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/>.
19
20
#include <string.h>
37
38
#include "cairo-dock-themes-manager.h"
39
40
#define CAIRO_DOCK_MODIFIED_THEME_FILE ".cairo-dock-need-save"
40
#define CAIRO_DOCK_THEME_PANEL_WIDTH 750
41
#define CAIRO_DOCK_THEME_PANEL_HEIGHT 400
41
#define CAIRO_DOCK_THEME_PANEL_WIDTH 1000
42
#define CAIRO_DOCK_THEME_PANEL_HEIGHT 530
42
43
#define CAIRO_DOCK_THEME_SERVER "http://themes.cairo-dock.org"
43
44
#define CAIRO_DOCK_BACKUP_THEME_SERVER "http://fabounet03.free.fr"
44
#define CAIRO_DOCK_PREFIX_NET_THEME "(Net) "
45
#define CAIRO_DOCK_PREFIX_USER_THEME "(User) "
46
#define CAIRO_DOCK_PREFIX_LOCAL_THEME "(Local) "
47
45
#define CAIRO_DOCK_DEFAULT_THEME_LIST_NAME "liste.txt"
48
46
#define CAIRO_DOCK_DL_NB_RETRY 2
49
47
#define CAIRO_DOCK_DL_TIMEOUT 5
54
52
extern gchar *g_cCurrentLaunchersPath;
55
53
extern gchar *g_cMainDockDefaultRendererName;
56
54
extern gchar *g_cThemeServerAdress;
55
extern int g_iMajorVersion, g_iMinorVersion, g_iMicroVersion;
58
57
extern CairoDock *g_pMainDock;
59
58
extern gboolean g_bForceOpenGL;
74
GHashTable *cairo_dock_list_local_themes (const gchar *cThemesDir, GHashTable *hProvidedTable, GError **erreur)
76
cd_message ("%s (%s)", __func__, cThemesDir);
73
static inline int _get_theme_rating (const gchar *cThemesDir, const gchar *cThemeName)
75
gchar *cRatingFile = g_strdup_printf ("%s/.rating/%s", cThemesDir, cThemeName);
78
gchar *cContent = NULL;
79
g_file_get_contents (cRatingFile,
85
iRating = atoi (cContent);
92
GHashTable *cairo_dock_list_local_themes (const gchar *cThemesDir, GHashTable *hProvidedTable, gboolean bUpdateThemeValidity, GError **erreur)
94
g_print ("%s (%s)\n", __func__, cThemesDir);
77
95
GError *tmp_erreur = NULL;
78
96
GDir *dir = g_dir_open (cThemesDir, 0, &tmp_erreur);
79
97
if (tmp_erreur != NULL)
85
103
GHashTable *pThemeTable = (hProvidedTable != NULL ? hProvidedTable : g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) cairo_dock_free_theme));
106
const gchar *cPrefix;
107
if (strncmp (cThemesDir, "/usr", 4) == 0)
109
iType = CAIRO_DOCK_LOCAL_THEME;
110
cPrefix = CAIRO_DOCK_PREFIX_LOCAL_THEME;
114
iType = CAIRO_DOCK_USER_THEME;
115
cPrefix = CAIRO_DOCK_PREFIX_USER_THEME;
118
GString *sRatingFile = g_string_new (cThemesDir);
87
119
gchar *cThemePath;
88
120
const gchar* cThemeName;
89
int iType = (strncmp (cThemesDir, "/usr", 4) == 0 ? 0 : 1);
90
const gchar *cPrefix = (iType == 0 ? CAIRO_DOCK_PREFIX_LOCAL_THEME : CAIRO_DOCK_PREFIX_USER_THEME);
91
123
CairoDockTheme *pTheme;
95
127
if (cThemeName == NULL)
130
if (*cThemeName == '.')
133
// on ecarte les non repertoires.
98
134
cThemePath = g_strdup_printf ("%s/%s", cThemesDir, cThemeName);
99
if (g_file_test (cThemePath, G_FILE_TEST_IS_DIR))
101
pTheme = g_new0 (CairoDockTheme, 1);
102
pTheme->cThemePath = cThemePath;
103
pTheme->cDisplayedName = g_strdup_printf ("%s%s", (cPrefix != NULL ? cPrefix : ""), cThemeName);
104
pTheme->iType = iType;
106
g_hash_table_insert (pThemeTable, g_strdup (cThemeName), pTheme); // donc ecrase un theme installe ayant le meme nom.
135
if (! g_file_test (cThemePath, G_FILE_TEST_IS_DIR))
141
// on recupere la version du theme.
142
//g_print (" referencement du theme local %s...\n", cThemeName);
145
gchar *cVersionFile = g_strdup_printf ("%s/version", cThemePath);
146
if (g_file_test (cVersionFile, G_FILE_TEST_EXISTS))
149
gchar *cContent = NULL;
150
g_file_get_contents (cVersionFile,
156
iVersion = atoi (cContent);
157
bOutdated = (iVersion == 0);
162
// on regarde si on n'ecrase pas un theme de meme nom de version superieure.
163
CairoDockTheme *pSameTheme = g_hash_table_lookup (pThemeTable, cThemeName);
164
if (pSameTheme != NULL)
166
//g_print (" le meme theme existe deja en version %d (<> %d)\n", pSameTheme->iVersion, iVersion);
167
if (pSameTheme->iVersion > iVersion) // on saute ce theme, et on le marque comme obsolete.
169
g_file_set_contents (cVersionFile,
174
g_free (cVersionFile);
175
// par contre on affiche la note que l'utilisateur avait precedemment etablie.
176
int iRating = _get_theme_rating (cThemesDir, cThemeName);
178
pSameTheme->iRating = iRating;
183
if (bOutdated && bUpdateThemeValidity) // theme precedement marque obsolete, mais aucun theme ne l'ecrase => on le rehabilite.
185
g_print (" le theme n'est plus obsolete\n");
187
g_file_set_contents (cVersionFile,
193
g_free (cVersionFile);
195
// on insere le theme dans la table.
196
pTheme = g_new0 (CairoDockTheme, 1);
197
pTheme->cThemePath = cThemePath;
198
pTheme->cDisplayedName = g_strdup_printf ("%s%s", (cPrefix != NULL ? cPrefix : ""), cThemeName);
199
pTheme->iType = iType;
200
pTheme->iVersion = iVersion;
201
pTheme->iRating = _get_theme_rating (cThemesDir, cThemeName);
202
if (pSameTheme != NULL)
203
pTheme->iSobriety = pSameTheme->iSobriety;
204
g_hash_table_insert (pThemeTable, g_strdup (cThemeName), pTheme); // donc ecrase un theme installe ayant le meme nom.
110
207
g_dir_close (dir);
124
221
gchar *cResultPath;
125
gchar *cCommand = g_strdup_printf ("tar xfz \"%s\" -C \"%s\"", cArchivePath, cExtractTo);
222
gchar *cCommand = g_strdup_printf ("tar xf%c \"%s\" -C \"%s\"", (g_str_has_suffix (cArchivePath, "bz2") ? 'j' : 'z'), cArchivePath, cExtractTo);
223
g_print ("tar : %s\n", cCommand);
126
224
int r = system (cCommand);
143
241
if (g_str_has_suffix (cLocalFileName, ".tar.gz"))
144
242
cLocalFileName[strlen(cLocalFileName)-7] = '\0';
243
else if (g_str_has_suffix (cLocalFileName, ".tar.bz2"))
244
cLocalFileName[strlen(cLocalFileName)-8] = '\0';
245
else if (g_str_has_suffix (cLocalFileName, ".tgz"))
246
cLocalFileName[strlen(cLocalFileName)-4] = '\0';
146
248
cResultPath = g_strdup_printf ("%s/%s", cExtractTo, cLocalFileName);
147
249
g_free (cLocalFileName);
268
370
g_propagate_error (erreur, tmp_erreur);
269
371
return hProvidedTable;
271
if (cContent == NULL || (g_bEasterEggs && strncmp (cContent, "#CD", 3) != 0))
373
if (cContent == NULL || strncmp (cContent, "#!CD", 4) != 0) // avec une connexion wifi etablie sur un operateur auquel on ne s'est pas logue, il peut nous renvoyer des messages au lieu de juste rien. On filtre ca par un entete dedie.
273
375
cd_warning ("empty themes list on %s (check that your connection is alive, or retry later)", cServerAdress);
274
376
g_set_error (erreur, 1, 1, "empty themes list on %s", cServerAdress);
281
383
gchar **cNetThemesList = g_strsplit (cContent, "\n", -1);
282
384
g_free (cContent);
386
gchar *cHeader = cNetThemesList[0];
387
if (cHeader[4] != '\n')
389
int iMajorVersion=0, iMinorVersion=0, iMicroVersion=0;
390
cairo_dock_get_version_from_string (cHeader+4, &iMajorVersion, &iMinorVersion, &iMicroVersion);
391
g_print ("%d/%d/%d\n", iMajorVersion, iMinorVersion, iMicroVersion);
392
if (iMajorVersion > g_iMajorVersion ||
393
(iMajorVersion == g_iMajorVersion &&
394
(iMinorVersion > g_iMinorVersion ||
395
(iMinorVersion == g_iMinorVersion && iMicroVersion > g_iMicroVersion))))
397
g_print ("A new version is available !\n>>>\n%s\n<<<\n", cHeader+4);
285
402
gboolean bFirstComment = FALSE;
403
gchar *cThemeName, *str, *str2;
287
404
CairoDockTheme *pTheme = NULL;
288
for (i = 0; cNetThemesList[i] != NULL; i ++)
405
for (i = 1; cNetThemesList[i] != NULL; i ++)
290
407
cThemeName = cNetThemesList[i];
291
if (*cThemeName == '#' || *cThemeName == '\0')
408
if (*cThemeName == '\0')
410
if (*cThemeName == '#')
293
if (*cThemeName == '#' && bFirstComment && pTheme != NULL)
412
if (bFirstComment && pTheme != NULL) // 1er commentaire apres un theme.
295
cd_debug ("+ commentaire : %s", cThemeName+1);
296
pTheme->fSize = g_ascii_strtod (cThemeName+1, NULL);
297
pTheme->cAuthor = g_strdup (strchr (cThemeName, ' '));
414
str = cThemeName+1; // on saute les #
419
cd_debug ("+ commentaire : %s", str);
421
char **pValues = g_strsplit (str, ";", -1);
426
for (i = 0; pValues[i] != NULL; i ++)
432
pTheme->fSize = g_ascii_strtod (cValue, NULL);
435
pTheme->cAuthor = g_strdup (cValue);
438
pTheme->iRating = atoi (cValue);
441
pTheme->iSobriety = atoi (cValue);
444
pTheme->iVersion = atoi (cValue);
448
g_strfreev (pValues);
298
450
gchar *cDisplayedName = g_strdup_printf ("%s by %s [%.2f MB]", pTheme->cDisplayedName, (pTheme->cAuthor ? pTheme->cAuthor : "---"), pTheme->fSize);
299
451
g_free (pTheme->cDisplayedName);
300
452
pTheme->cDisplayedName = cDisplayedName;
303
454
bFirstComment = FALSE;
309
460
pTheme->iType = CAIRO_DOCK_DISTANT_THEME;
310
461
pTheme->cThemePath = g_strdup_printf ("%s/%s/%s", cServerAdress, cDirectory, cThemeName);
311
462
pTheme->cDisplayedName = g_strconcat (CAIRO_DOCK_PREFIX_NET_THEME, cThemeName, NULL);
312
g_hash_table_insert (pThemeTable, cThemeName, pTheme);
463
g_hash_table_insert (pThemeTable, g_strdup (cThemeName), pTheme);
313
464
bFirstComment = TRUE;
317
g_free (cNetThemesList); // car les noms sont passes dans la hashtable.
468
g_strfreev (cNetThemesList);
318
469
return pThemeTable;
330
481
if (erreur != NULL)
332
483
cd_warning ("while loading distant themes in '%s/%s' : %s", g_cThemeServerAdress != NULL ? g_cThemeServerAdress : CAIRO_DOCK_THEME_SERVER, cDistantThemesDir, erreur->message);
484
g_print ("s_pThemeManager:%x\n", s_pThemeManager);
333
485
cairo_dock_set_status_message_printf (s_pThemeManager, _("couldn't get the list of themes for %s (no connection ?)"), cDistantThemesDir);
334
486
g_error_free (erreur);
338
490
//\______________ On recupere les themes pre-installes (qui ecrasent donc les precedents).
339
491
if (cShareThemesDir != NULL)
340
pThemeTable = cairo_dock_list_local_themes (cShareThemesDir, pThemeTable, &erreur);
492
pThemeTable = cairo_dock_list_local_themes (cShareThemesDir, pThemeTable, cDistantThemesDir != NULL, &erreur);
341
493
if (erreur != NULL)
343
495
cd_warning ("while loading pre-installed themes in '%s' : %s", cShareThemesDir, erreur->message);
348
500
//\______________ On recupere les themes utilisateurs (qui ecrasent donc tout le monde).
349
501
if (cUserThemesDir != NULL)
350
pThemeTable = cairo_dock_list_local_themes (cUserThemesDir, pThemeTable, NULL);
502
pThemeTable = cairo_dock_list_local_themes (cUserThemesDir, pThemeTable, cDistantThemesDir != NULL, NULL);
352
504
return pThemeTable;
542
694
if (g_key_file_get_boolean (pKeyFile, "Save", "package", NULL))
544
696
cd_message ("building theme package ...");
545
if (g_file_test (CAIRO_DOCK_SHARE_DATA_DIR"/../../bin/cairo-dock-package-theme.sh", G_FILE_TEST_EXISTS))
697
if (g_file_test (CAIRO_DOCK_SHARE_DATA_DIR"/../../bin/cairo-dock-package-theme", G_FILE_TEST_EXISTS))
547
gchar *cCommand = g_strdup_printf ("$TERM -e '%s \"%s\"'", "cairo-dock-package-theme.sh", cNewThemeName);
699
gchar *cCommand = g_strdup_printf ("$TERM -e '%s \"%s\"'", "cairo-dock-package-theme", cNewThemeName);
548
700
r = system (cCommand);
549
701
g_free (cCommand);
663
815
g_print ("cNewThemeName : '%s'\n", cNewThemeName);
664
816
gchar *cUserThemesDir = g_strdup_printf ("%s/%s", g_cCairoDockDataDir, CAIRO_DOCK_THEMES_DIR);
665
817
gchar *cNewThemePath = NULL;
666
if (g_str_has_suffix (cNewThemeName, ".tar.gz")) // c'est un paquet.
818
if (g_str_has_suffix (cNewThemeName, ".tar.gz") || g_str_has_suffix (cNewThemeName, ".tar.bz2") || g_str_has_suffix (cNewThemeName, ".tgz")) // c'est un paquet.
668
820
g_print ("c'est un paquet\n");
669
821
if (*cNewThemeName == '/' || strncmp (cNewThemeName, "file://", 7) == 0) // paquet en local.
671
823
g_print (" paquet local\n");
672
824
//cairo_dock_remove_html_spaces (cNewThemeName);
673
cNewThemePath = cairo_dock_uncompress_file (*cNewThemeName == '/' ? cNewThemeName : cNewThemeName+7, cUserThemesDir, NULL);
825
gchar *cFilePath = (*cNewThemeName == '/' ? g_strdup (cNewThemeName) : g_filename_from_uri (cNewThemeName, NULL, NULL));
826
cNewThemePath = cairo_dock_uncompress_file (cFilePath, cUserThemesDir, NULL);
675
829
else // paquet distant.
736
890
//\___________________ On charge les icones.
737
891
gchar *cNewLocalIconsPath = g_strdup_printf ("%s/%s", cNewThemePath, CAIRO_DOCK_LOCAL_ICONS_DIR);
738
if (! g_file_test (cNewLocalIconsPath, G_FILE_TEST_IS_DIR)) // c'est un ancien theme, mettons-le vite a jour !
740
g_string_printf (sCommand, "sed -i \"s/~\\/.cairo-dock/~\\/.config\\/%s/g\" '%s/%s/%s'", CAIRO_DOCK_DATA_DIR, g_cCairoDockDataDir, CAIRO_DOCK_CURRENT_THEME_NAME, CAIRO_DOCK_CONF_FILE);
741
cd_message ("%s", sCommand->str);
742
r = system (sCommand->str);
744
g_string_printf (sCommand, "sed -i \"/default icon directory/ { s/~\\/.config\\/%s\\/%s\\/icons/%s/g }\" '%s/%s'", CAIRO_DOCK_DATA_DIR, CAIRO_DOCK_CURRENT_THEME_NAME, CAIRO_DOCK_LOCAL_THEME_KEYWORD, g_cCurrentThemePath, CAIRO_DOCK_CONF_FILE);
745
cd_message ("%s", sCommand->str);
746
r = system (sCommand->str);
748
g_string_printf (sCommand, "sed -i \"s/_ThemeDirectory_/%s/g\" '%s/%s'", CAIRO_DOCK_LOCAL_THEME_KEYWORD, g_cCurrentThemePath, CAIRO_DOCK_CONF_FILE);
749
cd_message ("%s", sCommand->str);
750
r = system (sCommand->str);
892
if (! g_file_test (cNewLocalIconsPath, G_FILE_TEST_IS_DIR)) // c'est un ancien theme, on deplace les icones vers le repertoire 'icons'.
752
894
g_string_printf (sCommand, "find '%s/%s' -mindepth 1 ! -name '*.desktop' -exec /bin/cp '{}' '%s/%s' \\;", cNewThemePath, CAIRO_DOCK_LAUNCHERS_DIR, g_cCurrentThemePath, CAIRO_DOCK_LOCAL_ICONS_DIR);
775
917
//\___________________ On charge les lanceurs si necessaire, en effacant ceux existants.
918
if (! g_file_test (g_cCurrentLaunchersPath, G_FILE_TEST_EXISTS))
920
gchar *command = g_strdup_printf ("mkdir -p '%s'", g_cCurrentLaunchersPath);
921
r = system (command);
776
924
if (g_pMainDock == NULL || g_key_file_get_boolean (pKeyFile, "Themes", "use theme launchers", NULL))
778
926
g_string_printf (sCommand, "rm -f '%s'/*.desktop", g_cCurrentLaunchersPath);
800
g_string_printf (sCommand, "find '%s' -mindepth 1 ! -name '*.conf' ! -path '%s/%s*' ! -type d -exec cp -p {} '%s' \\;", cNewThemePath, cNewThemePath, CAIRO_DOCK_LAUNCHERS_DIR, g_cCurrentThemePath); // copie tous les fichiers du nouveau theme sauf les lanceurs et les .conf du dock et des plug-ins.
948
// on copie tous les fichiers du nouveau theme sauf les lanceurs et les .conf (dock et plug-ins).
949
g_string_printf (sCommand, "find '%s' -mindepth 1 ! -name '*.conf' ! -path '%s/%s*' ! -type d -exec cp -p {} '%s' \\;", cNewThemePath, cNewThemePath, CAIRO_DOCK_LAUNCHERS_DIR, g_cCurrentThemePath);
801
950
cd_message (sCommand->str);
802
951
r = system (sCommand->str);
804
gchar *cNewPlugInsDir = g_strdup_printf ("%s/%s", cNewThemePath, "plug-ins");
953
// on parcours les .conf des plug-ins, on les met a jour, et on fusionne avec le theme courant.
954
gchar *cNewPlugInsDir = g_strdup_printf ("%s/%s", cNewThemePath, "plug-ins"); // repertoire des plug-ins du nouveau theme.
805
955
GDir *dir = g_dir_open (cNewPlugInsDir, 0, NULL); // NULL si ce theme n'a pas de repertoire 'plug-ins'.
806
956
const gchar* cModuleDirName;
807
957
gchar *cConfFilePath, *cNewConfFilePath, *cUserDataDirPath, *cConfFileName;
810
cModuleDirName = g_dir_read_name (dir);
960
cModuleDirName = g_dir_read_name (dir); // nom du repertoire du theme (pas forcement egal au nom du theme)
811
961
if (cModuleDirName == NULL)
814
/*CairoDockModule *pModule = cairo_dock_find_module_from_name (cModuleName);
815
if (pModule == NULL || pModule->pVisitCard == NULL)
964
// on cree le repertoire du plug-in dans le theme courant.
818
965
cd_debug (" installing %s's config\n", cModuleDirName);
819
cUserDataDirPath = g_strdup_printf ("%s/plug-ins/%s", g_cCurrentThemePath, cModuleDirName);
966
cUserDataDirPath = g_strdup_printf ("%s/plug-ins/%s", g_cCurrentThemePath, cModuleDirName); // repertoire du plug-in dans le theme courant.
820
967
if (! g_file_test (cUserDataDirPath, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
822
969
cd_debug (" directory %s doesn't exist, it will be created.", cUserDataDirPath);
826
973
g_free (command);
976
// on recupere le nom et le chemin du .conf du plug-in dans le nouveau theme.
829
977
cConfFileName = g_strdup_printf ("%s.conf", cModuleDirName);
830
978
cNewConfFilePath = g_strdup_printf ("%s/%s/%s", cNewPlugInsDir, cModuleDirName, cConfFileName);
831
979
if (! g_file_test (cNewConfFilePath, G_FILE_TEST_EXISTS))
833
981
g_free (cConfFileName);
834
982
g_free (cNewConfFilePath);
835
CairoDockModule *pModule = cairo_dock_foreach_module ((GHRFunc) _find_module_from_user_data_dir, cModuleDirName);
983
CairoDockModule *pModule = cairo_dock_foreach_module ((GHRFunc) _find_module_from_user_data_dir, (gpointer) cModuleDirName);
836
984
if (pModule == NULL) // du coup, dans ce cas-la, on ne charge pas des plug-ins non utilises par l'utilisateur.
838
986
cd_warning ("couldn't find the module owning '%s', this file will be ignored.");
841
989
cConfFileName = g_strdup (pModule->pVisitCard->cConfFileName);
842
990
cNewConfFilePath = g_strdup_printf ("%s/%s/%s", cNewPlugInsDir, cModuleDirName, cConfFileName);
844
cConfFilePath = g_strdup_printf ("%s/%s", cUserDataDirPath, cConfFileName);
992
cConfFilePath = g_strdup_printf ("%s/%s", cUserDataDirPath, cConfFileName); // chemin du .conf dans le theme courant.
994
// on met a jour le .conf du nouveau theme.
995
/*GError *erreur = NULL;
996
GKeyFile *pKeyFile = cairo_dock_open_key_file (cInstanceConfFilePath);
997
if (pKeyFile == NULL)
1000
gboolean bNeedsUpgrade = cairo_dock_conf_file_needs_update (pKeyFile, pModule->pVisitCard->cModuleVersion);
1003
cairo_dock_flush_conf_file (pKeyFile, cInstanceConfFilePath, pModule->pVisitCard->cShareDataDir, pModule->pVisitCard->cConfFileName);
1004
g_key_file_free (pKeyFile);
1005
pKeyFile = cairo_dock_open_key_file (cInstanceConfFilePath);
1006
if (pKeyFile == NULL)
1009
// on fusionne les 2 .conf.
846
1010
if (! g_file_test (cConfFilePath, G_FILE_TEST_EXISTS))
848
1012
cd_debug (" no conf file %s, we will take the theme's one", cConfFilePath);
887
1051
gchar *cInitConfFile = cairo_dock_build_temporary_themes_conf_file (); // sera supprime a la destruction de la fenetre.
889
1053
//\___________________ On laisse l'utilisateur l'editer.
890
gchar *cPresentedGroup = (cairo_dock_theme_need_save () ? "Save" : NULL);
1054
const gchar *cPresentedGroup = (cairo_dock_theme_need_save () ? "Save" : NULL);
891
1055
const gchar *cTitle = _("Manage Themes");
893
1057
cairo_dock_build_normal_gui (cInitConfFile,
909
1073
if (cUserThemesDir != NULL)
911
1075
cThemePath = g_strdup_printf ("%s/%s", cUserThemesDir, cThemeName);
912
1077
if (g_file_test (cThemePath, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
1079
gboolean bOutdated = FALSE;
1080
gchar *cVersionFile = g_strdup_printf ("%s/version", cThemePath);
1081
if (g_file_test (cVersionFile, G_FILE_TEST_EXISTS))
1084
gchar *cContent = NULL;
1085
g_file_get_contents (cVersionFile,
1091
int iVersion = atoi (cContent);
1092
bOutdated = (iVersion == 0);
913
1097
return cThemePath;
914
1100
g_free (cThemePath);
915
1101
cThemePath = NULL;
917
1104
if (cShareThemesDir != NULL)
919
1106
cThemePath = g_strdup_printf ("%s/%s", cShareThemesDir, cThemeName);