Skip to content

Commit

Permalink
Merge branch 'master' into fix-extra-tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Wootten authored Oct 30, 2023
2 parents 3a99e7a + 94321c0 commit 56989a3
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 33 deletions.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ subdir('po/extra')
subdir('data')
subdir('src')

meson.add_install_script('meson/post_install.py')
gnome.post_install(glib_compile_schemas: true)
10 changes: 0 additions & 10 deletions meson/post_install.py

This file was deleted.

35 changes: 23 additions & 12 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ namespace Terminal {
private Gtk.Clipboard clipboard;
private Gtk.Clipboard primary_selection;
private Terminal.Widgets.SearchToolbar search_toolbar;
private Gtk.Revealer search_revealer;
private Gtk.Label title_label;
private Gtk.Stack title_stack;
private Gtk.ToggleButton search_button;
private Dialogs.ColorPreferences? color_preferences_dialog;
private Granite.AccelLabel open_in_browser_menuitem_label;
Expand Down Expand Up @@ -226,8 +227,6 @@ namespace Terminal {
setup_ui ();
show_all ();

search_revealer.set_reveal_child (false);

update_font ();
Application.settings_sys.changed["monospace-font-name"].connect (update_font);
Application.settings.changed["font"].connect (update_font);
Expand Down Expand Up @@ -312,22 +311,32 @@ namespace Terminal {
valign = Gtk.Align.CENTER
};

search_toolbar = new Terminal.Widgets.SearchToolbar (this);

title_label = new Gtk.Label (title);
title_label.get_style_context ().add_class (Gtk.STYLE_CLASS_TITLE);

title_stack = new Gtk.Stack () {
transition_type = Gtk.StackTransitionType.SLIDE_UP_DOWN
};
title_stack.add (title_label);
title_stack.add (search_toolbar);
// Must show children before visible_child can be set
title_stack.show_all ();
// We set visible child here to avoid transition being visible on startup.
title_stack.visible_child = title_label;

var header = new Hdy.HeaderBar () {
show_close_button = true,
has_subtitle = false
};
header.pack_end (menu_button);
header.pack_end (search_button);
header.set_custom_title (title_stack);

unowned Gtk.StyleContext header_context = header.get_style_context ();
header_context.add_class ("default-decoration");

search_toolbar = new Terminal.Widgets.SearchToolbar (this);

search_revealer = new Gtk.Revealer ();
search_revealer.set_transition_type (Gtk.RevealerTransitionType.SLIDE_DOWN);
search_revealer.add (search_toolbar);

get_simple_action (ACTION_COPY).set_enabled (false);
get_simple_action (ACTION_COPY_LAST_OUTPUT).set_enabled (false);
get_simple_action (ACTION_SCROLL_TO_LAST_COMMAND).set_enabled (false);
Expand Down Expand Up @@ -360,12 +369,13 @@ namespace Terminal {

var grid = new Gtk.Grid ();
grid.attach (header, 0, 0);
grid.attach (search_revealer, 0, 1);
grid.attach (notebook, 0, 2);
grid.attach (notebook, 0, 1);

get_style_context ().add_class ("terminal-window");
add (grid);

bind_property ("title", title_label, "label");

unowned var menu_popover = (SettingsPopover) menu_button.popover;

menu_popover.show_theme_editor.connect (() => {
Expand Down Expand Up @@ -1202,9 +1212,9 @@ namespace Terminal {
var search_state = search_action.get_state ().get_boolean ();

search_action.set_state (!search_state);
search_revealer.set_reveal_child (search_button.active);

if (search_button.active) {
title_stack.visible_child = search_toolbar;
action_accelerators[ACTION_SEARCH_NEXT] = "<Control>g";
action_accelerators[ACTION_SEARCH_NEXT] = "<Control>Down";
action_accelerators[ACTION_SEARCH_PREVIOUS] = "<Control><Shift>g";
Expand All @@ -1215,6 +1225,7 @@ namespace Terminal {
);
search_toolbar.grab_focus ();
} else {
title_stack.visible_child = title_label;
action_accelerators.remove_all (ACTION_SEARCH_NEXT);
action_accelerators.remove_all (ACTION_SEARCH_PREVIOUS);
search_button.tooltip_markup = Granite.markup_accel_tooltip (
Expand Down
16 changes: 6 additions & 10 deletions src/Widgets/SearchToolbar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace Terminal.Widgets {

public class SearchToolbar : Gtk.Grid {
public class SearchToolbar : Gtk.Box {
private Gtk.ToggleButton cycle_button;
private uint last_search_term_length = 0;

Expand Down Expand Up @@ -57,16 +57,12 @@ namespace Terminal.Widgets {
cycle_button.set_can_focus (false);
cycle_button.tooltip_text = _("Cyclic search");

var search_grid = new Gtk.Grid ();
search_grid.margin = 3;
search_grid.get_style_context ().add_class (Gtk.STYLE_CLASS_LINKED);
search_grid.add (search_entry);
search_grid.add (next_button);
search_grid.add (previous_button);
search_grid.add (cycle_button);
get_style_context ().add_class (Gtk.STYLE_CLASS_LINKED);
add (search_entry);
add (next_button);
add (previous_button);
add (cycle_button);

add (search_grid);
get_style_context ().add_class ("search-bar");
show_all ();

grab_focus.connect (() => {
Expand Down
7 changes: 7 additions & 0 deletions src/Widgets/SettingsPopover.vala
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ public sealed class Terminal.SettingsPopover : Gtk.Popover {
active = Application.settings.get_boolean ("natural-copy-paste")
};

var audible_bell_button = new Granite.SwitchModelButton (_("Event Alerts")) {
description = _("Notify for invalid input or multiple possible completions (subject to System SettingsSound)"),
active = Application.settings.get_boolean ("audible-bell")
};

var box = new Gtk.Box (VERTICAL, 6) {
margin_bottom = 6,
margin_top = 12,
Expand All @@ -123,6 +128,7 @@ public sealed class Terminal.SettingsPopover : Gtk.Popover {
box.add (theme_box);
box.add (new Gtk.Separator (HORIZONTAL));
box.add (natural_copy_paste_button);
box.add (audible_bell_button);
child = box;

custom_button.clicked.connect (() => {
Expand All @@ -139,6 +145,7 @@ public sealed class Terminal.SettingsPopover : Gtk.Popover {

Application.settings.bind ("follow-system-style", follow_system_button, "active", DEFAULT);
Application.settings.bind ("natural-copy-paste", natural_copy_paste_button, "active", DEFAULT);
Application.settings.bind ("audible-bell", audible_bell_button, "active", DEFAULT);

Application.settings.changed.connect ((s, n) => {
if (n == "background" || n == "foreground") {
Expand Down

0 comments on commit 56989a3

Please sign in to comment.