Merge lp:~mefrio-g/noise/dnd-welcome into lp:~elementary-apps/noise/trunk

Proposed by Mario Guerriero
Status: Merged
Approved by: Mario Guerriero
Approved revision: 1567
Merged at revision: 1568
Proposed branch: lp:~mefrio-g/noise/dnd-welcome
Merge into: lp:~elementary-apps/noise/trunk
Diff against target: 24 lines (+14/-1)
1 file modified
src/Views/Wrappers/MusicViewWrapper.vala (+14/-1)
To merge this branch: bzr merge lp:~mefrio-g/noise/dnd-welcome
Reviewer Review Type Date Requested Status
Victor Martinez (community) Approve
Review via email: mp+215566@code.launchpad.net

Commit message

Drag n Drop in welcome screen

To post a comment you must log in.
Revision history for this message
Victor Martinez (victored) wrote :

Looks good! Thank you.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Views/Wrappers/MusicViewWrapper.vala'
2--- src/Views/Wrappers/MusicViewWrapper.vala 2014-02-02 11:47:19 +0000
3+++ src/Views/Wrappers/MusicViewWrapper.vala 2014-04-13 08:29:29 +0000
4@@ -58,7 +58,20 @@
5 _devices = new Gee.HashMap<Device, int> ();
6
7 embedded_alert = new Granite.Widgets.EmbeddedAlert ();
8-
9+
10+ // Drag n drop in welcome widget
11+ Gtk.TargetEntry uris = {"text/uri-list", 0, 0};
12+ Gtk.drag_dest_set (welcome_screen, Gtk.DestDefaults.ALL, {uris}, Gdk.DragAction.COPY);
13+ welcome_screen.drag_data_received.connect ( (ctx, x, y, sel, info, time) => {
14+ var files = new Gee.ArrayList<string> ();
15+ for (var i=0; i < sel.get_uris ().length; i++) {
16+ File f = File.new_for_uri (sel.get_uris()[i]);
17+ string path = f.get_uri ();
18+ files.add (path);
19+ }
20+ App.main_window.library_manager.add_files_to_library (files);
21+ });
22+
23 // Refresh view layout
24 pack_views ();
25

Subscribers

People subscribed via source and target branches