mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 00:11:59 +02:00
Fix custom CSS loading for remote app
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const { Gio, GstAudio, GstPlayer, Gtk } = imports.gi;
|
||||
const { Gio, GstAudio, GstPlayer, Gdk, Gtk } = imports.gi;
|
||||
const Debug = imports.clapper_src.debug;
|
||||
|
||||
var appName = 'Clapper';
|
||||
@@ -34,6 +34,19 @@ function getClapperVersion()
|
||||
: '';
|
||||
}
|
||||
|
||||
function loadCustomCss()
|
||||
{
|
||||
const clapperPath = getClapperPath();
|
||||
const cssProvider = new Gtk.CssProvider();
|
||||
|
||||
cssProvider.load_from_path(`${clapperPath}/css/styles.css`);
|
||||
Gtk.StyleContext.add_provider_for_display(
|
||||
Gdk.Display.get_default(),
|
||||
cssProvider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||
);
|
||||
}
|
||||
|
||||
function inhibitForState(state, window)
|
||||
{
|
||||
let isInhibited = false;
|
||||
|
@@ -16,25 +16,15 @@ var Widget = GObject.registerClass({
|
||||
}
|
||||
}, class ClapperWidget extends Gtk.Grid
|
||||
{
|
||||
_init(opts)
|
||||
_init()
|
||||
{
|
||||
Debug.gstVersionCheck();
|
||||
|
||||
super._init();
|
||||
|
||||
let clapperPath = Misc.getClapperPath();
|
||||
let defaults = {
|
||||
cssPath: `${clapperPath}/css/styles.css`,
|
||||
};
|
||||
Object.assign(this, defaults, opts);
|
||||
|
||||
let cssProvider = new Gtk.CssProvider();
|
||||
cssProvider.load_from_path(this.cssPath);
|
||||
Gtk.StyleContext.add_provider_for_display(
|
||||
Gdk.Display.get_default(),
|
||||
cssProvider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||
);
|
||||
/* load CSS here to allow using this class
|
||||
* separately as a pre-made GTK widget */
|
||||
Misc.loadCustomCss();
|
||||
|
||||
this.windowSize = JSON.parse(settings.get_string('window-size'));
|
||||
this.floatSize = JSON.parse(settings.get_string('float-size'));
|
||||
|
@@ -1,4 +1,5 @@
|
||||
const { GObject, Gtk } = imports.gi;
|
||||
const Misc = imports.clapper_src.misc;
|
||||
const { PlayerRemote } = imports.clapper_src.playerRemote;
|
||||
|
||||
var WidgetRemote = GObject.registerClass(
|
||||
@@ -8,6 +9,8 @@ class ClapperWidgetRemote extends Gtk.Grid
|
||||
{
|
||||
super._init();
|
||||
|
||||
Misc.loadCustomCss();
|
||||
|
||||
this.player = new PlayerRemote();
|
||||
this.player.webclient.passMsgData = this.receiveWs.bind(this);
|
||||
}
|
||||
|
Reference in New Issue
Block a user