config: Introduce method to invalidate theme cache
This will cause the theme configuration to be re-parsed on the next run and whenever E_CFG_VER_CACHE is changed.
This commit is contained in:
parent
ffaf268e62
commit
dccc8cb55b
5
src/E.h
5
src/E.h
|
@ -3,7 +3,7 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||||
* Copyright (C) 2004-2022 Kim Woelders
|
* Copyright (C) 2004-2023 Kim Woelders
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to
|
* of this software and associated documentation files (the "Software"), to
|
||||||
|
@ -33,6 +33,7 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "xtypes.h"
|
#include "xtypes.h"
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -283,6 +284,7 @@ typedef struct {
|
||||||
char animate;
|
char animate;
|
||||||
} startup;
|
} startup;
|
||||||
struct {
|
struct {
|
||||||
|
int cache_ver;
|
||||||
char use_theme_font_cfg;
|
char use_theme_font_cfg;
|
||||||
char use_alt_font_cfg;
|
char use_alt_font_cfg;
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -399,6 +401,7 @@ typedef struct {
|
||||||
char ext_pmap_valid;
|
char ext_pmap_valid;
|
||||||
} root;
|
} root;
|
||||||
struct {
|
struct {
|
||||||
|
bool cache_rebuild;
|
||||||
char *paths;
|
char *paths;
|
||||||
char *path;
|
char *path;
|
||||||
char *variant;
|
char *variant;
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "windowmatch.h"
|
#include "windowmatch.h"
|
||||||
|
|
||||||
#define E_CFG_VER_MAX 2 /* Max. supported theme config version */
|
#define E_CFG_VER_MAX 2 /* Max. supported theme config version */
|
||||||
|
#define E_CFG_VER_CACHE 1 /* Cache version (bump to invalidate cache) */
|
||||||
|
|
||||||
void
|
void
|
||||||
SkipTillEnd(FILE * fs)
|
SkipTillEnd(FILE * fs)
|
||||||
|
@ -529,7 +530,7 @@ ConfigFileFind(const char *name, const char *themepath, int pp)
|
||||||
Esnprintf(s, sizeof(s), "%s/cached/cfg/%s.preparsed", EDirUserCache(), file);
|
Esnprintf(s, sizeof(s), "%s/cached/cfg/%s.preparsed", EDirUserCache(), file);
|
||||||
|
|
||||||
ppfile = Estrdup(s);
|
ppfile = Estrdup(s);
|
||||||
if (exists(s) && moddate(s) > moddate(fullname))
|
if (!Mode.theme.cache_rebuild && exists(s) && moddate(s) > moddate(fullname))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
/* No preparesd file or source is newer. Do preparsing. */
|
/* No preparesd file or source is newer. Do preparsing. */
|
||||||
|
@ -593,6 +594,12 @@ ThemeConfigLoad(void)
|
||||||
Progressbar *p = NULL;
|
Progressbar *p = NULL;
|
||||||
unsigned int i, delay_ms;
|
unsigned int i, delay_ms;
|
||||||
|
|
||||||
|
if (Conf.theme.cache_ver != E_CFG_VER_CACHE)
|
||||||
|
{
|
||||||
|
Mode.theme.cache_rebuild = true;
|
||||||
|
Conf.theme.cache_ver = E_CFG_VER_CACHE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Font mappings */
|
/* Font mappings */
|
||||||
FontConfigLoad();
|
FontConfigLoad();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||||
* Copyright (C) 2004-2021 Kim Woelders
|
* Copyright (C) 2004-2023 Kim Woelders
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to
|
* of this software and associated documentation files (the "Software"), to
|
||||||
|
@ -509,6 +509,7 @@ static const IpcItem ThemeIpcArray[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const CfgItem ThemeCfgItems[] = {
|
static const CfgItem ThemeCfgItems[] = {
|
||||||
|
CFG_ITEM_INT(Conf.theme, cache_ver, 0),
|
||||||
CFG_ITEM_STR(Conf.theme, name),
|
CFG_ITEM_STR(Conf.theme, name),
|
||||||
CFG_ITEM_STR(Conf.theme, extra_path),
|
CFG_ITEM_STR(Conf.theme, extra_path),
|
||||||
CFG_ITEM_BOOL(Conf.theme, use_theme_font_cfg, 0),
|
CFG_ITEM_BOOL(Conf.theme, use_theme_font_cfg, 0),
|
||||||
|
|
Loading…
Reference in New Issue