Skip to content

Commit

Permalink
Refactored usage of split saving tabs and tab-zooms func to avoid dup…
Browse files Browse the repository at this point in the history
…licated code
  • Loading branch information
ldrahnik committed Oct 30, 2023
1 parent 0cbd59d commit 2574910
Showing 1 changed file with 2 additions and 38 deletions.
40 changes: 2 additions & 38 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -1410,44 +1410,8 @@ namespace Terminal {
}

private void save_opened_terminals_with_zooms () {
string[] opened_tabs = {};
string[] zooms = {};
int focused_tab = 0;

Application.saved_state.set_double ("zoom", current_terminal.font_scale);

if (Granite.Services.System.history_is_enabled () &&
Application.settings.get_boolean ("remember-tabs")) {

terminals.foreach ((term) => {
if (term != null) {
var location = term.get_shell_location ();
if (location != null && location != "") {
opened_tabs += location;
zooms += term.font_scale.to_string (); // Locale independent
}
}
});

if (notebook.current != null) {
focused_tab = notebook.get_tab_position (notebook.current);
}
}

Terminal.Application.saved_state.set_strv (
"tabs",
opened_tabs
);

Terminal.Application.saved_state.set_strv (
"tab-zooms",
zooms
);

Terminal.Application.saved_state.set_int (
"focused-tab",
focused_tab
);
save_opened_terminals ();
save_opened_terminal_zoom (current_terminal);
}

/** Return enough of @path to distinguish it from @conflict_path **/
Expand Down

0 comments on commit 2574910

Please sign in to comment.