mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
begin identity dialog implementation
This commit is contained in:
parent
12b4d441ca
commit
14c31734fd
18 changed files with 439 additions and 72 deletions
45
src/app/browser/window/tab/item/identity/gemini.rs
Normal file
45
src/app/browser/window/tab/item/identity/gemini.rs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
mod widget;
|
||||
use widget::Widget;
|
||||
|
||||
use crate::profile::Profile;
|
||||
use gtk::{glib::Uri, prelude::IsA};
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Gemini {
|
||||
profile: Rc<Profile>,
|
||||
widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Gemini {
|
||||
// Construct
|
||||
|
||||
/// Create new `Self` for given Profile
|
||||
pub fn new(profile: Rc<Profile>, auth_uri: Uri) -> Self {
|
||||
let widget = Rc::new(Widget::new());
|
||||
|
||||
// Init events
|
||||
widget.connect_response({
|
||||
let profile = profile.clone();
|
||||
move |value| {
|
||||
match value {
|
||||
Some(id) => {
|
||||
// Activate selected identity ID
|
||||
}
|
||||
None => {
|
||||
// Create and select new identity
|
||||
}
|
||||
} // @TODO handle result
|
||||
}
|
||||
});
|
||||
|
||||
// Return activated `Self`
|
||||
Self { profile, widget }
|
||||
}
|
||||
|
||||
// Actions
|
||||
|
||||
/// Show dialog for parent [Widget](https://docs.gtk.org/gtk4/class.Widget.html)
|
||||
pub fn present(&self, parent: Option<&impl IsA<gtk::Widget>>) {
|
||||
self.widget.present(parent);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue