rename container constructors

This commit is contained in:
yggverse 2024-10-08 06:38:37 +03:00
parent e514312f84
commit 0a0d7b0481
8 changed files with 12 additions and 11 deletions

View File

@ -48,7 +48,7 @@ Guide and protocol draft
* implementable `struct` is public, where it members - private
* contain main `struct` implementation:
* at least one constructor that must:
* have common for application name: `new`
* have common for application name: `new` or/and `new_arc`, `new_mutex`, etc - on return object in container
* grant ownership for new `Self` object created
* public `activate` action if the new object can not be activated on construct
* public `link` getter for GTK `widget` (parental composition)

View File

@ -253,6 +253,7 @@ impl Tab {
// Read HashMap index collected
let mut page_number = 0;
// @TODO incorrect order
for (_, item) in self.index.borrow().iter() {
item.save(
transaction,

View File

@ -43,9 +43,9 @@ impl Item {
let id = uuid_string_random();
// Init components
let label = Label::new(id.clone(), false);
let label = Label::new_arc(id.clone(), false);
let page = Page::new(
let page = Page::new_arc(
id.clone(),
page_navigation_request_text.clone(),
action_tab_page_navigation_base.clone(),

View File

@ -24,11 +24,11 @@ pub struct Label {
impl Label {
// Construct
pub fn new(name: GString, is_pinned: bool) -> Arc<Self> {
pub fn new_arc(name: GString, is_pinned: bool) -> Arc<Self> {
// Init components
let pin = Pin::new(is_pinned);
let title = Title::new();
let widget = Widget::new(name, pin.gobject(), title.gobject());
let pin = Pin::new_arc(is_pinned);
let title = Title::new_arc();
let widget = Widget::new_arc(name, pin.gobject(), title.gobject());
// Init label struct
let label = Arc::new(Self {

View File

@ -8,7 +8,7 @@ pub struct Pin {
impl Pin {
// Construct
pub fn new(visible: bool) -> Arc<Pin> {
pub fn new_arc(visible: bool) -> Arc<Pin> {
let gobject = Image::builder()
.icon_name("view-pin-symbolic")
.visible(visible)

View File

@ -10,7 +10,7 @@ pub struct Title {
impl Title {
// Construct
pub fn new() -> Arc<Self> {
pub fn new_arc() -> Arc<Self> {
Arc::new(Self {
gobject: Label::builder()
.label(DEFAULT_LABEL_TEXT)

View File

@ -10,7 +10,7 @@ pub struct Widget {
impl Widget {
// Construct
pub fn new(name: GString, pin: &Image, title: &Label) -> Arc<Self> {
pub fn new_arc(name: GString, pin: &Image, title: &Label) -> Arc<Self> {
let gobject = Box::builder()
.orientation(Orientation::Horizontal)
.halign(Align::Center)

View File

@ -36,7 +36,7 @@ pub struct Page {
impl Page {
// Construct
pub fn new(
pub fn new_arc(
name: GString,
navigation_request_text: Option<GString>,
action_tab_page_navigation_base: Arc<SimpleAction>,