mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 17:23:15 +02:00
core: add core-theme skeleton and theme registry
Introduce a new module (core-theme.{c,h}) holding the in-memory registry
of built-in themes used by the upcoming /theme command:
- struct t_theme stores name, description, date and weechat version
captured at registration time, plus a hashtable of overrides keyed by
full option name (file.section.option) -> value string.
- theme_register (name, overrides) creates a new theme or merges the
given overrides into an existing one (later calls override duplicate
keys); this is the API plugins and scripts will use to contribute
per-theme color values.
- theme_search and theme_list provide lookup and ordered enumeration.
- theme_init / theme_end are called from weechat_init / weechat_end.
The theme_applying flag is declared here but not yet consumed (it will
gate config_change_color in the next commit to avoid N redundant
window refreshes during /theme apply).
User theme files are not handled by this module: they are read
transiently inside /theme apply (a later commit) and never cached.
This commit is contained in:
@@ -75,6 +75,7 @@
|
||||
#include "core-secure-config.h"
|
||||
#include "core-signal.h"
|
||||
#include "core-string.h"
|
||||
#include "core-theme.h"
|
||||
#include "core-upgrade.h"
|
||||
#include "core-url.h"
|
||||
#include "core-utf8.h"
|
||||
@@ -384,6 +385,7 @@ weechat_init (int argc, char *argv[], void (*gui_init_cb)(void))
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
if (!secure_config_init ()) /* init secured data options (sec.*)*/
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
theme_init (); /* initialize theme registry */
|
||||
if (!config_weechat_init ()) /* init WeeChat options (weechat.*) */
|
||||
weechat_shutdown (EXIT_FAILURE, 0);
|
||||
args_parse (argc, argv); /* parse command line args */
|
||||
@@ -449,6 +451,7 @@ weechat_end (void (*gui_end_cb)(int clean_exit))
|
||||
unhook_all (); /* remove all hooks */
|
||||
hdata_end (); /* end hdata */
|
||||
secure_end (); /* end secured data */
|
||||
theme_end (); /* end theme registry */
|
||||
string_end (); /* end string */
|
||||
weeurl_end ();
|
||||
weechat_shutdown (-1, 0); /* end other things */
|
||||
|
||||
Reference in New Issue
Block a user