[gnome-shell] theme: make a GResource



commit 49c4ba5656b13c055d37699151aaee196c52cfff
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Sep 18 19:24:46 2014 -0700

    theme: make a GResource
    
    Now that we have all the infrastructure ready, port the theme to a
    GResource.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736936

 .gitignore                           |    1 +
 data/Makefile.am                     |   50 +++++++---------------------------
 data/gnome-shell-theme.gresource.xml |   41 +++++++++++++++++++++++++++
 js/gdm/authPrompt.js                 |    2 +-
 js/ui/background.js                  |    2 +-
 js/ui/main.js                        |    5 +++-
 js/ui/modalDialog.js                 |    2 +-
 js/ui/status/network.js              |    2 +-
 8 files changed, 60 insertions(+), 45 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e0147ae..bd6eb74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,7 @@ data/gnome-shell-wayland.desktop
 data/gnome-shell-wayland.desktop.in
 data/gnome-shell-extension-prefs.desktop
 data/gnome-shell-extension-prefs.desktop.in
+data/gnome-shell-theme.gresource
 data/gschemas.compiled
 data/perf-background.xml
 data/org.gnome.shell.gschema.xml
diff --git a/data/Makefile.am b/data/Makefile.am
index 65f948a..de27d8e 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -35,44 +35,11 @@ introspection_DATA =                                \
        org.gnome.ShellSearchProvider.xml       \
        org.gnome.ShellSearchProvider2.xml
 
-themedir = $(pkgdatadir)/theme
-dist_theme_DATA =                              \
-       theme/calendar-arrow-left.svg           \
-       theme/calendar-arrow-right.svg          \
-       theme/calendar-today.svg                \
-       theme/checkbox-focused.svg              \
-       theme/checkbox-off-focused.svg          \
-       theme/checkbox-off.svg                  \
-       theme/checkbox.svg                      \
-       theme/close-window.svg                  \
-       theme/close.svg                         \
-       theme/corner-ripple-ltr.png             \
-       theme/corner-ripple-rtl.png             \
-       theme/dash-placeholder.svg              \
-       theme/filter-selected-ltr.svg           \
-       theme/filter-selected-rtl.svg           \
-       theme/gnome-shell.css                   \
-       theme/logged-in-indicator.svg           \
-       theme/message-tray-background.png       \
-       theme/more-results.svg                  \
-       theme/noise-texture.png                 \
-       theme/page-indicator-active.svg         \
-       theme/page-indicator-inactive.svg       \
-       theme/page-indicator-checked.svg        \
-       theme/page-indicator-hover.svg          \
-       theme/panel-button-border.svg           \
-       theme/panel-button-highlight-narrow.svg \
-       theme/panel-button-highlight-wide.svg   \
-       theme/process-working.svg               \
-       theme/running-indicator.svg             \
-       theme/source-button-border.svg          \
-       theme/summary-counter.svg               \
-       theme/toggle-off-us.svg                 \
-       theme/toggle-off-intl.svg               \
-       theme/toggle-on-us.svg                  \
-       theme/toggle-on-intl.svg                \
-       theme/ws-switch-arrow-up.png            \
-       theme/ws-switch-arrow-down.png
+resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir)/theme --generate-dependencies 
$(srcdir)/gnome-shell-theme.gresource.xml)
+gnome-shell-theme.gresource: gnome-shell-theme.gresource.xml $(resource_files)
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/theme $<
+resourcedir = $(pkgdatadir)
+resource_DATA = gnome-shell-theme.gresource
 
 backgrounddir = $(pkgdatadir)
 background_DATA = perf-background.xml
@@ -116,7 +83,9 @@ EXTRA_DIST =                                         \
        perf-background.xml.in                          \
        org.gnome.Shell.PortalHelper.desktop.in         \
        org.gnome.Shell.PortalHelper.service.in         \
-       org.gnome.shell.gschema.xml.in.in
+       org.gnome.shell.gschema.xml.in.in               \
+       gnome-shell-theme.gresource.xml                 \
+       $(resource_files)
 
 CLEANFILES +=                                          \
        gnome-shell.desktop.in                          \
@@ -128,4 +97,5 @@ CLEANFILES +=                                                \
        perf-background.xml                             \
        gschemas.compiled                               \
        org.gnome.shell.gschema.valid                   \
