begin identity dialog implementation

This commit is contained in:
yggverse 2024-11-17 16:28:45 +02:00
parent 12b4d441ca
commit 14c31734fd
18 changed files with 439 additions and 72 deletions

View file

@ -60,7 +60,7 @@ impl Content {
/// * action removes previous children component from `Self`
pub fn to_status_identity(&self) -> Status {
self.clean();
let status = Status::new_identity();
let status = Status::new_identity(self.tab_action.clone());
self.gobject.append(status.gobject());
status
}

View file

@ -2,8 +2,9 @@ mod failure;
mod identity;
mod loading;
use crate::app::browser::window::tab::item::Action;
use adw::StatusPage;
use std::time::Duration;
use std::{rc::Rc, time::Duration};
pub struct Status {
gobject: StatusPage,
@ -25,9 +26,9 @@ impl Status {
///
/// Useful as placeholder for 60 status code
/// https://geminiprotocol.net/docs/protocol-specification.gmi#status-60
pub fn new_identity() -> Self {
pub fn new_identity(action: Rc<Action>) -> Self {
Self {
gobject: identity::new_gobject(),
gobject: identity::new_gobject(action),
}
}

View file

@ -1,3 +1,6 @@
use std::rc::Rc;
use crate::app::browser::window::tab::item::Action;
use adw::StatusPage;
use gtk::{prelude::ButtonExt, Align, Button};
@ -11,7 +14,7 @@ const DEFAULT_BUTTON_CLASS: &str = "suggested-action";
/// Create new default preset for `Identity`
/// [StatusPage](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.StatusPage.html)
pub fn new_gobject() -> StatusPage {
pub fn new_gobject(action: Rc<Action>) -> StatusPage {
// Init certificate selection
let button = &Button::builder()
.css_classes([DEFAULT_BUTTON_CLASS])
@ -21,7 +24,7 @@ pub fn new_gobject() -> StatusPage {
.build();
// Init events
button.connect_activate(|_| {}); // @TODO
button.connect_clicked(move |_| action.ident().activate());
// Init status page
StatusPage::builder()

View file

@ -16,11 +16,11 @@ impl Widget {
let gobject = Button::builder()
.icon_name("avatar-default-symbolic")
.tooltip_text("Identity")
.sensitive(false)
//.sensitive(false)
.build();
// Init events @TODO dialog window required
// gobject.connect_clicked(move |_| action.auth().activate());
gobject.connect_clicked(move |_| action.ident().activate());
// Return activated `Self`
Self { gobject }
@ -28,7 +28,7 @@ impl Widget {
// Actions
pub fn update(&self, is_sensitive: bool) {
self.gobject.set_sensitive(is_sensitive);
//self.gobject.set_sensitive(is_sensitive);
}
// Getters