mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
Hold Ctrl while doing D&D to append items to playlist instead of replacing it
This commit is contained in:
@@ -706,10 +706,11 @@ class ClapperWidget extends Gtk.Grid
|
|||||||
_getDropTarget()
|
_getDropTarget()
|
||||||
{
|
{
|
||||||
const dropTarget = new Gtk.DropTarget({
|
const dropTarget = new Gtk.DropTarget({
|
||||||
actions: Gdk.DragAction.COPY,
|
actions: Gdk.DragAction.COPY | Gdk.DragAction.MOVE,
|
||||||
preload: true,
|
preload: true,
|
||||||
});
|
});
|
||||||
dropTarget.set_gtypes([GObject.TYPE_STRING]);
|
dropTarget.set_gtypes([GObject.TYPE_STRING]);
|
||||||
|
dropTarget.connect('motion', this._onDataMotion.bind(this));
|
||||||
dropTarget.connect('drop', this._onDataDrop.bind(this));
|
dropTarget.connect('drop', this._onDataDrop.bind(this));
|
||||||
dropTarget.connect('notify::value', this._onDropValueNotify.bind(this));
|
dropTarget.connect('notify::value', this._onDropValueNotify.bind(this));
|
||||||
|
|
||||||
@@ -915,6 +916,11 @@ class ClapperWidget extends Gtk.Grid
|
|||||||
ytClient.getVideoInfoPromise(videoId).catch(debug);
|
ytClient.getVideoInfoPromise(videoId).catch(debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_onDataMotion(dropTarget, x, y)
|
||||||
|
{
|
||||||
|
return Gdk.DragAction.MOVE;
|
||||||
|
}
|
||||||
|
|
||||||
_onDataDrop(dropTarget, value, x, y)
|
_onDataDrop(dropTarget, value, x, y)
|
||||||
{
|
{
|
||||||
const files = value.split(/\r?\n/).filter(uri => {
|
const files = value.split(/\r?\n/).filter(uri => {
|
||||||
@@ -927,7 +933,9 @@ class ClapperWidget extends Gtk.Grid
|
|||||||
for(let index in files)
|
for(let index in files)
|
||||||
files[index] = Gio.File.new_for_uri(files[index]);
|
files[index] = Gio.File.new_for_uri(files[index]);
|
||||||
|
|
||||||
this.root.application.open(files, "");
|
const app = this.root.application;
|
||||||
|
app.isFileAppend = Boolean(dropTarget.drop.actions & Gdk.DragAction.COPY);
|
||||||
|
app.open(files, "");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user