Preferences: Load icons from resources

This commit is contained in:
Romain Vigier
2022-04-04 22:23:48 +02:00
parent e977326be4
commit 6c952a6485
24 changed files with 45 additions and 32 deletions

Before

Width:  |  Height:  |  Size: 541 B

After

Width:  |  Height:  |  Size: 541 B

Before

Width:  |  Height:  |  Size: 848 B

After

Width:  |  Height:  |  Size: 848 B

Before

Width:  |  Height:  |  Size: 773 B

After

Width:  |  Height:  |  Size: 773 B

Before

Width:  |  Height:  |  Size: 535 B

After

Width:  |  Height:  |  Size: 535 B

Before

Width:  |  Height:  |  Size: 658 B

After

Width:  |  Height:  |  Size: 658 B

Before

Width:  |  Height:  |  Size: 644 B

After

Width:  |  Height:  |  Size: 644 B

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 607 B

Before

Width:  |  Height:  |  Size: 578 B

After

Width:  |  Height:  |  Size: 578 B

Before

Width:  |  Height:  |  Size: 535 B

After

Width:  |  Height:  |  Size: 535 B

Before

Width:  |  Height:  |  Size: 446 B

After

Width:  |  Height:  |  Size: 446 B

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

+7 -3
View File
@@ -2,8 +2,8 @@
# SPDX-License-Identifier: GPL-3.0-or-later
gnome.compile_resources(
DNS,
DNS + '.gresource.xml',
'preferences',
'preferences.gresource.xml',
gresource_bundle: true,
install: true,
install_dir: INSTALL_DIR / 'resources',
@@ -23,4 +23,8 @@ custom_target(
install_dir: INSTALL_DIR / 'schemas'
)
install_subdir('icons', install_dir: INSTALL_DIR)
icons = [
'icons/nightthemeswitcher-ondemand-off-symbolic.svg',
'icons/nightthemeswitcher-ondemand-on-symbolic.svg'
]
install_data(icons, install_dir: INSTALL_DIR / 'icons' / 'hicolor' / 'scalable' / 'status')
@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2022 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<gresources>
<gresource prefix="/org/gnome/shell/extensions/nightthemeswitcher">
<file compressed="true" preprocess="xml-stripblanks">ui/BackgroundButton.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/BackgroundsPage.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/ClearableEntry.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/CommandsPage.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/ContributePage.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/SchedulePage.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/ShortcutButton.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/ThemesPage.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/TimeChooser.ui</file>
</gresource>
</gresources>
+27
View File
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: 2022 Romain Vigier <contact AT romainvigier.fr>
SPDX-License-Identifier: GPL-3.0-or-later
-->
<gresources>
<gresource prefix="/org/gnome/shell/extensions/nightthemeswitcher/preferences">
<file compressed="true" preprocess="xml-stripblanks" alias="icons/scalable/actions/nightthemeswitcher-code-symbolic.svg">icons/code-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks" alias="icons/scalable/actions/nightthemeswitcher-support-symbolic.svg">icons/support-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks" alias="icons/scalable/actions/nightthemeswitcher-translate-symbolic.svg">icons/translate-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks" alias="icons/scalable/apps/nightthemeswitcher-symbolic.svg">icons/nightthemeswitcher-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks" alias="icons/scalable/categories/nightthemeswitcher-backgrounds-symbolic.svg">icons/backgrounds-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks" alias="icons/scalable/categories/nightthemeswitcher-commands-symbolic.svg">icons/commands-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks" alias="icons/scalable/categories/nightthemeswitcher-contribute-symbolic.svg">icons/contribute-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks" alias="icons/scalable/categories/nightthemeswitcher-schedule-symbolic.svg">icons/schedule-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks" alias="icons/scalable/categories/nightthemeswitcher-themes-symbolic.svg">icons/themes-symbolic.svg</file>
<file compressed="true" preprocess="xml-stripblanks">ui/BackgroundButton.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/BackgroundsPage.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/ClearableEntry.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/CommandsPage.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/ContributePage.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/SchedulePage.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/ShortcutButton.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/ThemesPage.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/TimeChooser.ui</file>
</gresource>
</gresources>
+1 -1
View File
@@ -10,7 +10,7 @@ const _ = extensionUtils.gettext;
var BackgroundButton = GObject.registerClass({
GTypeName: 'BackgroundButton',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/ui/BackgroundButton.ui',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/preferences/ui/BackgroundButton.ui',
InternalChildren: ['filechooser'],
Properties: {
uri: GObject.ParamSpec.string(
+1 -1
View File
@@ -9,7 +9,7 @@ const Me = extensionUtils.getCurrentExtension();
var BackgroundsPage = GObject.registerClass({
GTypeName: 'BackgroundsPage',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/ui/BackgroundsPage.ui',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/preferences/ui/BackgroundsPage.ui',
InternalChildren: [
'day_button',
'night_button',
+1 -1
View File
@@ -9,7 +9,7 @@ const Me = extensionUtils.getCurrentExtension();
var ClearableEntry = GObject.registerClass({
GTypeName: 'ClearableEntry',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/ui/ClearableEntry.ui',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/preferences/ui/ClearableEntry.ui',
}, class ClearableEntry extends Gtk.Entry {
onIconReleased(entry, position) {
if (position === Gtk.EntryIconPosition.SECONDARY)
+1 -1
View File
@@ -11,7 +11,7 @@ const utils = Me.imports.utils;
var CommandsPage = GObject.registerClass({
GTypeName: 'CommandsPage',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/ui/CommandsPage.ui',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/preferences/ui/CommandsPage.ui',
InternalChildren: [
'enabled_switch',
'sunrise_entry',
+1 -1
View File
@@ -9,5 +9,5 @@ const Me = extensionUtils.getCurrentExtension();
var ContributePage = GObject.registerClass({
GTypeName: 'ContributePage',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/ui/ContributePage.ui',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/preferences/ui/ContributePage.ui',
}, class ContributePage extends Adw.PreferencesPage {});
+1 -1
View File
@@ -14,7 +14,7 @@ const { DropDownChoice } = Me.imports.preferences.DropDownChoice;
var SchedulePage = GObject.registerClass({
GTypeName: 'SchedulePage',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/ui/SchedulePage.ui',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/preferences/ui/SchedulePage.ui',
InternalChildren: [
'transition_switch',
'manual_time_source_switch',
+1 -1
View File
@@ -11,7 +11,7 @@ const utils = Me.imports.utils;
var ShortcutButton = GObject.registerClass({
GTypeName: 'ShortcutButton',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/ui/ShortcutButton.ui',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/preferences/ui/ShortcutButton.ui',
InternalChildren: ['choose_button', 'change_button', 'clear_button', 'dialog'],
Properties: {
keybinding: GObject.ParamSpec.string(
+1 -1
View File
@@ -14,7 +14,7 @@ const { DropDownChoice } = Me.imports.preferences.DropDownChoice;
var ThemesPage = GObject.registerClass({
GTypeName: 'ThemesPage',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/ui/ThemesPage.ui',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/preferences/ui/ThemesPage.ui',
InternalChildren: [
'gtk_enabled_switch',
'gtk_day_variant_combo_row',
+1 -1
View File
@@ -9,7 +9,7 @@ const Me = extensionUtils.getCurrentExtension();
var TimeChooser = GObject.registerClass({
GTypeName: 'TimeChooser',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/ui/TimeChooser.ui',
Template: 'resource:///org/gnome/shell/extensions/nightthemeswitcher/preferences/ui/TimeChooser.ui',
InternalChildren: ['hours', 'minutes'],
Properties: {
time: GObject.ParamSpec.double(
+2 -2
View File
@@ -16,7 +16,7 @@ const _ = extensionUtils.gettext;
function init() {
extensionUtils.initTranslations();
const resource = Gio.Resource.load(GLib.build_filenamev([Me.path, 'resources', 'org.gnome.shell.extensions.nightthemeswitcher.gresource']));
const resource = Gio.Resource.load(GLib.build_filenamev([Me.path, 'resources', 'preferences.gresource']));
Gio.resources_register(resource);
GObject.type_ensure(Me.imports.preferences.BackgroundsPage.BackgroundsPage);
@@ -31,7 +31,7 @@ function init() {
GObject.type_ensure(Me.imports.preferences.TimeChooser.TimeChooser);
const iconTheme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default());
iconTheme.add_search_path(GLib.build_filenamev([Me.path, 'icons']));
iconTheme.add_resource_path('/org/gnome/shell/extensions/nightthemeswitcher/preferences/icons');
}
/**