[gnome-maps/wip/mlundblad/fix-shapelayer-drag-and-drop] mainWindow: Pass a GListStore to openShapeLayers




commit 7540cab0c0b3ba9c07b9b67164015bf56d2cd21d
Author: Marcus Lundblad <ml dfupdate se>
Date:   Tue Sep 27 22:25:52 2022 +0200

    mainWindow: Pass a GListStore to openShapeLayers
    
    The openShapeLayers method expects a GListModel
    as returned by the file chooser when selecting files.
    While the drag-and-drop action gets the value a GFile.
    So wrap the object in a GListStore before passing in on
    from the DND handler.

 src/mainWindow.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index fb93a8b5..7e6ec6a7 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -177,7 +177,11 @@ export class MainWindow extends Gtk.ApplicationWindow {
         this.add_controller(this._dropTarget);
 
         this._dropTarget.connect('drop', (target, value, x, y, data) => {
-            return this._mapView.openShapeLayers([value]);
+            let list = new Gio.ListStore(Gio.File.Gtype);
+
+            list.insert(0, value);
+
+            return this._mapView.openShapeLayers(list);
         });
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]