[gnome-sound-recorder/wip/cdavis/gtk4] port to Adw.Application



commit c9382b805b4bd52c3a216c3927b9ae768a6f4294
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Thu Nov 18 20:48:05 2021 +0100

    port to Adw.Application

 data/org.gnome.SoundRecorder.data.gresource.xml |  2 +-
 data/{application.css => style.css}             |  0
 src/application.js                              | 16 ++--------------
 3 files changed, 3 insertions(+), 15 deletions(-)
---
diff --git a/data/org.gnome.SoundRecorder.data.gresource.xml b/data/org.gnome.SoundRecorder.data.gresource.xml
index 7438fe7..25da7dd 100644
--- a/data/org.gnome.SoundRecorder.data.gresource.xml
+++ b/data/org.gnome.SoundRecorder.data.gresource.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
   <gresource prefix="/org/gnome/SoundRecorder">
-    <file>application.css</file>
+    <file>style.css</file>
     <file>ui/recorder.ui</file>
     <file>ui/row.ui</file>
     <file>ui/window.ui</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/application.js b/src/application.js
index bf72e07..6b99524 100644
--- a/src/application.js
+++ b/src/application.js
@@ -26,9 +26,9 @@ var Settings = new Gio.Settings({ schema: pkg.name });
 
 const { Window } = imports.window;
 
-var Application = GObject.registerClass(class Application extends Gtk.Application {
+var Application = GObject.registerClass(class Application extends Adw.Application {
     _init() {
-        super._init({ application_id: pkg.name });
+        super._init({ application_id: pkg.name, resource_base_path: '/org/gnome/SoundRecorder/' });
         GLib.set_application_name(_('Sound Recorder'));
         GLib.set_prgname('gnome-sound-recorder');
         GLib.setenv('PULSE_PROP_media.role', 'production', 1);
@@ -89,18 +89,6 @@ var Application = GObject.registerClass(class Application extends Gtk.Applicatio
         log('Sound Recorder (%s)'.format(pkg.name));
         log('Version: %s'.format(pkg.version));
 
-        let provider = new Gtk.CssProvider();
-        provider.load_from_resource('/org/gnome/SoundRecorder/application.css');
-
-        let display = Gdk.Display.get_default();
-        Gtk.StyleContext.add_provider_for_display(display,
-            provider,
-            Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
-
-        Gtk.IconTheme.get_for_display(display).add_resource_path('/org/gnome/SoundRecorder/icons/');
-
-        this.set_resource_base_path('/org/gnome/SoundRecorder/');
-        Adw.init();
         Gst.init(null);
 
         try {


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