summaryrefslogtreecommitdiff
path: root/src/gui/theme.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-07-22 20:39:36 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-07-22 20:39:36 (GMT)
commit3688ebc981037f6aabea06298aa28dd7c9163894 (patch)
treed0ab50e08247ab46919a85e440d9ca97de8ccc92 /src/gui/theme.c
parent6a8385724c74b07cf9ed4cb9052f1af1816e3ea5 (diff)
Allowed plugins to extend the current theme.
Diffstat (limited to 'src/gui/theme.c')
-rw-r--r--src/gui/theme.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gui/theme.c b/src/gui/theme.c
index dc3d1bb..3ed294a 100644
--- a/src/gui/theme.c
+++ b/src/gui/theme.c
@@ -33,6 +33,7 @@
#include "core/theme.h"
#include "../common/xml.h"
+#include "../plugins/pglist.h"
@@ -393,6 +394,13 @@ static void g_editor_theme_load_section(GEditorTheme *theme, GdkScreen *screen,
void g_editor_theme_load(GEditorTheme *theme, GdkScreen *screen, gboolean dark)
{
+ char **resources; /* Fichiers supplémentaires */
+ size_t count; /* Nombre de ces fichiers */
+ size_t i; /* Boucle de parcours */
+ GtkCssProvider *provider; /* Nouveau fournisseur CSS */
+
+ /* Chargement du thème global courant */
+
g_editor_theme_load_section(theme, screen, dark, "common");
if (dark)
@@ -400,4 +408,28 @@ void g_editor_theme_load(GEditorTheme *theme, GdkScreen *screen, gboolean dark)
else
g_editor_theme_load_section(theme, screen, dark, "light");
+ /* Chargement des thèmes des greffons */
+
+ resources = NULL;
+ count = 0;
+
+ include_plugin_theme(dark, &resources, &count);
+
+ for (i = 0; i < count; i++)
+ {
+ provider = load_css_content(screen, resources[i]);
+
+ if (provider != NULL)
+ {
+ theme->providers = realloc(theme->providers, ++theme->count * sizeof(GtkCssProvider *));
+ theme->providers[theme->count - 1] = provider;
+ }
+
+ free(resources[i]);
+
+ }
+
+ if (resources != NULL)
+ free(resources);
+
}