Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/FolderManager/FileView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace Scratch.FolderManager {
private GLib.Settings settings;

public signal void select (string file);
public signal void close_all_docs_from_path (string path);

// This is a workaround for SourceList silliness: you cannot remove an item
// without it automatically selecting another one.
Expand Down Expand Up @@ -141,6 +142,7 @@ namespace Scratch.FolderManager {

folder_root.expanded = expand;
folder_root.closed.connect (() => {
close_all_docs_from_path (folder_root.file.path);
root.remove (folder_root);
write_settings ();
});
Expand Down
13 changes: 13 additions & 0 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,19 @@ namespace Scratch {
}
});

folder_manager_view.close_all_docs_from_path.connect ((a) => {
if (!split_view.is_empty ()) {
split_view.views.foreach ((view) => {
var docs = view.docs.copy ();
docs.foreach ((doc) => {
if (doc.file.get_path ().has_prefix (a)) {
view.close_document (doc);
}
});
});
}
});

folder_manager_view.restore_saved_state ();

bottombar = new Gtk.Notebook ();
Expand Down