summaryrefslogtreecommitdiff
path: root/src/gui/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/core')
-rw-r--r--src/gui/core/theme.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/gui/core/theme.c b/src/gui/core/theme.c
index 9c3c63b..4b097d0 100644
--- a/src/gui/core/theme.c
+++ b/src/gui/core/theme.c
@@ -180,11 +180,13 @@ static bool look_for_named_theme(GdkScreen *screen, const char *dirname, const c
int ret; /* Bilan d'un appel */
int dirfd; /* Canal de lecture */
struct dirent **namelist; /* Liste des trouvailles */
+ char *css_content; /* Contenu de style cumulé */
int count; /* Nombre de fichiers trouvés */
int i; /* Boucle de parcours */
char *filename; /* Chemin d'accès constitué */
GtkCssProvider *provider; /* Nouveau fournisseur CSS */
GError *error; /* Relevé d'éventuelles erreurs*/
+ char *content; /* Contenu d'une feuille */
result = false;
@@ -209,6 +211,8 @@ static bool look_for_named_theme(GdkScreen *screen, const char *dirname, const c
}
+ css_content = NULL;
+
count = scandirat(dirfd, ".", &namelist, dark ? keep_dark_css_only : keep_css_only, alphasort);
for (i = 0; i < count; i++)
@@ -226,10 +230,11 @@ static bool look_for_named_theme(GdkScreen *screen, const char *dirname, const c
{
log_variadic_message(LMT_INFO, _("Loaded CSS definitions from '%s'"), filename);
- gtk_style_context_add_provider_for_screen(screen, GTK_STYLE_PROVIDER(provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ content = gtk_css_provider_to_string(provider);
- result = true;
+ css_content = stradd(css_content, content);
+
+ free(content);
}
else
@@ -249,6 +254,34 @@ static bool look_for_named_theme(GdkScreen *screen, const char *dirname, const c
close(dirfd);
+ if (css_content != NULL)
+ {
+ provider = gtk_css_provider_new();
+
+ error = NULL;
+
+ gtk_css_provider_load_from_data(provider, css_content, -1, &error);
+
+ if (error == NULL)
+ {
+ gtk_style_context_add_provider_for_screen(screen, GTK_STYLE_PROVIDER(provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+ result = true;
+
+ }
+ else
+ {
+ log_variadic_message(LMT_ERROR, _("Failed to load CSS definitions"));
+ g_error_free(error);
+ }
+
+ free(css_content);
+
+ g_object_unref(G_OBJECT(provider));
+
+ }
+
lfnt_not_found:
free(path);