Merge lp:~3v1n0/unity-lens-files/add-path-to-preview into lp:unity-lens-files

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: 265
Merged at revision: 264
Proposed branch: lp:~3v1n0/unity-lens-files/add-path-to-preview
Merge into: lp:unity-lens-files
Diff against target: 36 lines (+26/-0)
1 file modified
src/daemon.vala (+26/-0)
To merge this branch: bzr merge lp:~3v1n0/unity-lens-files/add-path-to-preview
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+280901@code.launchpad.net

Commit message

Daemon: show path of the current file in preview

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

+1

review: Approve
Revision history for this message
Amr Ibrahim (amribrahim1987) wrote :

Has this landed in Xenial?

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Yes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/daemon.vala'
2--- src/daemon.vala 2013-07-02 05:55:19 +0000
3+++ src/daemon.vala 2015-12-17 18:01:33 +0000
4@@ -1046,6 +1046,32 @@
5 preview.add_action (email_action);
6 }
7 }
8+
9+ try
10+ {
11+ var path = Path.get_dirname (Filename.from_uri (real_uri));
12+ var home = Environment.get_home_dir ();
13+
14+ if (path.has_prefix (home))
15+ {
16+ var relative_path = path.substring (home.length);
17+
18+ if (relative_path[0] == '\0')
19+ {
20+ path = _("Home");
21+ }
22+ else
23+ {
24+ path = "~" + relative_path;
25+ }
26+ }
27+
28+ preview.add_info (new InfoHint ("path", _("Path"), null, path));
29+ }
30+ catch (Error e)
31+ {
32+ warning ("Failed to get path for '%s': %s", real_uri, e.message);
33+ }
34 }
35 else
36 {

Subscribers

People subscribed via source and target branches