Merge lp:~junrrein/pantheon-files/no_permission into lp:~elementary-apps/pantheon-files/trunk

Proposed by Julián Unrrein
Status: Merged
Approved by: Cody Garver
Approved revision: 1123
Merged at revision: 1220
Proposed branch: lp:~junrrein/pantheon-files/no_permission
Merge into: lp:~elementary-apps/pantheon-files/trunk
Prerequisite: lp:~junrrein/pantheon-files/fix-1022934
Diff against target: 149 lines (+24/-14)
6 files modified
libcore/gof-directory-async.vala (+4/-0)
src/View/Chrome/TopMenu.vala (+3/-3)
src/View/LocationBar.vala (+7/-7)
src/View/OverlayBar.vala (+1/-1)
src/View/ViewContainer.vala (+7/-1)
src/View/Window.vala (+2/-2)
To merge this branch: bzr merge lp:~junrrein/pantheon-files/no_permission
Reviewer Review Type Date Requested Status
Julián Unrrein (community) Approve
elementary Apps team Pending
Review via email: mp+168267@code.launchpad.net

Commit message

When trying to access a folder the user doesn't have the necessary permissions to, display a message informing of that situation to fix bug #1189015.

Description of the change

When trying to access a folder the user doesn't have the necessary permissions to, display a message informing of that situation.

To post a comment you must log in.
Revision history for this message
Julián Unrrein (junrrein) wrote :
Revision history for this message
Julián Unrrein (junrrein) wrote :

This currently breaks "All the network".

review: Needs Fixing
1120. By Julián Unrrein

Fix a regression where the "You don't have permission" window was shown when opening "All the network".

Revision history for this message
Julián Unrrein (junrrein) wrote :

It should work properly now.

review: Approve
1121. By Julián Unrrein

Refactor a little.

1122. By Julián Unrrein

Merge changes from trunk.

1123. By Julián Unrrein

Merge changes from parent branch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libcore/gof-directory-async.vala'
2--- libcore/gof-directory-async.vala 2013-06-13 15:46:28 +0000
3+++ libcore/gof-directory-async.vala 2013-06-13 15:46:28 +0000
4@@ -40,6 +40,8 @@
5 public HashTable<GLib.File,GOF.File> file_hash;
6
7 public uint files_count = 0;
8+
9+ public bool permission_denied = false;
10
11 private Cancellable cancellable;
12 private FileMonitor? monitor = null;
13@@ -267,6 +269,8 @@
14 state = State.NOT_LOADED;
15 if (err is IOError.NOT_FOUND || err is IOError.NOT_DIRECTORY)
16 file.exists = false;
17+ if (err is IOError.PERMISSION_DENIED)
18+ permission_denied = true;
19 if (err is IOError.NOT_MOUNTED) {
20 file.is_mounted = false;
21 /* try again this time it shoould be mounted */
22
23=== modified file 'src/View/Chrome/TopMenu.vala'
24--- src/View/Chrome/TopMenu.vala 2013-06-13 15:46:28 +0000
25+++ src/View/Chrome/TopMenu.vala 2013-06-13 15:46:28 +0000
26@@ -86,10 +86,10 @@
27 }
28
29 location_bar.escape.connect( () => {
30- if (win.current_tab.slot.directory.file.exists)
31- win.current_tab.slot.view_box.grab_focus();
32+ if (win.current_tab.content_shown)
33+ win.current_tab.content.grab_focus ();
34 else
35- win.current_tab.content.grab_focus();
36+ win.current_tab.slot.view_box.grab_focus ();
37 });
38 location_bar.activate.connect(() => { win.current_tab.path_changed(File.new_for_commandline_arg(location_bar.path)); });
39 location_bar.activate_alternate.connect((a) => { win.add_tab(File.new_for_commandline_arg(a)); });
40
41=== modified file 'src/View/LocationBar.vala'
42--- src/View/LocationBar.vala 2013-06-13 15:46:28 +0000
43+++ src/View/LocationBar.vala 2013-06-13 15:46:28 +0000
44@@ -70,11 +70,11 @@
45
46 private void on_bread_changed (string changed) {
47 /* focus back the view */
48- if (win.current_tab.slot.directory.file.exists)
49+ if (win.current_tab.content_shown)
50+ win.current_tab.content.grab_focus ();
51+ else
52 win.current_tab.slot.view_box.grab_focus ();
53- else
54- win.current_tab.content.grab_focus ();
55-
56+
57 //_path = changed;
58 path = changed;
59 activate();
60@@ -194,10 +194,10 @@
61
62 entry.down.connect (() => {
63 /* focus back the view */
64- if (win.current_tab.slot.directory.file.exists)
65+ if (win.current_tab.content_shown)
66+ win.current_tab.content.grab_focus ();
67+ else
68 win.current_tab.slot.view_box.grab_focus ();
69- else
70- win.current_tab.content.grab_focus ();
71 });
72
73 entry.completed.connect(() => {
74
75=== modified file 'src/View/OverlayBar.vala'
76--- src/View/OverlayBar.vala 2013-06-13 15:46:28 +0000
77+++ src/View/OverlayBar.vala 2013-05-29 09:59:12 +0000
78@@ -180,7 +180,7 @@
79 real_update (list);
80 } else {
81 GOF.Window.Slot slot = window.current_tab.slot;
82- if (slot != null && slot.directory.file.exists) {
83+ if (slot != null) {
84 unowned List<GOF.File> list = ((FM.Directory.View) slot.view_box).get_selection ();
85 real_update (list);
86 }
87
88=== modified file 'src/View/ViewContainer.vala'
89--- src/View/ViewContainer.vala 2013-06-13 15:46:28 +0000
90+++ src/View/ViewContainer.vala 2013-06-13 15:46:28 +0000
91@@ -26,6 +26,7 @@
92 namespace Marlin.View {
93 public class ViewContainer : Gtk.Overlay {
94 public Gtk.Widget? content_item;
95+ public bool content_shown = false;
96 public Gtk.Label label;
97 private Marlin.View.Window window;
98 public GOF.Window.Slot? slot = null;
99@@ -103,6 +104,7 @@
100 add(value);
101 content_item = value;
102 content_item.show_all ();
103+ content_shown = true;
104 }
105 get{
106 return content_item;
107@@ -165,7 +167,11 @@
108 public void directory_done_loading () {
109 if (!slot.directory.file.exists) {
110 content = new DirectoryNotFound (slot.directory, this);
111+ } else if (slot.directory.permission_denied) {
112+ content = new Granite.Widgets.Welcome (_("This does not belong to you."),
113+ _("You don't have permission to view this folder."));
114 } else {
115+ content_shown = false;
116 if (select_childs != null)
117 ((FM.Directory.View) slot.view_box).select_glib_files (select_childs);
118 }
119@@ -183,7 +189,7 @@
120 /* we re just changing view keep the same location */
121 location = get_active_slot ().location;
122 /* store the old selection to restore it */
123- if (slot != null && slot.directory.file.exists) {
124+ if (slot != null && !content_shown) {
125 unowned List<GOF.File> list = ((FM.Directory.View) slot.view_box).get_selection ();
126 foreach (var elem in list)
127 select_childs.prepend (elem.location);
128
129=== modified file 'src/View/Window.vala'
130--- src/View/Window.vala 2013-06-13 15:46:28 +0000
131+++ src/View/Window.vala 2013-06-13 15:46:28 +0000
132@@ -276,7 +276,7 @@
133 }
134
135 public void colorize_current_tab_selection (int n) {
136- if (current_tab.slot.directory.file.exists)
137+ if (!current_tab.content_shown)
138 ((FM.Directory.View) current_tab.slot.view_box).colorize_selection(n);
139 }
140
141@@ -311,7 +311,7 @@
142 /* update radio action view state */
143 update_action_radio_view(current_tab.view_mode);
144 /* sync selection */
145- if (cur_slot.view_box != null && cur_slot.directory.file.exists)
146+ if (cur_slot.view_box != null && !current_tab.content_shown)
147 ((FM.Directory.View) cur_slot.view_box).sync_selection();
148 /* sync sidebar selection */
149 loading_uri (current_tab.slot.directory.file.uri, sidebar);

Subscribers

People subscribed via source and target branches

to all changes: