add identity page for CertificateRequest status code

This commit is contained in:
yggverse 2024-11-16 21:32:42 +02:00
parent 611addda42
commit 63f7f1c769
4 changed files with 68 additions and 0 deletions

View file

@ -1,4 +1,5 @@
mod failure;
mod identity;
mod loading;
use adw::StatusPage;
@ -20,6 +21,16 @@ impl Status {
}
}
/// Create new identity preset
///
/// Useful as placeholder for 60 status code
/// https://geminiprotocol.net/docs/protocol-specification.gmi#status-60
pub fn new_identity() -> Self {
Self {
gobject: identity::new_gobject(),
}
}
/// Create new loading preset
///
/// Useful as placeholder widget for async operations

View file

@ -0,0 +1,29 @@
use adw::StatusPage;
use gtk::{prelude::ButtonExt, Align, Button};
// Defaults
const DEFAULT_ICON_NAME: &str = "avatar-default-symbolic";
const DEFAULT_TITLE: &str = "Identity";
const DEFAULT_DESCRIPTION: &str = "Client certificate required to continue!";
const DEFAULT_BUTTON_LABEL: &str = "Select";
/// Create new default preset for `Identity`
/// [StatusPage](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.StatusPage.html)
pub fn new_gobject() -> StatusPage {
// Init certificate selection
let button = &Button::builder()
.label(DEFAULT_BUTTON_LABEL)
.halign(Align::Center)
.build();
// Init events
button.connect_activate(|_| {}); // @TODO
// Init status page
StatusPage::builder()
.description(DEFAULT_DESCRIPTION)
.icon_name(DEFAULT_ICON_NAME)
.title(DEFAULT_TITLE)
.child(button)
.build()
}