mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-05 16:04:15 +00:00
fix focus grab on response area
This commit is contained in:
parent
42e91cdb7c
commit
5d63f49987
@ -280,9 +280,7 @@ impl Page {
|
|||||||
let description = gformat!("{placeholder}");
|
let description = gformat!("{placeholder}");
|
||||||
|
|
||||||
// Make input form
|
// Make input form
|
||||||
input.use_default(uri, Some(&description), Some(1024));
|
input.set_default(uri, Some(&description), Some(1024));
|
||||||
input.show();
|
|
||||||
// @TODO hide
|
|
||||||
|
|
||||||
// Update meta
|
// Update meta
|
||||||
meta.borrow_mut().status = Some(status);
|
meta.borrow_mut().status = Some(status);
|
||||||
|
@ -23,15 +23,11 @@ impl Input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn use_default(&self, base: Uri, title: Option<&str>, size_limit: Option<usize>) {
|
pub fn set_default(&self, base: Uri, title: Option<&str>, size_limit: Option<usize>) {
|
||||||
self.widget
|
self.widget
|
||||||
.update(Some(&Default::new_arc(base, title, size_limit).gobject()));
|
.update(Some(&Default::new_arc(base, title, size_limit).gobject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn show(&self) {
|
|
||||||
self.widget.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
pub fn gobject(&self) -> &Clamp {
|
pub fn gobject(&self) -> &Clamp {
|
||||||
&self.widget.gobject()
|
&self.widget.gobject()
|
||||||
|
@ -11,6 +11,7 @@ use widget::Widget;
|
|||||||
use gtk::{
|
use gtk::{
|
||||||
gio::SimpleAction,
|
gio::SimpleAction,
|
||||||
glib::{uuid_string_random, Uri, UriHideFlags},
|
glib::{uuid_string_random, Uri, UriHideFlags},
|
||||||
|
prelude::WidgetExt,
|
||||||
Box,
|
Box,
|
||||||
};
|
};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@ -23,7 +24,7 @@ pub struct Default {
|
|||||||
impl Default {
|
impl Default {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new_arc(base: Uri, title: Option<&str>, size_limit: Option<usize>) -> Arc<Self> {
|
pub fn new_arc(base: Uri, title: Option<&str>, size_limit: Option<usize>) -> Arc<Self> {
|
||||||
// Init local action group
|
// Init local action
|
||||||
let action_update = Arc::new(SimpleAction::new(&uuid_string_random(), None));
|
let action_update = Arc::new(SimpleAction::new(&uuid_string_random(), None));
|
||||||
|
|
||||||
// Init components
|
// Init components
|
||||||
@ -51,6 +52,8 @@ impl Default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
widget.gobject().connect_realize(move |_| response.focus());
|
||||||
|
|
||||||
// Return activated struct
|
// Return activated struct
|
||||||
Arc::new(Self { widget })
|
Arc::new(Self { widget })
|
||||||
}
|
}
|
||||||
|
@ -19,15 +19,6 @@ impl Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn show(&self) {
|
|
||||||
self.gobject.set_visible(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
/* not in use
|
|
||||||
pub fn hide(&self) {
|
|
||||||
self.gobject.set_visible(false)
|
|
||||||
} */
|
|
||||||
|
|
||||||
pub fn update(&self, child: Option<&Box>) {
|
pub fn update(&self, child: Option<&Box>) {
|
||||||
if child.is_some() {
|
if child.is_some() {
|
||||||
self.gobject.set_child(child);
|
self.gobject.set_child(child);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user