Merge lp:~townsend/unity/fix-app-dash-desktop-dnd into lp:unity

Proposed by Christopher Townsend
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3969
Proposed branch: lp:~townsend/unity/fix-app-dash-desktop-dnd
Merge into: lp:unity
Diff against target: 44 lines (+13/-0)
1 file modified
dash/ResultViewGrid.cpp (+13/-0)
To merge this branch: bzr merge lp:~townsend/unity/fix-app-dash-desktop-dnd
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+257553@code.launchpad.net

Commit message

If dragging an application:// uri type from the Dash to the desktop, change it to a file:// uri type so Nautilus can understand the type a make a copy of it on the desktop.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) :
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/ResultViewGrid.cpp'
2--- dash/ResultViewGrid.cpp 2014-03-20 04:05:39 +0000
3+++ dash/ResultViewGrid.cpp 2015-04-28 18:09:24 +0000
4@@ -27,6 +27,7 @@
5 #include <gtk/gtk.h>
6 #include <gdk/gdk.h>
7 #include <unity-protocol.h>
8+#include <boost/algorithm/string.hpp>
9
10 #include "unity-shared/IntrospectableWrappers.h"
11 #include "unity-shared/Timer.h"
12@@ -36,6 +37,7 @@
13 #include "unity-shared/RawPixel.h"
14 #include "unity-shared/UnitySettings.h"
15 #include "unity-shared/WindowManager.h"
16+#include <UnityCore/DesktopUtilities.h>
17 #include "ResultViewGrid.h"
18 #include "math.h"
19
20@@ -58,6 +60,8 @@
21
22 const RawPixel WIDTH_PADDING = 25_em;
23 const RawPixel SCROLLBAR_WIDTH = 3_em;
24+
25+ const std::string APPLICATION_URI_PREFIX = "application://";
26 }
27
28 NUX_IMPLEMENT_OBJECT_TYPE(ResultViewGrid);
29@@ -916,6 +920,15 @@
30 if (current_drag_result_.empty())
31 current_drag_result_.uri = current_drag_result_.uri.substr(current_drag_result_.uri.find(":") + 1);
32
33+ if (boost::starts_with(current_drag_result_.uri, APPLICATION_URI_PREFIX))
34+ {
35+ auto desktop_id = current_drag_result_.uri.substr(APPLICATION_URI_PREFIX.size());
36+ auto desktop_path = DesktopUtilities::GetDesktopPathById(desktop_id);
37+
38+ if (!desktop_path.empty())
39+ current_drag_result_.uri = "file://" + desktop_path;
40+ }
41+
42 LOG_DEBUG (logger) << "Dnd begin at " <<
43 last_mouse_down_x_ << ", " << last_mouse_down_y_ << " - using; "
44 << current_drag_result_.uri;