-       org.gnome.shell.gschema.xml.in
+       org.gnome.shell.gschema.xml.in                  \
+       gnome-shell-theme.gresource
diff --git a/data/gnome-shell-theme.gresource.xml b/data/gnome-shell-theme.gresource.xml
new file mode 100644
index 0000000..d473494
--- /dev/null
+++ b/data/gnome-shell-theme.gresource.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/shell/theme">
+    <file>calendar-arrow-left.svg</file>
+    <file>calendar-arrow-right.svg</file>
+    <file>calendar-today.svg</file>
+    <file>checkbox-focused.svg</file>
+    <file>checkbox-off-focused.svg</file>
+    <file>checkbox-off.svg</file>
+    <file>checkbox.svg</file>
+    <file>close-window.svg</file>
+    <file>close.svg</file>
+    <file>corner-ripple-ltr.png</file>
+    <file>corner-ripple-rtl.png</file>
+    <file>dash-placeholder.svg</file>
+    <file>filter-selected-ltr.svg</file>
+    <file>filter-selected-rtl.svg</file>
+    <file>gnome-shell.css</file>
+    <file>logged-in-indicator.svg</file>
+    <file>message-tray-background.png</file>
+    <file>more-results.svg</file>
+    <file>noise-texture.png</file>
+    <file>page-indicator-active.svg</file>
+    <file>page-indicator-inactive.svg</file>
+    <file>page-indicator-checked.svg</file>
+    <file>page-indicator-hover.svg</file>
+    <file>panel-button-border.svg</file>
+    <file>panel-button-highlight-narrow.svg</file>
+    <file>panel-button-highlight-wide.svg</file>
+    <file>process-working.svg</file>
+    <file>running-indicator.svg</file>
+    <file>source-button-border.svg</file>
+    <file>summary-counter.svg</file>
+    <file>toggle-off-us.svg</file>
+    <file>toggle-off-intl.svg</file>
+    <file>toggle-on-us.svg</file>
+    <file>toggle-on-intl.svg</file>
+    <file>ws-switch-arrow-up.png</file>
+    <file>ws-switch-arrow-down.png</file>
+  </gresource>
+</gresources>
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index 529e8c5..1e51faa 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -127,7 +127,7 @@ const AuthPrompt = new Lang.Class({
 
         this._initButtons();
 
-        let spinnerIcon = Gio.File.new_for_path(global.datadir + '/theme/process-working.svg');
+        let spinnerIcon = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
         this._spinner = new Animation.AnimatedIcon(spinnerIcon, DEFAULT_BUTTON_WELL_ICON_SIZE);
         this._spinner.actor.opacity = 0;
         this._spinner.actor.show();
diff --git a/js/ui/background.js b/js/ui/background.js
index 14b3444..7de204b 100644
--- a/js/ui/background.js
+++ b/js/ui/background.js
@@ -459,7 +459,7 @@ const SystemBackground = new Lang.Class({
     Name: 'SystemBackground',
 
     _init: function() {
-        let file = Gio.File.new_for_path(global.datadir + '/theme/noise-texture.png');
+        let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/noise-texture.png');
 
         if (_systemBackground == null) {
             _systemBackground = new Meta.Background({ meta_screen: global.screen });
diff --git a/js/ui/main.js b/js/ui/main.js
index 994bbe4..149e25a 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -131,6 +131,9 @@ function _initializeUI() {
     Shell.WindowTracker.get_default();
     Shell.AppUsage.get_default();
 
+    let resource = Gio.Resource.load(global.datadir + '/gnome-shell-theme.gresource');
+    resource._register();
+
     _loadDefaultStylesheet();
 
     // Setup the stage hierarchy early
@@ -228,7 +231,7 @@ function _loadDefaultStylesheet() {
     if (!sessionMode.isPrimary)
         return;
 
-    let stylesheet = Gio.File.new_for_path(global.datadir + '/theme/' + sessionMode.stylesheetName);
+    let stylesheet = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/' + sessionMode.stylesheetName);
     if (_defaultCssStylesheet && _defaultCssStylesheet.equal(stylesheet))
         return;
 
diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js
index 102df19..d1d4971 100644
--- a/js/ui/modalDialog.js
+++ b/js/ui/modalDialog.js
@@ -194,7 +194,7 @@ const ModalDialog = new Lang.Class({
     },
 
     placeSpinner: function(layoutInfo) {
-        let spinnerIcon = Gio.File.new_for_path(global.datadir + '/theme/process-working.svg');
+        let spinnerIcon = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
         this._workSpinner = new Animation.AnimatedIcon(spinnerIcon, WORK_SPINNER_ICON_SIZE);
         this._workSpinner.actor.opacity = 0;
         this._workSpinner.actor.show();
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index fb6662b..728584c 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -876,7 +876,7 @@ const NMWirelessDialog = new Lang.Class({
                                                  x_align: Clutter.ActorAlign.CENTER,
                                                  y_align: Clutter.ActorAlign.CENTER });
 
-        let file = Gio.File.new_for_path(global.datadir + '/theme/process-working.svg');
+        let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
         this._noNetworksSpinner = new Animation.AnimatedIcon(file, 24, 24);
         this._noNetworksBox.add_actor(this._noNetworksSpinner.actor);
         this._noNetworksBox.add_actor(new St.Label({ style_class: 'no-networks-label',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]