diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 078184b66..7c4cd1589 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -620,11 +620,7 @@ namespace Scratch { sidebar.choose_project_button.project_chosen.connect (() => { folder_manager_view.collapse_other_projects (); - if (terminal.visible) { - var open_in_terminal_action = Utils.action_from_group (ACTION_OPEN_IN_TERMINAL, actions); - var param = new Variant.string (Services.GitManager.get_instance ().get_default_build_dir (null)); - open_in_terminal_action.activate (param); - } + change_terminal_path (Services.GitManager.get_instance ().get_default_build_dir (null)); }); set_widgets_sensitive (false); @@ -1356,11 +1352,14 @@ namespace Scratch { //If param is null or empty, the active project path build dir is returned or failing that //the active document path - var target_path = get_target_path_for_actions (param, true); - terminal.change_location (target_path); + change_terminal_path (get_target_path_for_actions (param, true)); terminal.terminal.grab_focus (); } + private void change_terminal_path (string path) { + terminal.change_location (path); + } + private void action_toggle_outline (SimpleAction action) { action.set_state (!action.get_state ().get_boolean ()); document_view.outline_visible = action.get_state ().get_boolean ();