[polari] app: Use Adw.Application's automatic style loading



commit 754193a825af4d24ea215d5576f11e531878d684
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Dec 31 14:24:44 2021 +0100

    app: Use Adw.Application's automatic style loading
    
    Now that we switched to AdwApplication, we can automate loading
    the custom stylesheet by simply using the expected name and
    resource prefix.
    
    Part-of: <https://gitlab.gnome.org/GNOME/polari/-/merge_requests/250>

 data/org.gnome.Polari.data.gresource.xml      | 2 +-
 data/resources/{application.css => style.css} | 0
 src/application.js                            | 8 --------
 3 files changed, 1 insertion(+), 9 deletions(-)
---
diff --git a/data/org.gnome.Polari.data.gresource.xml b/data/org.gnome.Polari.data.gresource.xml
index 695d49d6..715d2200 100644
--- a/data/org.gnome.Polari.data.gresource.xml
+++ b/data/org.gnome.Polari.data.gresource.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
   <gresource prefix="/org/gnome/Polari">
-    <file alias="css/application.css">resources/application.css</file>
+    <file alias="style.css">resources/style.css</file>
     <file alias="data/networks.json">resources/networks.json</file>
     <file alias="gtk/help-overlay.ui" preprocess="xml-stripblanks">resources/help-overlay.ui</file>
     <file alias="gtk/menus.ui" preprocess="xml-stripblanks">resources/menus.ui</file>
diff --git a/data/resources/application.css b/data/resources/style.css
similarity index 100%
rename from data/resources/application.css
rename to data/resources/style.css
diff --git a/src/application.js b/src/application.js
index 867cd77d..b4941adb 100644
--- a/src/application.js
+++ b/src/application.js
@@ -1,5 +1,4 @@
 import Adw from 'gi://Adw';
-import Gdk from 'gi://Gdk?version=4.0';
 import Gio from 'gi://Gio';
 import GLib from 'gi://GLib';
 import GObject from 'gi://GObject';
@@ -390,13 +389,6 @@ class Application extends Adw.Application {
         });
 
         this.pasteManager = new PasteManager();
-
-        let provider = new Gtk.CssProvider();
-        let uri = 'resource:///org/gnome/Polari/css/application.css';
-        provider.load_from_file(Gio.File.new_for_uri(uri));
-        Gtk.StyleContext.add_provider_for_display(Gdk.Display.get_default(),
-            provider,
-            Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
     }
 
     vfunc_activate() {


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