Skip to content

Commit

Permalink
Update cyclic search button when toggled (#795)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremypw authored Oct 17, 2024
1 parent 0839048 commit 904290b
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/Widgets/SearchToolbar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,23 @@ namespace Terminal.Widgets {
_("Next result")
);

cycle_button = new Gtk.ToggleButton ();
cycle_button.image = new Gtk.Image.from_icon_name (
"media-playlist-repeat-symbolic", Gtk.IconSize.SMALL_TOOLBAR
);
cycle_button.sensitive = false;
cycle_button.set_can_focus (false);
cycle_button.tooltip_text = _("Cyclic search");
cycle_button = new Gtk.ToggleButton () {
active = false,
sensitive = false,
image = new Gtk.Image ()
};
cycle_button.toggled.connect (() => {
if (cycle_button.active) {
cycle_button.tooltip_text = _("Disable cyclic search");
((Gtk.Image)cycle_button.image).icon_name = "media-playlist-repeat-symbolic";
} else {
cycle_button.tooltip_text = _("Enable cyclic search");
((Gtk.Image)cycle_button.image).icon_name = "media-playlist-repeat-disabled-symbolic";
}
});
// Toggle to update
// TODO Restore state from settings
cycle_button.toggled ();

get_style_context ().add_class (Gtk.STYLE_CLASS_LINKED);
add (search_entry);
Expand Down

0 comments on commit 904290b

Please sign in to comment.