mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 16:31:58 +02:00
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.
This commit is contained in:
16
src/misc.js
16
src/misc.js
@@ -30,8 +30,7 @@ let inhibitCookie;
|
|||||||
|
|
||||||
function getResourceUri(path)
|
function getResourceUri(path)
|
||||||
{
|
{
|
||||||
/* TODO: support gresources */
|
const res = `file://${pkg.pkgdatadir}/${path}`;
|
||||||
let res = `file://${pkg.pkgdatadir}/${path}`;
|
|
||||||
|
|
||||||
debug(`importing ${res}`);
|
debug(`importing ${res}`);
|
||||||
|
|
||||||
@@ -40,23 +39,14 @@ function getResourceUri(path)
|
|||||||
|
|
||||||
function getBuilderForName(name)
|
function getBuilderForName(name)
|
||||||
{
|
{
|
||||||
const uri = getResourceUri(`ui/${name}`);
|
return Gtk.Builder.new_from_file(`${pkg.pkgdatadir}/ui/${name}`);
|
||||||
|
|
||||||
if(uri.startsWith('resource'))
|
|
||||||
return Gtk.Builder.new_from_resource(uri.substring(11));
|
|
||||||
|
|
||||||
return Gtk.Builder.new_from_file(uri.substring(7));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadCustomCss()
|
function loadCustomCss()
|
||||||
{
|
{
|
||||||
const uri = getResourceUri(`css/styles.css`);
|
|
||||||
const cssProvider = new Gtk.CssProvider();
|
const cssProvider = new Gtk.CssProvider();
|
||||||
|
|
||||||
if(uri.startsWith('resource'))
|
cssProvider.load_from_path(`${pkg.pkgdatadir}/css/styles.css`);
|
||||||
cssProvider.load_from_resource(uri);
|
|
||||||
else
|
|
||||||
cssProvider.load_from_path(uri.substring(7));
|
|
||||||
|
|
||||||
Gtk.StyleContext.add_provider_for_display(
|
Gtk.StyleContext.add_provider_for_display(
|
||||||
Gdk.Display.get_default(),
|
Gdk.Display.get_default(),
|
||||||
|
Reference in New Issue
Block a user