mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-03 01:55:27 +00:00
define ptr container outside
This commit is contained in:
parent
7b2c07ac45
commit
a5fc2a7475
58 changed files with 230 additions and 272 deletions
|
|
@ -12,16 +12,12 @@ pub struct Form {
|
|||
|
||||
impl Form {
|
||||
// Construct
|
||||
pub fn new_rc(
|
||||
action_send: SimpleAction,
|
||||
title: Option<&str>,
|
||||
max_length: Option<i32>,
|
||||
) -> Rc<Self> {
|
||||
pub fn new(action_send: SimpleAction, title: Option<&str>, max_length: Option<i32>) -> Self {
|
||||
// Init widget
|
||||
let widget = Widget::new_rc(action_send, title, max_length);
|
||||
let widget = Rc::new(Widget::new(action_send, title, max_length));
|
||||
|
||||
// Result
|
||||
Rc::new(Self { widget })
|
||||
Self { widget }
|
||||
}
|
||||
|
||||
// Actions
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use gtk::{
|
|||
glib::GString,
|
||||
prelude::{ActionExt, EditableExt, WidgetExt},
|
||||
};
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: PasswordEntryRow,
|
||||
|
|
@ -15,11 +14,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_rc(
|
||||
action_send: SimpleAction,
|
||||
title: Option<&str>,
|
||||
max_length: Option<i32>,
|
||||
) -> Rc<Self> {
|
||||
pub fn new(action_send: SimpleAction, title: Option<&str>, max_length: Option<i32>) -> Self {
|
||||
// Init gobject
|
||||
let gobject = PasswordEntryRow::builder().show_apply_button(true).build();
|
||||
|
||||
|
|
@ -37,7 +32,7 @@ impl Widget {
|
|||
});
|
||||
|
||||
// Return activated struct
|
||||
Rc::new(Self { gobject })
|
||||
Self { gobject }
|
||||
}
|
||||
|
||||
// Actions
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use adw::PasswordEntryRow;
|
||||
use gtk::{prelude::BoxExt, Box, Orientation};
|
||||
use std::rc::Rc;
|
||||
|
||||
const MARGIN: i32 = 6;
|
||||
const SPACING: i32 = 8;
|
||||
|
|
@ -11,7 +10,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_rc(response: &PasswordEntryRow) -> Rc<Self> {
|
||||
pub fn new(response: &PasswordEntryRow) -> Self {
|
||||
let gobject = Box::builder()
|
||||
.margin_bottom(MARGIN)
|
||||
.margin_end(MARGIN)
|
||||
|
|
@ -23,7 +22,7 @@ impl Widget {
|
|||
|
||||
gobject.append(response);
|
||||
|
||||
Rc::new(Self { gobject })
|
||||
Self { gobject }
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue