mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
draft 10, 11 status codes
This commit is contained in:
parent
e865221598
commit
80aea6a653
6 changed files with 68 additions and 3 deletions
|
|
@ -12,11 +12,13 @@ pub enum Mime {
|
|||
pub enum Status {
|
||||
Connect,
|
||||
Failure,
|
||||
Input,
|
||||
Prepare,
|
||||
Redirect,
|
||||
Reload,
|
||||
Request,
|
||||
Response,
|
||||
SensitiveInput,
|
||||
Success,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,12 @@ use adw::ToolbarView;
|
|||
use std::sync::Arc;
|
||||
|
||||
pub struct Request {
|
||||
content: Arc<Content>,
|
||||
widget: Arc<Widget>,
|
||||
}
|
||||
|
||||
impl Request {
|
||||
// Construct
|
||||
pub fn new_arc() -> Arc<Self> {
|
||||
// Init components
|
||||
let content = Content::new_arc();
|
||||
|
|
@ -20,7 +22,12 @@ impl Request {
|
|||
let widget = Widget::new_arc(content.gobject());
|
||||
|
||||
// Result
|
||||
Arc::new(Self { widget })
|
||||
Arc::new(Self { content, widget })
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn show(&self, placeholder: &str, sensitive: bool) {
|
||||
self.content.set(placeholder, sensitive);
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -10,10 +10,12 @@ use gtk::Box;
|
|||
use std::sync::Arc;
|
||||
|
||||
pub struct Content {
|
||||
response: Arc<Response>,
|
||||
widget: Arc<Widget>,
|
||||
}
|
||||
|
||||
impl Content {
|
||||
// Construct
|
||||
pub fn new_arc() -> Arc<Self> {
|
||||
// Init components
|
||||
let response = Response::new_arc();
|
||||
|
|
@ -28,7 +30,12 @@ impl Content {
|
|||
send.gobject().connect_clicked(|_| {}); */
|
||||
|
||||
// Return activated struct
|
||||
Arc::new(Self { widget })
|
||||
Arc::new(Self { response, widget })
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn set(&self, placeholder: &str, sensitive: bool) {
|
||||
self.response.set(placeholder, sensitive);
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ pub struct Response {
|
|||
}
|
||||
|
||||
impl Response {
|
||||
// Construct
|
||||
pub fn new_arc() -> Arc<Self> {
|
||||
// Init widget
|
||||
let widget = Widget::new_arc();
|
||||
|
|
@ -18,6 +19,11 @@ impl Response {
|
|||
Arc::new(Self { widget })
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn set(&self, placeholder: &str, sensitive: bool) {
|
||||
self.widget.set(placeholder, sensitive);
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &Entry {
|
||||
&self.widget.gobject()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
use gtk::Entry;
|
||||
use gtk::{
|
||||
prelude::{EditableExt, EntryExt, WidgetExt},
|
||||
Entry,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Widget {
|
||||
|
|
@ -13,6 +16,13 @@ impl Widget {
|
|||
Arc::new(Self { gobject })
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn set(&self, placeholder_text: &str, sensitive: bool) {
|
||||
self.gobject.set_text(&""); // reset
|
||||
self.gobject.set_placeholder_text(Some(placeholder_text));
|
||||
self.gobject.set_sensitive(sensitive);
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &Entry {
|
||||
&self.gobject
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue