From 217044626cf1aef24ff3090d8d8ce4f380f48658 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Mon, 23 Apr 2018 16:46:40 +0200 Subject: css: Convert to GResource --- mate-panel/Makefile.am | 1 - mate-panel/main.c | 35 +++++++++++++++++------------------ mate-panel/panel.gresource.xml | 4 ++++ 3 files changed, 21 insertions(+), 19 deletions(-) (limited to 'mate-panel') diff --git a/mate-panel/Makefile.am b/mate-panel/Makefile.am index 6de930be..836b49e4 100644 --- a/mate-panel/Makefile.am +++ b/mate-panel/Makefile.am @@ -14,7 +14,6 @@ AM_CPPFLAGS = \ -I$(top_builddir)/mate-panel/libpanel-util \ -DMATELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ -DPANELDATADIR=\""$(datadir)/mate-panel"\" \ - -DDATADIR=\""$(datadir)"\" \ $(DISABLE_DEPRECATED_CFLAGS) AM_CFLAGS = $(WARN_CFLAGS) diff --git a/mate-panel/main.c b/mate-panel/main.c index dc136cda..825ec348 100644 --- a/mate-panel/main.c +++ b/mate-panel/main.c @@ -60,8 +60,12 @@ main (int argc, char **argv) { char *desktopfile; GOptionContext *context; - GError *error, *error2; - GtkCssProvider *provider; + GError *error; + GdkScreen *screen; + GtkCssProvider *css; + GtkStyleProvider *provider; + const gchar *resource; + guint priority; bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); @@ -167,22 +171,17 @@ main (int argc, char **argv) * connecting to the session manager */ panel_session_init (); - /*Load a css file from a path so the drag handle image can be loaded*/ - error2 = NULL; - provider = gtk_css_provider_new (); - gtk_css_provider_load_from_path (provider, - DATADIR "/mate-panel/" "mate-panel.css", &error2); - - if (error2 != NULL) { - g_warning ("Can't parse mate-panel CSS custom description: %s\n", error2->message); - g_error_free (error2); - } - else { - gtk_style_context_add_provider_for_screen (gdk_screen_get_default(), - GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_FALLBACK); - } - g_object_unref (provider); + /*Load a css file from a GResource so the drag handle image can be loaded*/ + screen = gdk_screen_get_default (); + css = gtk_css_provider_new (); + provider = GTK_STYLE_PROVIDER (css); + resource = "/org/mate/panel/theme/mate-panel.css"; + priority = GTK_STYLE_PROVIDER_PRIORITY_FALLBACK; + + gtk_css_provider_load_from_resource (css, resource); + gtk_style_context_add_provider_for_screen (screen, provider, priority); + + g_object_unref (provider); gtk_main (); diff --git a/mate-panel/panel.gresource.xml b/mate-panel/panel.gresource.xml index c49541d0..df6396c5 100644 --- a/mate-panel/panel.gresource.xml +++ b/mate-panel/panel.gresource.xml @@ -5,4 +5,8 @@ panel-run-dialog.ui ../applets/fish/wanda.png + + ../data/theme/mate-panel.css + ../data/theme/panel-grid-symbolic.svg + -- cgit v1.2.1