@@ -36,7 +36,6 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane
3636 public const string ACTION_CHECKOUT_REMOTE_BRANCH = " checkout-remote-branch" ;
3737 public const string ACTION_CLOSE_FOLDER = " close-folder" ;
3838 public const string ACTION_CLOSE_OTHER_FOLDERS = " close-other-folders" ;
39- public const string ACTION_SET_PROJECT_ACTIVE = " set-project-active" ;
4039
4140 private const ActionEntry [] ACTION_ENTRIES = {
4241 { ACTION_LAUNCH_APP_WITH_FILE_PATH , action_launch_app_with_file_path, " as" },
@@ -48,8 +47,7 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane
4847 { ACTION_NEW_FILE , add_new_file, " s" },
4948 { ACTION_NEW_FOLDER , add_new_folder, " s" },
5049 { ACTION_CLOSE_FOLDER , action_close_folder, " s" },
51- { ACTION_CLOSE_OTHER_FOLDERS , action_close_other_folders, " s" },
52- { ACTION_SET_PROJECT_ACTIVE , action_set_project_active, " s" }
50+ { ACTION_CLOSE_OTHER_FOLDERS , action_close_other_folders, " s" }
5351 };
5452
5553 private GLib . Settings settings;
@@ -127,27 +125,11 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane
127125 set_project_active (path);
128126 }
129127
130- private void action_set_project_active (SimpleAction action , GLib .Variant ? parameter ) {
131- var path = parameter. get_string ();
132- if (path == null || path == " " ) {
133- return ;
134- }
135-
136- var folder_root = find_path (root, path) as ProjectFolderItem ;
137- if (folder_root == null ) {
138- return ;
139- }
140-
141- set_project_active (path);
142- }
143-
144128 private void set_project_active (string path ) {
145129 toplevel_action_group. activate_action (
146130 MainWindow . ACTION_SET_ACTIVE_PROJECT ,
147131 new Variant .string (path)
148132 );
149-
150- write_settings ();
151133 }
152134
153135 public async void restore_saved_state () {
@@ -254,6 +236,10 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane
254236 return null ;
255237 }
256238
239+ public bool project_is_open (string project_path ) {
240+ return get_project_for_file (GLib . File . new_for_path (project_path)) != null ;
241+ }
242+
257243 public ProjectFolderItem ? get_project_for_file (GLib .File file ) {
258244 foreach (var item in root. children) {
259245 if (item is ProjectFolderItem ) {
@@ -588,10 +574,10 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane
588574 }
589575 }
590576 Scratch . Services . GitManager . get_instance (). remove_project (folder_root);
591- write_settings ();
577+ save_opened_folders ();
592578 });
593579
594- write_settings ();
580+ save_opened_folders ();
595581 add_folder. callback ();
596582 return Source . REMOVE ;
597583 });
@@ -606,7 +592,7 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane
606592 return false ;
607593 }
608594
609- private void write_settings () {
595+ private void save_opened_folders () {
610596 string [] to_save = {};
611597
612598 foreach (var main_folder in root. children) {
0 commit comments