Skip to content

Commit

Permalink
Fix preferences crash/hang
Browse files Browse the repository at this point in the history
  • Loading branch information
lainsce committed Jul 17, 2024
1 parent 0c44b67 commit c723cbe
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 32 deletions.
35 changes: 21 additions & 14 deletions src/gtk/preferences-window.blp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ template TerminalPreferencesWindow : He.SettingsWindow {
default-width: 550;
default-height: 720;
resizable: false;
modal: false;
modal: true;

[page]
He.SettingsPage {
title: _("General");
vexpand: true;
Expand All @@ -29,7 +30,8 @@ template TerminalPreferencesWindow : He.SettingsWindow {
title: _("Remember Window Size");
activatable-widget: remember_window_size_switch;

Switch remember_window_size_switch {
[child]
He.Switch remember_window_size_switch {
valign: center;
}
}
Expand All @@ -38,7 +40,8 @@ template TerminalPreferencesWindow : He.SettingsWindow {
title: _("Dark Mode");
activatable-widget: style_preference_switch;

Switch style_preference_switch {
[child]
He.Switch style_preference_switch {
valign: center;
}
}
Expand All @@ -51,7 +54,8 @@ template TerminalPreferencesWindow : He.SettingsWindow {
title: _("Expand Tabs");
activatable-widget: fill_tabs_switch;

Switch fill_tabs_switch {
[child]
He.Switch fill_tabs_switch {
valign: center;
}
}
Expand All @@ -64,7 +68,8 @@ template TerminalPreferencesWindow : He.SettingsWindow {
title: _("Show App Bar");
activatable-widget: show_headerbar_switch;

Switch show_headerbar_switch {
[child]
He.Switch show_headerbar_switch {
valign: center;
}
}
Expand All @@ -73,7 +78,8 @@ template TerminalPreferencesWindow : He.SettingsWindow {
title: _("Show Menu Button");
activatable-widget: show_menu_button_switch;

Switch show_menu_button_switch {
[child]
He.Switch show_menu_button_switch {
valign: center;
}
}
Expand All @@ -83,7 +89,8 @@ template TerminalPreferencesWindow : He.SettingsWindow {
subtitle: _("Enable to reserve some space on the left side to drag the window.");
activatable-widget: drag_area_switch;

Switch drag_area_switch {
[child]
He.Switch drag_area_switch {
valign: center;
}
}
Expand All @@ -93,7 +100,8 @@ template TerminalPreferencesWindow : He.SettingsWindow {
subtitle: _("Show floating controls when app bar is hidden.");
activatable-widget: floating_controls_switch;

Switch floating_controls_switch {
[child]
He.Switch floating_controls_switch {
valign: center;
}
}
Expand Down Expand Up @@ -124,6 +132,7 @@ template TerminalPreferencesWindow : He.SettingsWindow {
}
}

[page]
He.SettingsPage {
title: _("Terminal");
vexpand: true;
Expand Down Expand Up @@ -220,7 +229,8 @@ template TerminalPreferencesWindow : He.SettingsWindow {
title: _("Run Command as Login Shell");
activatable-widget: run_command_as_login_switch;

Switch run_command_as_login_switch {
[child]
He.Switch run_command_as_login_switch {
valign: center;
}
}
Expand All @@ -229,7 +239,7 @@ template TerminalPreferencesWindow : He.SettingsWindow {
title: _("Use Custom Command");
activatable-widget: use_custom_shell_command_switch;

Switch use_custom_shell_command_switch {
He.Switch use_custom_shell_command_switch {
valign: center;
}
}
Expand Down Expand Up @@ -341,10 +351,7 @@ template TerminalPreferencesWindow : He.SettingsWindow {
}
}

.TerminalShortcutEditor {
app: bind TerminalPreferencesWindow.application no-sync-create;
}

[page]
He.SettingsPage {
title: _("Advanced");
vexpand: true;
Expand Down
36 changes: 18 additions & 18 deletions src/widgets/PreferencesWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ public class Terminal.PreferencesWindow : He.SettingsWindow {
[GtkChild] unowned Gtk.ToggleButton follow_sys_cursor_toggle;
[GtkChild] unowned Gtk.ToggleButton on_cursor_toggle;
[GtkChild] unowned Gtk.ToggleButton off_cursor_toggle;
[GtkChild] unowned Gtk.Switch style_preference_switch;
[GtkChild] unowned He.Switch style_preference_switch;
[GtkChild] unowned Gtk.Entry custom_command_entry;
[GtkChild] unowned Gtk.Adjustment floating_controls_delay_adjustment;
[GtkChild] unowned Gtk.Adjustment floating_controls_hover_area_adjustment;
[GtkChild] unowned Gtk.CheckButton filter_themes_check_button;
[GtkChild] unowned Gtk.FlowBox preview_flow_box;
[GtkChild] unowned He.TextButton font_label;
[GtkChild] unowned Gtk.Switch fill_tabs_switch;
[GtkChild] unowned Gtk.Switch floating_controls_switch;
[GtkChild] unowned He.Switch fill_tabs_switch;
[GtkChild] unowned He.Switch floating_controls_switch;
[GtkChild] unowned Gtk.SpinButton opacity_spin_button;
[GtkChild] unowned Gtk.Switch remember_window_size_switch;
[GtkChild] unowned Gtk.Switch run_command_as_login_switch;
[GtkChild] unowned Gtk.Switch show_headerbar_switch;
[GtkChild] unowned Gtk.Switch show_menu_button_switch;
[GtkChild] unowned Gtk.Switch use_custom_shell_command_switch;
[GtkChild] unowned Gtk.Switch drag_area_switch;
[GtkChild] unowned He.Switch remember_window_size_switch;
[GtkChild] unowned He.Switch run_command_as_login_switch;
[GtkChild] unowned He.Switch show_headerbar_switch;
[GtkChild] unowned He.Switch show_menu_button_switch;
[GtkChild] unowned He.Switch use_custom_shell_command_switch;
[GtkChild] unowned He.Switch drag_area_switch;
[GtkChild] unowned Gtk.ToggleButton dark_theme_toggle;
[GtkChild] unowned Gtk.ToggleButton light_theme_toggle;

Expand Down Expand Up @@ -150,7 +150,7 @@ public class Terminal.PreferencesWindow : He.SettingsWindow {

settings.schema.bind (
"command-as-login-shell",
this.run_command_as_login_switch,
this.run_command_as_login_switch.iswitch,
"active",
SettingsBindFlags.DEFAULT
);
Expand All @@ -171,7 +171,7 @@ public class Terminal.PreferencesWindow : He.SettingsWindow {

settings.schema.bind (
"use-custom-command",
this.use_custom_shell_command_switch,
this.use_custom_shell_command_switch.iswitch,
"active",
SettingsBindFlags.DEFAULT
);
Expand All @@ -196,35 +196,35 @@ public class Terminal.PreferencesWindow : He.SettingsWindow {

settings.schema.bind (
"fill-tabs",
this.fill_tabs_switch,
this.fill_tabs_switch.iswitch,
"active",
SettingsBindFlags.DEFAULT
);

settings.schema.bind (
"show-menu-button",
this.show_menu_button_switch,
this.show_menu_button_switch.iswitch,
"active",
SettingsBindFlags.DEFAULT
);

settings.schema.bind (
"show-headerbar",
this.show_headerbar_switch,
this.show_headerbar_switch.iswitch,
"active",
SettingsBindFlags.DEFAULT
);

settings.schema.bind (
"headerbar-drag-area",
this.drag_area_switch,
this.drag_area_switch.iswitch,
"active",
SettingsBindFlags.DEFAULT
);

settings.schema.bind (
"remember-window-size",
this.remember_window_size_switch,
this.remember_window_size_switch.iswitch,
"active",
SettingsBindFlags.DEFAULT
);
Expand All @@ -251,11 +251,11 @@ public class Terminal.PreferencesWindow : He.SettingsWindow {
set_cursor_blink (2);
});

settings.schema.bind ("style-preference", style_preference_switch, "active", SettingsBindFlags.DEFAULT);
settings.schema.bind ("style-preference", style_preference_switch.iswitch, "active", SettingsBindFlags.DEFAULT);

settings.schema.bind (
"floating-controls",
this.floating_controls_switch,
this.floating_controls_switch.iswitch,
"active",
SettingsBindFlags.DEFAULT
);
Expand Down

0 comments on commit c723cbe

Please sign in to comment.