Merge lp:~mhr3/unity-lens-files/fix-837810 into lp:unity-lens-files

Proposed by Michal Hruby
Status: Merged
Approved by: Michal Hruby
Approved revision: 227
Merged at revision: 226
Proposed branch: lp:~mhr3/unity-lens-files/fix-837810
Merge into: lp:unity-lens-files
Diff against target: 54 lines (+16/-2)
2 files modified
src/folder.vala (+15/-1)
tests/manual/folders.txt (+1/-1)
To merge this branch: bzr merge lp:~mhr3/unity-lens-files/fix-837810
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Review via email: mp+100986@code.launchpad.net

Commit message

Added desktop to favourites as requested by design

Description of the change

Added desktop to favourites as requested by design.

Updated the 'folders' manual test.

To post a comment you must log in.
Revision history for this message
Gord Allott (gordallott) wrote :

Looks good, +1

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

No commit message specified.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/folder.vala'
2--- src/folder.vala 2012-03-05 09:36:13 +0000
3+++ src/folder.vala 2012-04-05 15:02:22 +0000
4@@ -52,6 +52,11 @@
5 {
6 bookmarks = new List<Bookmark> ();
7 string contents;
8+ string desktop_uri;
9+ bool has_desktop_in_favourites = false;
10+
11+ File desktop_file = File.new_for_path (Environment.get_user_special_dir (UserDirectory.DESKTOP));
12+ desktop_uri = desktop_file.get_uri ();
13
14 try {
15 FileUtils.get_contents (bookmarks_file, out contents);
16@@ -64,11 +69,12 @@
17 string[] favorites = contents.split ("\n");
18 string mimetype = "inode/directory";
19
20-
21 foreach (var uri in favorites)
22 {
23 if (uri == "")
24 continue;
25+
26+ if (uri == desktop_uri) has_desktop_in_favourites = true;
27
28 string[] parts = uri.split (" ", 2);
29 string display_name;
30@@ -93,6 +99,14 @@
31 var bookmark = new Bookmark (uri, mimetype, display_name);
32 bookmarks.append (bookmark);
33 }
34+
35+ /* Add desktop statically */
36+ if (!has_desktop_in_favourites)
37+ {
38+ var desktop_display_name = Path.get_basename (desktop_file.get_parse_name ());
39+ var desktop_bookmark = new Bookmark (desktop_uri, mimetype, desktop_display_name);
40+ bookmarks.append (desktop_bookmark);
41+ }
42 }
43
44 /* makes sure the uris exist on the filesystem (checks only native uris) */
45
46=== modified file 'tests/manual/folders.txt'
47--- tests/manual/folders.txt 2012-04-04 10:10:09 +0000
48+++ tests/manual/folders.txt 2012-04-05 15:02:22 +0000
49@@ -6,5 +6,5 @@
50 #. Perform a generic search in the home view. (for example 'd')
51
52 Outcome
53- You should see "Files and Folders" category with both folders starting with 'd', followed by files containing 'd' or residing in a folder with 'd' in name.
54+ You should see "Files and Folders" category with both folders starting with 'd' (including "Desktop"), followed by files containing 'd' or residing in a folder with 'd' in name.
55

Subscribers

People subscribed via source and target branches