diff options
| author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2014-02-11 19:13:06 +0100 |
|---|---|---|
| committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2014-02-11 19:14:13 +0100 |
| commit | 478def9f72f2564eb82ff088985dd761839db41b (patch) | |
| tree | faa07bff1ea48fbcd0cefd04bfa14ed373005006 /shell | |
| parent | c54ba7f7aa44f79f55519e565ab7581fc97739d8 (diff) | |
| download | graynard-478def9f72f2564eb82ff088985dd761839db41b.tar.gz graynard-478def9f72f2564eb82ff088985dd761839db41b.zip | |
css: add new style css file and put it into gresources
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/Makefile.am | 15 | ||||
| -rw-r--r-- | shell/gtk-shell.c | 30 | ||||
| -rw-r--r-- | shell/style.css | 0 | ||||
| -rw-r--r-- | shell/weston-gtk-shell.gresource.xml | 6 |
4 files changed, 50 insertions, 1 deletions
diff --git a/shell/Makefile.am b/shell/Makefile.am index 4b73361..dfbf2eb 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -23,6 +23,8 @@ weston_gtk_shell_SOURCES = \ shell-app-system.h \ sound-applet.c \ sound-applet.h \ + weston-gtk-shell-resources.c \ + weston-gtk-shell-resources.h \ desktop-shell-client-protocol.h \ desktop-shell-protocol.c \ $(external_sources) @@ -30,7 +32,18 @@ weston_gtk_shell_LDADD = $(GTK_LIBS) BUILT_SOURCES = \ desktop-shell-client-protocol.h \ - desktop-shell-protocol.c + desktop-shell-protocol.c \ + weston-gtk-shell-resources.c \ + weston-gtk-shell-resources.h + +# gresource for css +resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/weston-gtk-shell.gresource.xml) +weston-gtk-shell-resources.c: weston-gtk-shell.gresource.xml $(resource_files) + $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name weston_gtk_shell $< +weston-gtk-shell-resources.h: weston-gtk-shell.gresource.xml $(resource_files) + $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name weston_gtk_shell $< + +EXTRA_DIST = style.css CLEANFILES = $(BUILT_SOURCES) diff --git a/shell/gtk-shell.c b/shell/gtk-shell.c index 2bad3c1..935178f 100644 --- a/shell/gtk-shell.c +++ b/shell/gtk-shell.c @@ -5,6 +5,9 @@ #include <gdk/gdkwayland.h> #include "desktop-shell-client-protocol.h" + +#include "weston-gtk-shell-resources.h" + #include "clock.h" #include "favorites.h" #include "launcher-grid.h" @@ -226,6 +229,30 @@ background_create(struct desktop *desktop) } static void +css_setup(struct desktop *desktop) +{ + GtkCssProvider *provider; + GFile *file; + GError *error = NULL; + + provider = gtk_css_provider_new (); + + file = g_file_new_for_uri ("resource:///org/raspberry-pi/weston-gtk-shell/style.css"); + + if (!gtk_css_provider_load_from_file (provider, file, &error)) { + g_warning ("Failed to load CSS file: %s", error->message); + g_clear_error (&error); + g_object_unref (file); + return; + } + + gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), + GTK_STYLE_PROVIDER (provider), 600); + + g_object_unref (file); +} + +static void registry_handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version) { @@ -263,6 +290,8 @@ main(int argc, char *argv[]) gtk_init(&argc, &argv); + g_resources_register (weston_gtk_shell_get_resource ()); + desktop = malloc(sizeof *desktop); desktop->output = NULL; desktop->shell = NULL; @@ -284,6 +313,7 @@ main(int argc, char *argv[]) while (!desktop->output || !desktop->shell) wl_display_roundtrip (desktop->display); + css_setup(desktop); panel_create(desktop); launcher_grid_create (desktop); background_create(desktop); diff --git a/shell/style.css b/shell/style.css new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/shell/style.css diff --git a/shell/weston-gtk-shell.gresource.xml b/shell/weston-gtk-shell.gresource.xml new file mode 100644 index 0000000..4bd0744 --- /dev/null +++ b/shell/weston-gtk-shell.gresource.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource prefix="/org/raspberry-pi/weston-gtk-shell"> + <file compressed="true">style.css</file> + </gresource> +</gresources> |
