Merge lp:~wingpanel-devs/slingshot/dnd_to_plank into lp:~elementary-pantheon/slingshot/trunk

Proposed by Djax
Status: Merged
Approved by: Felipe Escoto
Approved revision: 662
Merged at revision: 667
Proposed branch: lp:~wingpanel-devs/slingshot/dnd_to_plank
Merge into: lp:~elementary-pantheon/slingshot/trunk
Diff against target: 214 lines (+63/-34)
5 files modified
src/Slingshot.vala (+0/-2)
src/SlingshotView.vala (+4/-5)
src/Widgets/AppEntry.vala (+3/-3)
src/Widgets/SearchItem.vala (+6/-17)
src/Widgets/SearchView.vala (+50/-7)
To merge this branch: bzr merge lp:~wingpanel-devs/slingshot/dnd_to_plank
Reviewer Review Type Date Requested Status
Felipe Escoto (community) Approve
Review via email: mp+298978@code.launchpad.net

Commit message

Fix regression regarding to DnD behavior

Description of the change

To post a comment you must log in.
Revision history for this message
Felipe Escoto (philip.scott) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Slingshot.vala'
--- src/Slingshot.vala 2016-02-17 19:06:52 +0000
+++ src/Slingshot.vala 2016-07-02 16:12:12 +0000
@@ -17,7 +17,6 @@
17//17//
1818
19public class Slingshot.Slingshot : Wingpanel.Indicator {19public class Slingshot.Slingshot : Wingpanel.Indicator {
20
21 private SlingshotView? view = null;20 private SlingshotView? view = null;
2221
23 private Gtk.Label? indicator_label = null;22 private Gtk.Label? indicator_label = null;
@@ -75,7 +74,6 @@
75 public override void closed () {74 public override void closed () {
76 // TODO: Do we need to do anyhting here?75 // TODO: Do we need to do anyhting here?
77 }76 }
78
79}77}
8078
81public Wingpanel.Indicator get_indicator (Module module) {79public Wingpanel.Indicator get_indicator (Module module) {
8280
=== modified file 'src/SlingshotView.vala'
--- src/SlingshotView.vala 2016-02-17 19:06:52 +0000
+++ src/SlingshotView.vala 2016-07-02 16:12:12 +0000
@@ -73,7 +73,7 @@
73 private int primary_monitor = 0;73 private int primary_monitor = 0;
7474
75 Gdk.Screen screen;75 Gdk.Screen screen;
76 76
77 public signal void close_indicator ();77 public signal void close_indicator ();
7878
79 public SlingshotView () {79 public SlingshotView () {
@@ -223,7 +223,6 @@
223 } else if (event.x_root >= 1 || event.y_root >= 1) {223 } else if (event.x_root >= 1 || event.y_root >= 1) {
224 can_trigger_hotcorner = true;224 can_trigger_hotcorner = true;
225 }225 }
226
227 return false;226 return false;
228 }227 }
229228
@@ -295,7 +294,7 @@
295 update_launcher_entry (sender_name, parameters, true);294 update_launcher_entry (sender_name, parameters, true);
296 return false;295 return false;
297 });296 });
298 297
299 return;298 return;
300 }299 }
301300
@@ -386,7 +385,7 @@
386 case "Return":385 case "Return":
387 case "KP_Enter":386 case "KP_Enter":
388 return false;387 return false;
389 388
390 case "Alt_L":389 case "Alt_L":
391 case "Alt_R":390 case "Alt_R":
392 break;391 break;
@@ -781,6 +780,6 @@
781 } else if (delta_column < 0 || delta_row < 0) {780 } else if (delta_column < 0 || delta_row < 0) {
782 search_entry.grab_focus ();781 search_entry.grab_focus ();
783 }782 }
784 } 783 }
785 }784 }
786}785}
787786
=== modified file 'src/Widgets/AppEntry.vala'
--- src/Widgets/AppEntry.vala 2016-02-17 19:06:52 +0000
+++ src/Widgets/AppEntry.vala 2016-07-02 16:12:12 +0000
@@ -134,9 +134,9 @@
134 return false;134 return false;
135 });135 });
136136
137 this.drag_begin.connect ( (ctx) => {137 this.drag_begin.connect ((ctx) => {
138 this.dragging = true;138 this.dragging = true;
139 Gtk.drag_set_icon_gicon (ctx, app.icon, 0, 0);139 Gtk.drag_set_icon_gicon (ctx, this.image.gicon, 16, 16);
140 });140 });
141141
142 this.drag_end.connect ( () => {142 this.drag_end.connect ( () => {
@@ -183,7 +183,7 @@
183183
184 count_image.set_from_surface (surface.Internal);184 count_image.set_from_surface (surface.Internal);
185 }185 }
186#endif 186#endif
187187
188 private void create_menu () {188 private void create_menu () {
189 // Display the apps static quicklist items in a popover menu189 // Display the apps static quicklist items in a popover menu
190190
=== modified file 'src/Widgets/SearchItem.vala'
--- src/Widgets/SearchItem.vala 2016-04-21 18:23:20 +0000
+++ src/Widgets/SearchItem.vala 2016-07-02 16:12:12 +0000
@@ -39,10 +39,9 @@
39 public Backend.App app { get; construct; }39 public Backend.App app { get; construct; }
40 public ResultType result_type { public get; construct; }40 public ResultType result_type { public get; construct; }
4141
42 public bool dragging = false; //prevent launching
43
44 private Gtk.Label name_label;42 private Gtk.Label name_label;
45 private Gtk.Image icon;43 public Gtk.Image icon { public get; private set; }
44 public string? app_uri { get; private set; }
46 private Cancellable? cancellable = null;45 private Cancellable? cancellable = null;
4746
48 public SearchItem (Backend.App app, string search_term = "", ResultType result_type = ResultType.UNKNOWN) {47 public SearchItem (Backend.App app, string search_term = "", ResultType result_type = ResultType.UNKNOWN) {
@@ -89,24 +88,14 @@
8988
90 add (grid);89 add (grid);
9190
92 if (result_type != SearchItem.ResultType.APP_ACTIONS)91 if (result_type != SearchItem.ResultType.APP_ACTIONS) {
93 launch_app.connect (app.launch);92 launch_app.connect (app.launch);
93 }
9494
95 app_uri = null;
95 var app_match = app.match as Synapse.ApplicationMatch;96 var app_match = app.match as Synapse.ApplicationMatch;
96 if (app_match != null) {97 if (app_match != null) {
97 Gtk.TargetEntry dnd = {"text/uri-list", 0, 0};98 app_uri = File.new_for_path (app_match.filename).get_uri ();
98 Gtk.drag_source_set (this, Gdk.ModifierType.BUTTON1_MASK, {dnd},
99 Gdk.DragAction.COPY);
100 this.drag_begin.connect ( (ctx) => {
101 this.dragging = true;
102 Gtk.drag_set_icon_gicon (ctx, app.icon, 0, 0);
103 });
104 this.drag_end.connect ( () => {
105 this.dragging = false;
106 });
107 this.drag_data_get.connect ( (ctx, sel, info, time) => {
108 sel.set_uris ({File.new_for_path (app_match.filename).get_uri ()});
109 });
110 }99 }
111 }100 }
112101
113102
=== modified file 'src/Widgets/SearchView.vala'
--- src/Widgets/SearchView.vala 2016-05-04 02:46:59 +0000
+++ src/Widgets/SearchView.vala 2016-07-02 16:12:12 +0000
@@ -33,6 +33,9 @@
33 private Gtk.ListBox list_box;33 private Gtk.ListBox list_box;
34 Gee.HashMap<SearchItem.ResultType, uint> limitator;34 Gee.HashMap<SearchItem.ResultType, uint> limitator;
3535
36 private bool dragging = false;
37 private string? drag_uri = null;
38
36 public SearchView () {39 public SearchView () {
3740
38 }41 }
@@ -46,15 +49,55 @@
46 list_box.activate_on_single_click = true;49 list_box.activate_on_single_click = true;
47 list_box.set_sort_func ((row1, row2) => update_sort (row1, row2));50 list_box.set_sort_func ((row1, row2) => update_sort (row1, row2));
48 list_box.set_header_func ((Gtk.ListBoxUpdateHeaderFunc) update_header);51 list_box.set_header_func ((Gtk.ListBoxUpdateHeaderFunc) update_header);
52 list_box.set_selection_mode (Gtk.SelectionMode.BROWSE);
49 list_box.row_activated.connect ((row) => {53 list_box.row_activated.connect ((row) => {
50 var search_item = row as SearchItem;54 var search_item = row as SearchItem;
51 if (search_item.result_type == SearchItem.ResultType.APP_ACTIONS || search_item.result_type == SearchItem.ResultType.LINK) {55 if (!dragging) {
52 search_item.app.match.execute (null);56 if (search_item.result_type == SearchItem.ResultType.APP_ACTIONS || search_item.result_type == SearchItem.ResultType.LINK) {
53 } else {57 search_item.app.match.execute (null);
54 search_item.app.launch ();58 } else {
55 }59 search_item.app.launch ();
5660 }
57 app_launched ();61
62 app_launched ();
63 }
64 });
65
66 // Drag support
67 Gtk.TargetEntry dnd = {"text/uri-list", 0, 0};
68 Gtk.drag_source_set (list_box, Gdk.ModifierType.BUTTON1_MASK, {dnd}, Gdk.DragAction.COPY);
69
70 list_box.motion_notify_event.connect ((event) => {
71 if (!dragging) {
72 list_box.select_row (list_box.get_row_at_y ((int)event.y));
73 }
74 return false;
75 });
76
77 list_box.drag_begin.connect ( (ctx) => {
78 var sr = list_box.get_selected_rows ();
79 if (sr.length () > 0) {
80 var di = (SearchItem)(sr.first ().data);
81 drag_uri = di.app_uri;
82 if (drag_uri != null) {
83 dragging = true;
84 Gtk.drag_set_icon_gicon (ctx, di.icon.gicon, 16, 16);
85 }
86 }
87 });
88
89 list_box.drag_end.connect ( () => {
90 if (drag_uri != null) {
91 app_launched (); /* This causes indicator to close */
92 }
93 dragging = false;
94 drag_uri = null;
95 });
96
97 list_box.drag_data_get.connect ( (ctx, sel, info, time) => {
98 if (drag_uri != null) {
99 sel.set_uris ({drag_uri});
100 }
58 });101 });
59102
60 // alert view103 // alert view

Subscribers

People subscribed via source and target branches