Merge lp:~parnold-x/slingshot/fix-1008352 into lp:~elementary-pantheon/slingshot/trunk

Proposed by Djax
Status: Merged
Approved by: Cody Garver
Approved revision: 436
Merged at revision: 479
Proposed branch: lp:~parnold-x/slingshot/fix-1008352
Merge into: lp:~elementary-pantheon/slingshot/trunk
Diff against target: 74 lines (+26/-5)
2 files modified
src/Widgets/SearchItem.vala (+21/-2)
src/Widgets/SearchView.vala (+5/-3)
To merge this branch: bzr merge lp:~parnold-x/slingshot/fix-1008352
Reviewer Review Type Date Requested Status
elementary Pantheon team Pending
Review via email: mp+230258@code.launchpad.net

Commit message

Support dragging apps in search view (lp:1008352)

Description of the change

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Widgets/SearchItem.vala'
--- src/Widgets/SearchItem.vala 2014-06-12 09:14:57 +0000
+++ src/Widgets/SearchItem.vala 2014-08-11 08:42:29 +0000
@@ -28,12 +28,13 @@
28 private Gtk.Image icon;28 private Gtk.Image icon;
2929
30 private Cancellable? cancellable = null;30 private Cancellable? cancellable = null;
31 public bool dragging = false; //prevent launching
3132
32 public signal bool launch_app ();33 public signal bool launch_app ();
3334
34 public SearchItem (Backend.App app, string search_term = "") {35 public SearchItem (Backend.App app, string search_term = "") {
35 Object (app: app);36 Object (app: app);
3637
37 get_style_context ().add_class ("app");38 get_style_context ().add_class ("app");
38 get_style_context ().add_class ("search-item");39 get_style_context ().add_class ("search-item");
3940
@@ -68,6 +69,24 @@
68 add (box);69 add (box);
6970
70 launch_app.connect (app.launch);71 launch_app.connect (app.launch);
72
73 var app_match = app.match as Synapse.ApplicationMatch;
74 if (app_match != null) {
75 Gtk.TargetEntry dnd = {"text/uri-list", 0, 0};
76 Gtk.drag_source_set (this, Gdk.ModifierType.BUTTON1_MASK, {dnd},
77 Gdk.DragAction.COPY);
78 this.drag_begin.connect ( (ctx) => {
79 this.dragging = true;
80 Gtk.drag_set_icon_pixbuf (ctx, app.icon, 0, 0);
81 });
82 this.drag_end.connect ( () => {
83 this.dragging = false;
84 });
85 this.drag_data_get.connect ( (ctx, sel, info, time) => {
86 sel.set_uris ({File.new_for_path (app_match.filename).get_uri ()});
87 });
88 }
89
71 }90 }
7291
73 public override void destroy () {92 public override void destroy () {
@@ -79,4 +98,4 @@
79 }98 }
80 }99 }
81100
82}101}
83\ No newline at end of file102\ No newline at end of file
84103
=== modified file 'src/Widgets/SearchView.vala'
--- src/Widgets/SearchView.vala 2014-06-12 09:14:57 +0000
+++ src/Widgets/SearchView.vala 2014-08-11 08:42:29 +0000
@@ -216,8 +216,10 @@
216 var search_item = new SearchItem (app, search_term);216 var search_item = new SearchItem (app, search_term);
217 app.start_search.connect ((search, target) => start_search (search, target));217 app.start_search.connect ((search, target) => start_search (search, target));
218 search_item.button_release_event.connect (() => {218 search_item.button_release_event.connect (() => {
219 app.launch ();219 if (!search_item.dragging) {
220 app_launched ();220 app.launch ();
221 app_launched ();
222 }
221 return true;223 return true;
222 });224 });
223225
@@ -352,4 +354,4 @@
352354
353 }355 }
354356
355}357}
356\ No newline at end of file358\ No newline at end of file

Subscribers

People subscribed via source and target branches