17
17
* Boston, MA 02111-1307, USA.
20
public class PermissionButton : Gtk.Box {
20
public class PermissionButton : Gtk.Grid {
21
21
public Gtk.ToggleButton btn_read;
22
22
public Gtk.ToggleButton btn_write;
23
23
public Gtk.ToggleButton btn_exe;
25
public Marlin.View.PropertiesWindow.PermissionType permission_type { get; construct; }
33
public PermissionButton (Marlin.View.PropertiesWindow.PermissionType permission_type) {
25
public Permissions.Type permission_type { get; construct; }
27
private Posix.mode_t[,] vfs_perms = {
28
{ Posix.S_IRUSR, Posix.S_IWUSR, Posix.S_IXUSR },
29
{ Posix.S_IRGRP, Posix.S_IWGRP, Posix.S_IXGRP },
30
{ Posix.S_IROTH, Posix.S_IWOTH, Posix.S_IXOTH }
33
public PermissionButton (Permissions.Type permission_type) {
34
34
Object (permission_type: permission_type);
38
38
btn_read = new Gtk.ToggleButton.with_label (_("Read"));
39
39
btn_read.set_data ("permissiontype", permission_type);
40
btn_read.set_data ("permissionvalue", Value.READ);
40
btn_read.set_data ("permissionvalue", Permissions.Value.READ);
42
42
btn_write = new Gtk.ToggleButton.with_label (_("Write"));
43
43
btn_write.set_data ("permissiontype", permission_type);
44
btn_write.set_data ("permissionvalue", Value.WRITE);
44
btn_write.set_data ("permissionvalue", Permissions.Value.WRITE);
46
46
btn_exe = new Gtk.ToggleButton.with_label (_("Execute"));
47
47
btn_exe.set_data ("permissiontype", permission_type);
48
btn_exe.set_data ("permissionvalue", Value.EXE);
48
btn_exe.set_data ("permissionvalue", Permissions.Value.EXE);
50
column_homogeneous = true;
51
51
get_style_context ().add_class (Gtk.STYLE_CLASS_LINKED);
57
public void update_buttons (uint32 permissions) {
58
if ((permissions & vfs_perms[permission_type, 0]) != 0) {
59
btn_read.active = true;
61
btn_read.active = false;
64
if ((permissions & vfs_perms[permission_type, 1]) != 0) {
65
btn_write.active = true;
67
btn_write.active = false;
70
if ((permissions & vfs_perms[permission_type, 2]) != 0) {
71
btn_exe.active = true;
73
btn_exe.active = false;