Skip to content

feat: Add tooltips to Utilities section buttons#189

Open
ptr1337 wants to merge 2 commits intodevelopfrom
tooltip
Open

feat: Add tooltips to Utilities section buttons#189
ptr1337 wants to merge 2 commits intodevelopfrom
tooltip

Conversation

@ptr1337
Copy link
Member

@ptr1337 ptr1337 commented Mar 11, 2026

Fixes: #177

Signed-off-by: Peter Jung <admin@ptr1337.dev>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds user-facing affordances in the GTK UI by introducing localized tooltips for the “Fixes” actions and providing status text feedback on the installer button while pre-flight ISO checks and installer launch are in progress.

Changes:

  • Add Fluent-backed tooltips for Fixes buttons (and related conditional buttons) in the Tweaks/Fixes page.
  • Update installer button label to reflect “checking” / “launching” states and restore the default label afterward.
  • Add the new tooltip strings to the English Fluent resource file.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/pages/mod.rs Sets tooltip text for Fixes/DNS/KWin debug buttons using localized Fluent message IDs.
src/installer.rs Adjusts the install button’s label and enabled state during ISO checks and installer execution.
i18n/en/cachyos_hello.ftl Adds English strings for the newly introduced tooltip message IDs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 134 to 137
let install_btn: gtk::Button = builder.object("install").unwrap();
install_btn.set_sensitive(false);
install_btn.set_label("Checking\u{2026}");

Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

launch_installer runs in a background thread, but it directly calls install_btn.set_sensitive(...) / set_label(...) from that thread. GTK widgets are not thread-safe; UI updates should be marshalled back onto the main loop (e.g., via glib::MainContext::channel, glib::idle_add_local, or MainContext::default().invoke) and only performed on the GTK/main thread.

Copilot uses AI. Check for mistakes.
Comment on lines +136 to 144
install_btn.set_label("Checking\u{2026}");

let ui_comp = crate::gui::GUI::new(window_ref.clone());
let checks = [connectivity_check, edition_compat_check, outdated_version_check];
if !checks.iter().all(|x| x(&ui_comp, message.clone())) {
// if any check failed, return
info!("Some ISO check failed!");
install_btn.set_label("Launch installer");
install_btn.set_sensitive(true);
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The install button labels are hard-coded English strings ("Checking…", "Launching installer…", "Launch installer"). This breaks localization and can leave the UI in the wrong language after switch_locale(). Please source these labels from Fluent (fl!(...)), reusing button-installer-label for the default and adding new translation keys for the transient states.

Copilot uses AI. Check for mistakes.
Comment on lines +49 to +58
// Set tooltips.
removelock_btn.set_tooltip_text(Some(&fl!("remove-lock-tooltip")));
reinstall_btn.set_tooltip_text(Some(&fl!("reinstall-tooltip")));
resetkeyring_btn.set_tooltip_text(Some(&fl!("reset-keyrings-tooltip")));
update_system_btn.set_tooltip_text(Some(&fl!("update-system-tooltip")));
remove_orphans_btn.set_tooltip_text(Some(&fl!("remove-orphans-tooltip")));
clear_pkgcache_btn.set_tooltip_text(Some(&fl!("clear-pkgcache-tooltip")));
rankmirrors_btn.set_tooltip_text(Some(&fl!("rankmirrors-tooltip")));
install_gaming_btn.set_tooltip_text(Some(&fl!("install-gaming-tooltip")));
install_winboat_btn.set_tooltip_text(Some(&fl!("install-winboat-tooltip")));
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tooltips are set once during widget creation using fl!(...), but the runtime locale switch path (pages::i18n::update_translations) only updates labels, not tooltips. After changing language, these tooltips will remain in the previous language. Consider storing the tooltip message-id per button and updating tooltips in update_translations alongside the labels.

Copilot uses AI. Check for mistakes.
Comment on lines 142 to 145
if Path::new("/usr/bin/nmcli").exists() {
let dnsserver_btn = create_gtk_button!("dnsserver-title");
dnsserver_btn.set_tooltip_text(Some(&fl!("dnsserver-tooltip")));
dnsserver_btn.connect_clicked(glib::clone!(@weak builder => move |_| {
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same locale-switch issue as the other fixes buttons: this tooltip is initialized once with fl!(...) but isn’t updated by pages::i18n::update_translations, so it can remain in the old language after switch_locale(). Update tooltips during translation refresh as well.

Copilot uses AI. Check for mistakes.
{
if pgrep_res.success() {
let kwinw_debug_btn = create_gtk_button!("show-kwinw-debug-title");
kwinw_debug_btn.set_tooltip_text(Some(&fl!("show-kwinw-debug-tooltip")));
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same locale-switch issue as the other fixes buttons: this tooltip is initialized once with fl!(...) but isn’t updated by pages::i18n::update_translations, so it can remain in the old language after switch_locale(). Update tooltips during translation refresh as well.

Suggested change
kwinw_debug_btn.set_tooltip_text(Some(&fl!("show-kwinw-debug-tooltip")));
kwinw_debug_btn.set_has_tooltip(true);
kwinw_debug_btn.connect_query_tooltip(|_widget, _x, _y, _keyboard_mode, tooltip| {
tooltip.set_text(Some(&fl!("show-kwinw-debug-tooltip")));
true
});

Copilot uses AI. Check for mistakes.
Signed-off-by: Peter Jung <admin@ptr1337.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Add Tooltips / Hover Descriptions to Menu Items

2 participants