Widen the main window and put the switcher, lock and menu in place

This commit is contained in:
raucao committed 2026-11-24 20:58:38 +04:00
1 parent 680ca35a79
commit 13a7f74c48
2 files changed
+26 -25

No files matched your search

+2 -2
View File
@@ -3,8 +3,8 @@ using Adw 1;
Adw.ApplicationWindow window {
title: "Regent";
default-width: 460;
default-height: 700;
default-width: 600;
default-height: 800;
content: Adw.ToolbarView toolbar_view {
[top]
+24 -23
View File
@@ -196,8 +196,23 @@ fn main_window(
.build();
header_bar.set_title_widget(Some(&switcher));
// The primary menu. Locking stays on the header button, which doubles as the
// lock-state indicator, so it needs no menu entry.
// The header, in the order the bar lays it out: `pack_start` appends to the
// start box left to right, while each `pack_end` *prepends* to the end box —
// so the first `pack_end` ends up rightmost. That gives
// [switcher] … [lock][menu].
let identity_switcher = IdentitySwitcher::new(Rc::clone(state), windows);
header_bar.pack_start(identity_switcher.button());
// The vault's lock state, next to the menu.
let lock_button = gtk::Button::builder()
.icon_name("changes-allow-symbolic")
.tooltip_text("Unlocked")
.css_classes(["flat"])
.build();
lock_button.set_action_name(Some("app.lock"));
header_bar.pack_end(&lock_button);
// The primary menu. Locking stays on the button above, so it needs no entry.
let menu = gio::Menu::new();
menu.append(Some("Manage identities…"), Some("app.identities"));
menu.append(Some("Preferences…"), Some("app.preferences"));
@@ -208,21 +223,8 @@ fn main_window(
.tooltip_text("Main menu")
.css_classes(["flat"])
.build();
header_bar.pack_start(&menu_button);
header_bar.pack_end(&menu_button);
// The identity switcher: which identity the app is looking at, and the way
// to the identities window.
let identity_switcher = IdentitySwitcher::new(Rc::clone(state), windows);
header_bar.pack_end(identity_switcher.button());
// The vault's lock state, always visible, to the left of the switcher.
let lock_button = gtk::Button::builder()
.icon_name("changes-prevent-symbolic")
.tooltip_text("Lock the key vault")
.css_classes(["flat"])
.build();
lock_button.set_action_name(Some("app.lock"));
header_bar.pack_end(&lock_button);
{
let button = lock_button.clone();
let listener_state = Rc::clone(state);
@@ -230,16 +232,15 @@ fn main_window(
let locked = listener_state.is_locked();
// Nothing to lock until a key — and so a passphrase — exists.
button.set_sensitive(listener_state.store().has_vault());
// The icon and the tooltip show the state, not what clicking does:
// a closed padlock means locked, an open one means unlocked. (The
// button still toggles `app.lock` either way.)
button.set_icon_name(if locked {
"changes-allow-symbolic"
} else {
"changes-prevent-symbolic"
});
button.set_tooltip_text(Some(if locked {
"Unlock the key vault"
} else {
"Lock the key vault"
}));
"changes-allow-symbolic"
});
button.set_tooltip_text(Some(if locked { "Locked" } else { "Unlocked" }));
});
}