[gnome-characters/bilelmoussaoui/gtk4: 8/76] port to Adw.Application
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-characters/bilelmoussaoui/gtk4: 8/76] port to Adw.Application
- Date: Fri, 26 Nov 2021 08:59:03 +0000 (UTC)
commit 5aa0f153085f022b6288ecf02871c811ba6364a8
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date: Fri Nov 19 12:02:55 2021 +0100
port to Adw.Application
data/org.gnome.Characters.data.gresource.xml | 2 +-
data/{application.css => style.css} | 0
src/main.js | 19 +++++++------------
src/util.js | 8 --------
4 files changed, 8 insertions(+), 21 deletions(-)
---
diff --git a/data/org.gnome.Characters.data.gresource.xml b/data/org.gnome.Characters.data.gresource.xml
index 2298437..bf3c978 100644
--- a/data/org.gnome.Characters.data.gresource.xml
+++ b/data/org.gnome.Characters.data.gresource.xml
@@ -7,7 +7,7 @@
<file preprocess="xml-stripblanks">characterlist.ui</file>
<file preprocess="xml-stripblanks">shortcuts.ui</file>
<file preprocess="xml-stripblanks">menu.ui</file>
- <file>application.css</file>
+ <file>style.css</file>
</gresource>
<gresource prefix="/org/gnome/Characters/icons/scalable/categories">
<file
alias="characters-arrow-symbolic.svg">icons/hicolor/scalable/categories/characters-arrow-symbolic.svg</file>
diff --git a/data/application.css b/data/style.css
similarity index 100%
rename from data/application.css
rename to data/style.css
diff --git a/src/main.js b/src/main.js
index 71fcca5..6d803dc 100644
--- a/src/main.js
+++ b/src/main.js
@@ -51,11 +51,13 @@ function initEnvironment() {
}
var MyApplication = GObject.registerClass({
-},class MyApplication extends Gtk.Application {
+},class MyApplication extends Adw.Application {
_init () {
- super._init({ application_id: application_id,
- flags: Gio.ApplicationFlags.FLAGS_NONE });
-
+ super._init({
+ application_id: application_id,
+ flags: Gio.ApplicationFlags.FLAGS_NONE,
+ resource_base_path: '/org/gnome/Characters',
+ });
GLib.set_application_name(_('Characters'));
}
@@ -72,13 +74,7 @@ var MyApplication = GObject.registerClass({
vfunc_startup () {
super.vfunc_startup();
- /*let theme = Gtk.IconTheme.get_default();
- theme.add_resource_path('/org/gnome/Characters/icons');
- */
- Util.loadStyleSheet('/org/gnome/Characters/application.css');
-
- let styleManager = Adw.StyleManager.get_default();
- styleManager.set_color_scheme(Adw.ColorScheme.PREFER_LIGHT);
+ this.get_style_manager().set_color_scheme(Adw.ColorScheme.PREFER_LIGHT);
Util.initActions(this,
[{ name: 'quit',
@@ -98,7 +94,6 @@ var MyApplication = GObject.registerClass({
}
vfunc_activate() {
- Adw.init();
if (!this._appwindow) {
this._appwindow = new Window.MainWindow({ application: this });
}
diff --git a/src/util.js b/src/util.js
index 7ae826b..b2bc7dd 100644
--- a/src/util.js
+++ b/src/util.js
@@ -42,14 +42,6 @@ function loadUI(resourcePath, objects) {
return ui;
}
-function loadStyleSheet(resource) {
- let provider = new Gtk.CssProvider();
- provider.load_from_file(Gio.File.new_for_uri('resource://' + resource));
- Gtk.StyleContext.add_provider_for_display(Gdk.Display.get_default(),
- provider,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-}
-
function initActions(actionMap, simpleActionEntries, context) {
simpleActionEntries.forEach(function(entry) {
let filtered = Params.filter(entry, { activate: null,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]