From 49c4ba5656b13c055d37699151aaee196c52cfff Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Thu, 18 Sep 2014 19:24:46 -0700 Subject: [PATCH] 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(-) create mode 100644 data/gnome-shell-theme.gresource.xml diff --git a/.gitignore b/.gitignore index e0147ae05..bd6eb7460 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 65f948aea..de27d8eff 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 000000000..d47349432 --- /dev/null +++ b/data/gnome-shell-theme.gresource.xml @@ -0,0 +1,41 @@ + + + + calendar-arrow-left.svg + calendar-arrow-right.svg + calendar-today.svg + checkbox-focused.svg + checkbox-off-focused.svg + checkbox-off.svg + checkbox.svg + close-window.svg + close.svg + corner-ripple-ltr.png + corner-ripple-rtl.png + dash-placeholder.svg + filter-selected-ltr.svg + filter-selected-rtl.svg + gnome-shell.css + logged-in-indicator.svg + message-tray-background.png + more-results.svg + noise-texture.png + page-indicator-active.svg + page-indicator-inactive.svg + page-indicator-checked.svg + page-indicator-hover.svg + panel-button-border.svg + panel-button-highlight-narrow.svg + panel-button-highlight-wide.svg + process-working.svg + running-indicator.svg + source-button-border.svg + summary-counter.svg + toggle-off-us.svg + toggle-off-intl.svg + toggle-on-us.svg + toggle-on-intl.svg + ws-switch-arrow-up.png + ws-switch-arrow-down.png + + diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index 529e8c555..1e51faa5c 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 14b344414..7de204b60 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 994bbe478..149e25a05 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 102df19a1..d1d49710c 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 fb6662b3d..728584c1b 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',