From dbeb4cb0b74a9b81d0b2cb9831dfe5299407ed6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Wed, 8 Sep 2021 21:32:42 +0200 Subject: [PATCH] misc: Cleanup imports resolve code It does not look like we will be able to provide gresources in near future (ever?). Remove those checks for less logic at startup. --- src/misc.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/misc.js b/src/misc.js index 9e414316..8b390089 100644 --- a/src/misc.js +++ b/src/misc.js @@ -30,8 +30,7 @@ let inhibitCookie; function getResourceUri(path) { - /* TODO: support gresources */ - let res = `file://${pkg.pkgdatadir}/${path}`; + const res = `file://${pkg.pkgdatadir}/${path}`; debug(`importing ${res}`); @@ -40,23 +39,14 @@ function getResourceUri(path) function getBuilderForName(name) { - const uri = getResourceUri(`ui/${name}`); - - if(uri.startsWith('resource')) - return Gtk.Builder.new_from_resource(uri.substring(11)); - - return Gtk.Builder.new_from_file(uri.substring(7)); + return Gtk.Builder.new_from_file(`${pkg.pkgdatadir}/ui/${name}`); } function loadCustomCss() { - const uri = getResourceUri(`css/styles.css`); const cssProvider = new Gtk.CssProvider(); - if(uri.startsWith('resource')) - cssProvider.load_from_resource(uri); - else - cssProvider.load_from_path(uri.substring(7)); + cssProvider.load_from_path(`${pkg.pkgdatadir}/css/styles.css`); Gtk.StyleContext.add_provider_for_display( Gdk.Display.get_default(),