mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 08:21:59 +02:00
Open new file in the same window. Closes #31
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const { GObject } = imports.gi;
|
||||
const { Gio, GObject } = imports.gi;
|
||||
const { AppBase } = imports.clapper_src.appBase;
|
||||
const { HeaderBar } = imports.clapper_src.headerbar;
|
||||
const { Widget } = imports.clapper_src.widget;
|
||||
@@ -9,6 +9,17 @@ let { debug } = Debug;
|
||||
var App = GObject.registerClass(
|
||||
class ClapperApp extends AppBase
|
||||
{
|
||||
_init()
|
||||
{
|
||||
super._init();
|
||||
|
||||
this.set_flags(
|
||||
this.get_flags()
|
||||
| Gio.ApplicationFlags.HANDLES_OPEN
|
||||
);
|
||||
this.playlist = [];
|
||||
}
|
||||
|
||||
vfunc_startup()
|
||||
{
|
||||
super.vfunc_startup();
|
||||
@@ -27,13 +38,22 @@ class ClapperApp extends AppBase
|
||||
debug(`restored window size: ${size[0]}x${size[1]}`);
|
||||
}
|
||||
|
||||
vfunc_open(files, hint)
|
||||
{
|
||||
super.vfunc_open(files, hint);
|
||||
|
||||
this.playlist = files;
|
||||
this._handleAppStart();
|
||||
}
|
||||
|
||||
_onWindowShow(window)
|
||||
{
|
||||
super._onWindowShow(window);
|
||||
|
||||
if(this.playlist.length) {
|
||||
let { player } = window.get_child();
|
||||
player.set_playlist(this.playlist);
|
||||
}
|
||||
if(!this.playlist.length)
|
||||
return;
|
||||
|
||||
let { player } = window.get_child();
|
||||
player.set_playlist(this.playlist);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user