return reference to counter Label

This commit is contained in:
yggverse 2025-01-22 07:55:31 +02:00
parent c72da12c26
commit 97af26c44e
3 changed files with 8 additions and 6 deletions

View file

@ -84,7 +84,7 @@ impl Client {
// route by scheme // route by scheme
Ok(uri) => match uri.scheme().as_str() { Ok(uri) => match uri.scheme().as_str() {
"gemini" => driver.gemini.handle(uri, feature, cancellable), "gemini" => driver.gemini.handle(uri, feature, cancellable),
"titan" => subject.page.input.set_new_titan(|_data| todo!()), "titan" => subject.page.input.set_new_titan(|_data, _label| todo!()),
scheme => { scheme => {
// no scheme match driver, complete with failure message // no scheme match driver, complete with failure message
let status = subject.page.content.to_status_failure(); let status = subject.page.content.to_status_failure();

View file

@ -4,7 +4,7 @@ mod titan;
mod widget; mod widget;
use super::TabAction; use super::TabAction;
use gtk::glib::Uri; use gtk::{glib::Uri, Label};
use response::Response; use response::Response;
use sensitive::Sensitive; use sensitive::Sensitive;
use std::rc::Rc; use std::rc::Rc;
@ -65,7 +65,7 @@ impl Input {
)); ));
} }
pub fn set_new_titan(&self, on_send: impl Fn(&[u8]) + 'static) { pub fn set_new_titan(&self, on_send: impl Fn(&[u8], &Label) + 'static) {
self.widget self.widget
.update(Some(&Titan::build(on_send).widget.g_box)); .update(Some(&Titan::build(on_send).widget.g_box));
} }

View file

@ -8,7 +8,7 @@ use form::Form;
use title::Title; use title::Title;
use widget::Widget; use widget::Widget;
use gtk::{gio::SimpleAction, glib::uuid_string_random}; use gtk::{gio::SimpleAction, glib::uuid_string_random, Label};
use std::rc::Rc; use std::rc::Rc;
pub struct Titan { pub struct Titan {
@ -20,7 +20,7 @@ impl Titan {
// Constructors // Constructors
/// Build new `Self` /// Build new `Self`
pub fn build(on_send: impl Fn(&[u8]) + 'static) -> Self { pub fn build(on_send: impl Fn(&[u8], &Label) + 'static) -> Self {
// Init local actions // Init local actions
let action_update = SimpleAction::new(&uuid_string_random(), None); let action_update = SimpleAction::new(&uuid_string_random(), None);
let action_send = SimpleAction::new(&uuid_string_random(), None); let action_send = SimpleAction::new(&uuid_string_random(), None);
@ -44,7 +44,9 @@ impl Titan {
move |_, _| control.update(Some(form.widget.text().as_bytes().len())) move |_, _| control.update(Some(form.widget.text().as_bytes().len()))
}); });
action_send.connect_activate(move |_, _| on_send(form.widget.text().as_bytes())); action_send.connect_activate(move |_, _| {
on_send(form.widget.text().as_bytes(), &control.counter.label)
});
// Return activated struct // Return activated struct
Self { widget } Self { widget }