Skip to content

Commit

Permalink
Revert to metadata::hidden, save attribute when changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Paul Wootten authored and Jeremy Paul Wootten committed Oct 22, 2023
1 parent 48316d4 commit d31b75d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 4 additions & 4 deletions libcore/File.vala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Files.File : GLib.Object {
"standard::is-hidden,standard::is-backup,standard::is-symlink,standard::type,standard::name," +
"standard::display-name,standard::content-type,standard::fast-content-type,standard::size," +
"standard::symlink-target,standard::target-uri,access::*,time::*,owner::*,trash::*,unix::*,id::filesystem," +
"thumbnail::*,mountable::*,metadata::marlin-sort-column-id,metadata::marlin-sort-reversed";
"thumbnail::*,mountable::*,metadata::marlin-sort-column-id,metadata::marlin-sort-reversed,metadata::hidden";

public signal void changed ();
public signal void icon_changed ();
Expand Down Expand Up @@ -78,8 +78,8 @@ public class Files.File : GLib.Object {
get {
return is_hidden_format ||
(info != null &&
info.has_attribute ("standard::is-hidden") &&
info.get_attribute_boolean ("standard::is-hidden"));
info.has_attribute ("metadata::hidden") &&
bool.parse (info.get_attribute_string ("metadata::hidden")));
}
}
public bool is_hidden_format { get; construct; }
Expand Down Expand Up @@ -189,7 +189,7 @@ public class Files.File : GLib.Object {
}
});

// Filename formats to regard as permanently hidden
// Filename formats to regard as permanently hidden
is_hidden_format = basename.has_prefix (".") ||
basename.has_prefix ("~") ||
basename.has_suffix ("~"); // Temporary backup files are regarded as hidden
Expand Down
14 changes: 10 additions & 4 deletions src/View/AbstractDirectoryView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -1147,11 +1147,17 @@ namespace Files {
var hide = param.get_boolean ();
unowned var selection = get_selected_files ();
foreach (File file in selection) {
if (hide && !file.is_hidden_format && !file.info.has_attribute ("standard::is-hidden")) {
file.info.set_attribute_boolean ("standard::is-hidden", true);
} else if (!hide && file.info.has_attribute ("standard::is-hidden")) {
file.info.set_attribute_boolean ("standard::is-hidden", false);
bool val = false;
if (hide && !file.is_hidden) {
val = true;
} else if (!hide && !file.is_hidden_format) {
val = false;
} else {
continue;
}

file.info.set_attribute_string ("metadata::hidden", val.to_string ());
file.location.set_attribute_string ("metadata::hidden", val.to_string (), FileQueryInfoFlags.NONE, null);
}

// If not showing hidden files reload view to reflect changes
Expand Down

0 comments on commit d31b75d

Please sign in to comment.