define ptr container outside

This commit is contained in:
yggverse 2024-11-11 01:14:09 +02:00
parent 7b2c07ac45
commit a5fc2a7475
58 changed files with 230 additions and 272 deletions

View file

@ -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

View file

@ -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

View file

@ -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