Merge lp:~hyuchia/pantheon-files/fix-1124209 into lp:~elementary-apps/pantheon-files/trunk

Proposed by Diego Islas Ocampo
Status: Rejected
Rejected by: Danielle Foré
Proposed branch: lp:~hyuchia/pantheon-files/fix-1124209
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 373 lines (+154/-124)
4 files modified
src/CMakeLists.txt (+2/-2)
src/Dialogs/PropertiesWindow.vala (+65/-46)
src/View/Widgets/PermissionButton.vala (+0/-76)
src/View/Widgets/PermissionComboBox.vala (+87/-0)
To merge this branch: bzr merge lp:~hyuchia/pantheon-files/fix-1124209
Reviewer Review Type Date Requested Status
Jeremy Wootten code Approve
elementary UX ui Pending
Review via email: mp+318296@code.launchpad.net

Description of the change

Modified the Permissions Labels for directories while keeping the previous ones for files.

To post a comment you must log in.
Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Some minor code style issues (see inline) comments. Also needs merging with latest trunk to remove irrelevant diff contents.

The code is otherwise OK for this solution, however UX input is needed on the wording and whether this is an acceptable interim solution. The word "Modify" is problematic - it implies you can modify the files inside but you can only create and delete them. I am not sure what single word would convey this and "Create/Delete files" would be too long. Ideally, the buttons need replacing with comboboxes as per Dan's mockup in the bug report. This would allow space for more meaningful descriptions of the permissions on directories. However, that is not strictly within the scope of the bitesize bug. Maybe use tooltips for the buttons?

review: Needs Fixing (code)
Revision history for this message
Diego Islas Ocampo (hyuchia) wrote :

Ok so using combo boxes instead of buttons, the options required would be:
- Read
- Write
- Execute
- Read and Write
- Read and Execute
- Write and Execute
- Read, Write and Execute

Is that right? Oh and you are right about the code style issues, my bad.

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Hi Diego, you would need a "No access" option as well and the exact wording would have to be decided by the design team. For example "Read only" might be preferred. Also you would need a different set for folders. I'll ask someone from the design for comment.

2509. By Diego Islas Ocampo

Replace permission grid buttons with comboboxes

2510. By Diego Islas Ocampo

Fix po merging issues

2511. By Diego Islas Ocampo

Merge from trunk

2512. By Diego Islas Ocampo

Fix directory determination

2513. By Diego Islas Ocampo

Remove explicit 'this' markers

Revision history for this message
Diego Islas Ocampo (hyuchia) wrote :

All right, so I managed to replace the grid buttons with the combo boxes and make them actually work, as well as merging with the latest trunk. Now I'll wait for the UX team to take a look since the wording and order of the options is up to them I guess. Codewise I'm not sure if that's the best solution but I think it's ok. Thanks!

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

A few inline comments.

2514. By Diego Islas Ocampo

Remove unnecessary unowned declarations and improve no access labels

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Another small inline comment but basically waiting for UX team approval of wording now.

2515. By Diego Islas Ocampo

Keep consistency on permission labels

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

When a mixture of files and folders is selected, the wording for permissions is that for files - but I cannot see any better alternative.

review: Approve (code)
Revision history for this message
Danielle Foré (danrabbit) wrote :

It seems like we have a problem where we've made it easier to read which permissions are being applied but we made it much harder to set those permissions. I think this probably needs from more thought from UX team. In the interest of moving to GitHub in a timely manner, I'm going to reject this branch for now. Please re-propose there

Unmerged revisions

2515. By Diego Islas Ocampo

Keep consistency on permission labels

2514. By Diego Islas Ocampo

Remove unnecessary unowned declarations and improve no access labels

2513. By Diego Islas Ocampo

Remove explicit 'this' markers

2512. By Diego Islas Ocampo

Fix directory determination

2511. By Diego Islas Ocampo

Merge from trunk

2510. By Diego Islas Ocampo

Fix po merging issues

2509. By Diego Islas Ocampo

Replace permission grid buttons with comboboxes

2508. By Diego Islas Ocampo

Remove unnecessary parameters

2507. By Diego Islas Ocampo

Add different permission labels to folders

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/CMakeLists.txt'
2--- src/CMakeLists.txt 2017-02-01 14:42:37 +0000
3+++ src/CMakeLists.txt 2017-03-07 02:41:21 +0000
4@@ -105,7 +105,7 @@
5 View/Widgets/LocationBar.vala
6 View/Widgets/MultiLineEditableLabel.vala
7 View/Widgets/OverlayBar.vala
8- View/Widgets/PermissionButton.vala
9+ View/Widgets/PermissionComboBox.vala
10 View/Widgets/ProgressInfoWidget.vala
11 View/Widgets/SingleLineEditableLabel.vala
12 View/Widgets/TopMenu.vala
13@@ -171,7 +171,7 @@
14 View/Widgets/LocationBar.vala
15 View/Widgets/MultiLineEditableLabel.vala
16 View/Widgets/OverlayBar.vala
17- View/Widgets/PermissionButton.vala
18+ View/Widgets/PermissionComboBox.vala
19 View/Widgets/ProgressInfoWidget.vala
20 View/Widgets/SingleLineEditableLabel.vala
21 View/Widgets/TopMenu.vala
22
23=== modified file 'src/Dialogs/PropertiesWindow.vala'
24--- src/Dialogs/PropertiesWindow.vala 2017-02-10 19:35:18 +0000
25+++ src/Dialogs/PropertiesWindow.vala 2017-03-07 02:41:21 +0000
26@@ -27,9 +27,9 @@
27 private bool perm_code_should_update = true;
28 private Gtk.Label l_perm;
29
30- private PermissionButton perm_button_user;
31- private PermissionButton perm_button_group;
32- private PermissionButton perm_button_other;
33+ private PermissionComboBox perm_combo_user;
34+ private PermissionComboBox perm_combo_group;
35+ private PermissionComboBox perm_combo_other;
36
37 private Gtk.ListStore store_users;
38 private Gtk.ListStore store_groups;
39@@ -183,7 +183,7 @@
40 construct_info_panel (goffile);
41 cancellable = new GLib.Cancellable ();
42
43- update_selection_size (); /* Start counting first to get number of selected files and folders */
44+ update_selection_size (); /* Start counting first to get number of selected files and folders */
45
46 /* create some widgets first (may be hidden by update_selection_size ()) */
47 var file_pix = goffile.get_icon_pixbuf (48, false, GOF.FileIconFlags.NONE);
48@@ -650,41 +650,60 @@
49 return false;
50 }
51
52- private void update_perm_codes (Permissions.Type pt, int val, int mult) {
53+ private void update_perm_codes (Permissions.Type pt, int val) {
54 switch (pt) {
55- case Permissions.Type.USER:
56- owner_perm_code += mult*val;
57- break;
58- case Permissions.Type.GROUP:
59- group_perm_code += mult*val;
60- break;
61- case Permissions.Type.OTHER:
62- everyone_perm_code += mult*val;
63- break;
64+ case Permissions.Type.USER:
65+ owner_perm_code = val;
66+ break;
67+ case Permissions.Type.GROUP:
68+ group_perm_code = val;
69+ break;
70+ case Permissions.Type.OTHER:
71+ everyone_perm_code = val;
72+ break;
73 }
74 }
75
76- private void permission_button_toggle (Gtk.ToggleButton btn) {
77- unowned Permissions.Type pt = btn.get_data ("permissiontype");
78- unowned Permissions.Value permission_value = btn.get_data ("permissionvalue");
79- int mult = 1;
80+ private void combo_permissions_changed (Gtk.ComboBox combo) {
81+ Permissions.Type pt = ((PermissionComboBox) combo).permission_type;
82+ int active_perm = combo.get_active ();
83
84 reset_and_cancel_perm_timeout ();
85
86- if (!btn.get_active ()) {
87- mult = -1;
88- }
89+ switch (active_perm) {
90+ // Read, Write and Execute is selected
91+ case 0:
92+ update_perm_codes (pt, 7);
93+ break;
94+ // Write and Execute is selected
95+ case 1:
96+ update_perm_codes (pt, 3);
97+ break;
98+ // Read and Execute is selected
99+ case 2:
100+ update_perm_codes (pt, 5);
101+ break;
102+ // Read and Write is selected
103+ case 3:
104+ update_perm_codes (pt, 6);
105+ break;
106+ // Execute is selected
107+ case 4:
108+ update_perm_codes (pt, 1);
109+ break;
110+ // Write is selected
111+ case 5:
112+ update_perm_codes (pt, 2);
113+ break;
114+ // Read is selected
115+ case 6:
116+ update_perm_codes (pt, 4);
117+ break;
118+ // No permissions selected
119+ case 7:
120+ update_perm_codes (pt, 0);
121+ break;
122
123- switch (permission_value) {
124- case Permissions.Value.READ:
125- update_perm_codes (pt, 4, mult);
126- break;
127- case Permissions.Value.WRITE:
128- update_perm_codes (pt, 2, mult);
129- break;
130- case Permissions.Value.EXE:
131- update_perm_codes (pt, 1, mult);
132- break;
133 }
134
135 if (perm_code_should_update) {
136@@ -692,12 +711,10 @@
137 }
138 }
139
140- private PermissionButton create_perm_choice (Permissions.Type pt) {
141- var permission_button = new PermissionButton (pt);
142- permission_button.btn_read.toggled.connect (permission_button_toggle);
143- permission_button.btn_write.toggled.connect (permission_button_toggle);
144- permission_button.btn_exe.toggled.connect (permission_button_toggle);
145- return permission_button;
146+ private PermissionComboBox create_perm_choice (Permissions.Type pt) {
147+ var permission_combo = new PermissionComboBox (pt, goffile.is_directory);
148+ permission_combo.changed.connect (combo_permissions_changed);
149+ return permission_combo;
150 }
151
152 private uint32 get_perm_from_chmod_unit (uint32 vfs_perm, int nb,
153@@ -737,9 +754,9 @@
154
155
156 private void update_perm_grid_toggle_states (uint32 permissions) {
157- perm_button_user.update_buttons (permissions);
158- perm_button_group.update_buttons (permissions);
159- perm_button_other.update_buttons (permissions);
160+ perm_combo_user.update (permissions);
161+ perm_combo_group.update (permissions);
162+ perm_combo_other.update (permissions);
163 }
164
165 private void reset_and_cancel_perm_timeout () {
166@@ -872,13 +889,13 @@
167 group_combo.margin_bottom = 12;
168
169 var owner_label = new KeyLabel (_("Owner:"));
170- perm_button_user = create_perm_choice (Permissions.Type.USER);
171+ perm_combo_user = create_perm_choice (Permissions.Type.USER);
172
173 var group_label = new KeyLabel (_("Group:"));
174- perm_button_group = create_perm_choice (Permissions.Type.GROUP);
175+ perm_combo_group = create_perm_choice (Permissions.Type.GROUP);
176
177 var other_label = new KeyLabel (_("Everyone:"));
178- perm_button_other = create_perm_choice (Permissions.Type.OTHER);
179+ perm_combo_other = create_perm_choice (Permissions.Type.OTHER);
180
181 perm_code = new Gtk.Entry ();
182 perm_code.text = "000";
183@@ -896,12 +913,14 @@
184 perm_grid.attach (owner_user_choice, 1, 1, 2, 1);
185 perm_grid.attach (group_combo_label, 0, 2, 1, 1);
186 perm_grid.attach (group_combo, 1, 2, 2, 1);
187+
188+
189 perm_grid.attach (owner_label, 0, 3, 1, 1);
190- perm_grid.attach (perm_button_user, 1, 3, 2, 1);
191+ perm_grid.attach (perm_combo_user, 1, 3, 2, 1);
192 perm_grid.attach (group_label, 0, 4, 1, 1);
193- perm_grid.attach (perm_button_group, 1, 4, 2, 1);
194+ perm_grid.attach (perm_combo_group, 1, 4, 2, 1);
195 perm_grid.attach (other_label, 0, 5, 1, 1);
196- perm_grid.attach (perm_button_other, 1, 5, 2, 1);
197+ perm_grid.attach (perm_combo_other, 1, 5, 2, 1);
198 perm_grid.attach (l_perm, 1, 6, 1, 1);
199 perm_grid.attach (perm_code, 2, 6, 1, 1);
200
201
202=== removed file 'src/View/Widgets/PermissionButton.vala'
203--- src/View/Widgets/PermissionButton.vala 2017-02-10 19:35:18 +0000
204+++ src/View/Widgets/PermissionButton.vala 1970-01-01 00:00:00 +0000
205@@ -1,76 +0,0 @@
206-/*
207-* Copyright (c) 2016-2017 elementary LLC. (http://launchpad.net/pantheon-files)
208-*
209-* This program is free software; you can redistribute it and/or
210-* modify it under the terms of the GNU General Public
211-* License as published by the Free Software Foundation, Inc.,; either
212-* version 2 of the License, or (at your option) any later version.
213-*
214-* This program is distributed in the hope that it will be useful,
215-* but WITHOUT ANY WARRANTY; without even the implied warranty of
216-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
217-* General Public License for more details.
218-*
219-* You should have received a copy of the GNU General Public
220-* License along with this program; if not, write to the
221-* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
222-* Boston, MA 02110-1335 USA.
223-*/
224-
225-public class PermissionButton : Gtk.Grid {
226- public Gtk.ToggleButton btn_read;
227- public Gtk.ToggleButton btn_write;
228- public Gtk.ToggleButton btn_exe;
229-
230- public Permissions.Type permission_type { get; construct; }
231-
232- private Posix.mode_t[,] vfs_perms = {
233- { Posix.S_IRUSR, Posix.S_IWUSR, Posix.S_IXUSR },
234- { Posix.S_IRGRP, Posix.S_IWGRP, Posix.S_IXGRP },
235- { Posix.S_IROTH, Posix.S_IWOTH, Posix.S_IXOTH }
236- };
237-
238- public PermissionButton (Permissions.Type permission_type) {
239- Object (permission_type: permission_type);
240- }
241-
242- construct {
243- btn_read = new Gtk.ToggleButton.with_label (_("Read"));
244- btn_read.set_data ("permissiontype", permission_type);
245- btn_read.set_data ("permissionvalue", Permissions.Value.READ);
246-
247- btn_write = new Gtk.ToggleButton.with_label (_("Write"));
248- btn_write.set_data ("permissiontype", permission_type);
249- btn_write.set_data ("permissionvalue", Permissions.Value.WRITE);
250-
251- btn_exe = new Gtk.ToggleButton.with_label (_("Execute"));
252- btn_exe.set_data ("permissiontype", permission_type);
253- btn_exe.set_data ("permissionvalue", Permissions.Value.EXE);
254-
255- column_homogeneous = true;
256- get_style_context ().add_class (Gtk.STYLE_CLASS_LINKED);
257- add (btn_read);
258- add (btn_write);
259- add (btn_exe);
260- }
261-
262- public void update_buttons (uint32 permissions) {
263- if ((permissions & vfs_perms[permission_type, 0]) != 0) {
264- btn_read.active = true;
265- } else {
266- btn_read.active = false;
267- }
268-
269- if ((permissions & vfs_perms[permission_type, 1]) != 0) {
270- btn_write.active = true;
271- } else {
272- btn_write.active = false;
273- }
274-
275- if ((permissions & vfs_perms[permission_type, 2]) != 0) {
276- btn_exe.active = true;
277- } else {
278- btn_exe.active = false;
279- }
280- }
281-}
282
283=== added file 'src/View/Widgets/PermissionComboBox.vala'
284--- src/View/Widgets/PermissionComboBox.vala 1970-01-01 00:00:00 +0000
285+++ src/View/Widgets/PermissionComboBox.vala 2017-03-07 02:41:21 +0000
286@@ -0,0 +1,87 @@
287+/*
288+* Copyright (c) 2016-2017 elementary LLC. (http://launchpad.net/pantheon-files)
289+*
290+* This program is free software; you can redistribute it and/or
291+* modify it under the terms of the GNU General Public
292+* License as published by the Free Software Foundation, Inc.,; either
293+* version 2 of the License, or (at your option) any later version.
294+*
295+* This program is distributed in the hope that it will be useful,
296+* but WITHOUT ANY WARRANTY; without even the implied warranty of
297+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
298+* General Public License for more details.
299+*
300+* You should have received a copy of the GNU General Public
301+* License along with this program; if not, write to the
302+* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
303+* Boston, MA 02110-1335 USA.
304+*/
305+
306+public class PermissionComboBox : Gtk.ComboBoxText {
307+
308+ private bool perm_read;
309+ private bool perm_write;
310+ private bool perm_exe;
311+
312+ public bool is_directory { get; construct; }
313+
314+ public Permissions.Type permission_type { get; construct; }
315+
316+ private Posix.mode_t[,] vfs_perms = {
317+ { Posix.S_IRUSR, Posix.S_IWUSR, Posix.S_IXUSR },
318+ { Posix.S_IRGRP, Posix.S_IWGRP, Posix.S_IXGRP },
319+ { Posix.S_IROTH, Posix.S_IWOTH, Posix.S_IXOTH }
320+ };
321+
322+ public PermissionComboBox (Permissions.Type permission_type, bool is_directory) {
323+ Object (permission_type: permission_type, is_directory: is_directory);
324+ }
325+
326+ construct {
327+ if (is_directory){
328+ append_text (_("List, Write and Access"));
329+ append_text (_("Write and Access"));
330+ append_text (_("List and Access"));
331+ append_text (_("List and Write"));
332+ append_text (_("Access Only"));
333+ append_text (_("Write Only"));
334+ append_text (_("List Only"));
335+ append_text (_("No Permissions"));
336+ } else {
337+ append_text (_("Read, Write and Execute"));
338+ append_text (_("Write and Execute"));
339+ append_text (_("Read and Execute"));
340+ append_text (_("Read and Write"));
341+ append_text (_("Execute Only"));
342+ append_text (_("Write Only"));
343+ append_text (_("Read Only"));
344+ append_text (_("No Permissions"));
345+ }
346+
347+ get_style_context ().add_class (Gtk.STYLE_CLASS_LINKED);
348+
349+ }
350+
351+ public void update (uint32 permissions) {
352+ perm_read = (permissions & vfs_perms[permission_type, 0]) != 0;
353+ perm_write = (permissions & vfs_perms[permission_type, 1]) != 0;
354+ perm_exe = (permissions & vfs_perms[permission_type, 2]) != 0;
355+ if (perm_read && perm_write && perm_exe) {
356+ active = 0;
357+ } else if (perm_write && perm_exe) {
358+ active = 1;
359+ } else if (perm_read && perm_exe) {
360+ active = 2;
361+ } else if (perm_read && perm_write) {
362+ active = 3;
363+ } else if (perm_exe) {
364+ active = 4;
365+ } else if (perm_write) {
366+ active = 5;
367+ } else if (perm_read) {
368+ active = 6;
369+ } else {
370+ active = 7;
371+ }
372+ }
373+}

Subscribers

People subscribed via source and target branches