Skip to content

Commit 2170446

Browse files
raveit65raveit65
authored andcommitted
css: Convert to GResource
1 parent fb3abe3 commit 2170446

File tree

8 files changed

+33
-24
lines changed

8 files changed

+33
-24
lines changed

‎configure.ac‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ AC_SUBST(REBUILD)
254254
AC_OUTPUT([
255255
Makefile
256256
data/Makefile
257+
data/theme/Makefile
257258
data/org.mate.panel.gschema.xml
258259
data/org.mate.panel.menubar.gschema.xml
259260
data/org.mate.panel.object.gschema.xml

‎data/Makefile.am‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
SUBDIRS = \
2+
theme
3+
14
layoutdir = $(datadir)/mate-panel/layouts
25
layout_DATA = \
36
default.layout \
@@ -7,11 +10,6 @@ layout_DATA = \
710
opensuse.layout \
811
ubuntu.layout
912

10-
matepaneldir = $(datadir)/mate-panel
11-
matepanel_DATA = \
12-
mate-panel.css \
13-
panel-grid-symbolic.svg
14-
1513
@INTLTOOL_XML_NOMERGE_RULE@
1614

1715
gsettings_ENUM_NAMESPACE = org.mate.panel

‎data/theme/Makefile.am‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
NULL =
2+
3+
EXTRA_DIST = \
4+
mate-panel.css \
5+
panel-grid-symbolic.svg \
6+
$(NULL)
7+
8+
-include $(top_srcdir)/git.mk

‎mate-panel/Makefile.am‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ AM_CPPFLAGS = \
1414
-I$(top_builddir)/mate-panel/libpanel-util \
1515
-DMATELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
1616
-DPANELDATADIR=\""$(datadir)/mate-panel"\" \
17-
-DDATADIR=\""$(datadir)"\" \
1817
$(DISABLE_DEPRECATED_CFLAGS)
1918

2019
AM_CFLAGS = $(WARN_CFLAGS)

‎mate-panel/main.c‎

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ main (int argc, char **argv)
6060
{
6161
char *desktopfile;
6262
GOptionContext *context;
63-
GError *error, *error2;
64-
GtkCssProvider *provider;
63+
GError *error;
64+
GdkScreen *screen;
65+
GtkCssProvider *css;
66+
GtkStyleProvider *provider;
67+
const gchar *resource;
68+
guint priority;
6569

6670
bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
6771
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@@ -167,22 +171,17 @@ main (int argc, char **argv)
167171
* connecting to the session manager */
168172
panel_session_init ();
169173

170-
/*Load a css file from a path so the drag handle image can be loaded*/
171-
error2 = NULL;
172-
provider = gtk_css_provider_new ();
173-
gtk_css_provider_load_from_path (provider,
174-
DATADIR "/mate-panel/" "mate-panel.css", &error2);
175-
176-
if (error2 != NULL) {
177-
g_warning ("Can't parse mate-panel CSS custom description: %s\n", error2->message);
178-
g_error_free (error2);
179-
}
180-
else {
181-
gtk_style_context_add_provider_for_screen (gdk_screen_get_default(),
182-
GTK_STYLE_PROVIDER (provider),
183-
GTK_STYLE_PROVIDER_PRIORITY_FALLBACK);
184-
}
185-
g_object_unref (provider);
174+
/*Load a css file from a GResource so the drag handle image can be loaded*/
175+
screen = gdk_screen_get_default ();
176+
css = gtk_css_provider_new ();
177+
provider = GTK_STYLE_PROVIDER (css);
178+
resource = "/org/mate/panel/theme/mate-panel.css";
179+
priority = GTK_STYLE_PROVIDER_PRIORITY_FALLBACK;
180+
181+
gtk_css_provider_load_from_resource (css, resource);
182+
gtk_style_context_add_provider_for_screen (screen, provider, priority);
183+
184+
g_object_unref (provider);
186185

187186
gtk_main ();
188187

‎mate-panel/panel.gresource.xml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55
<file compressed="true">panel-run-dialog.ui</file>
66
<file alias="anim/wanda.png">../applets/fish/wanda.png</file>
77
</gresource>
8+
<gresource prefix="/org/mate/panel/theme">
9+
<file alias="mate-panel.css">../data/theme/mate-panel.css</file>
10+
<file alias="panel-grid-symbolic.svg">../data/theme/panel-grid-symbolic.svg</file>
11+
</gresource>
812
</gresources>

0 commit comments

Comments
 (0)