From 3b2d7d84e44f1f3e2ef61eef367c03fe63db6a82 Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Wed, 16 Oct 2024 18:19:19 +0100 Subject: [PATCH 1/3] Update cyclic search button when toggled --- src/Widgets/SearchToolbar.vala | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/Widgets/SearchToolbar.vala b/src/Widgets/SearchToolbar.vala index b46e3976dd..ff589363ad 100644 --- a/src/Widgets/SearchToolbar.vala +++ b/src/Widgets/SearchToolbar.vala @@ -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, + can_focus = false, + image = new Gtk.Image () + }; + cycle_button.toggled.connect (() => { + if (cycle_button.active) { + cycle_button.tooltip_text = _("Cyclic search is enabled"); + ((Gtk.Image)cycle_button.image).icon_name = "media-playlist-repeat-symbolic"; + } else { + cycle_button.tooltip_text = _("Cyclic search is disabled"); + ((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); From 3f7b9076ec7171140805ef526f8abc807a4338b5 Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Thu, 17 Oct 2024 11:01:36 +0100 Subject: [PATCH 2/3] Tooltip should describe action when pressed --- src/Widgets/SearchToolbar.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Widgets/SearchToolbar.vala b/src/Widgets/SearchToolbar.vala index ff589363ad..b1996439f0 100644 --- a/src/Widgets/SearchToolbar.vala +++ b/src/Widgets/SearchToolbar.vala @@ -56,10 +56,10 @@ namespace Terminal.Widgets { }; cycle_button.toggled.connect (() => { if (cycle_button.active) { - cycle_button.tooltip_text = _("Cyclic search is enabled"); + cycle_button.tooltip_text = _("Disable cyclic search"); ((Gtk.Image)cycle_button.image).icon_name = "media-playlist-repeat-symbolic"; } else { - cycle_button.tooltip_text = _("Cyclic search is disabled"); + cycle_button.tooltip_text = _("Enable cyclic search"); ((Gtk.Image)cycle_button.image).icon_name = "media-playlist-repeat-disabled-symbolic"; } }); From 9152c4458b0908fea57718b8695b71bc01301603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Thu, 17 Oct 2024 13:32:43 -0700 Subject: [PATCH 3/3] Update SearchToolbar.vala --- src/Widgets/SearchToolbar.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Widgets/SearchToolbar.vala b/src/Widgets/SearchToolbar.vala index b1996439f0..0a0dc8c889 100644 --- a/src/Widgets/SearchToolbar.vala +++ b/src/Widgets/SearchToolbar.vala @@ -51,7 +51,7 @@ namespace Terminal.Widgets { cycle_button = new Gtk.ToggleButton () { active = false, - can_focus = false, + sensitive = false, image = new Gtk.Image () }; cycle_button.toggled.connect (() => {