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 * implementable `struct` is public, where it members - private
* contain main `struct` implementation: * contain main `struct` implementation:
* at least one constructor that must: * 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 * grant ownership for new `Self` object created
* public `activate` action if the new object can not be activated on construct * public `activate` action if the new object can not be activated on construct
* public `link` getter for GTK `widget` (parental composition) * public `link` getter for GTK `widget` (parental composition)

View File

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

View File

@ -43,9 +43,9 @@ impl Item {
let id = uuid_string_random(); let id = uuid_string_random();
// Init components // 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(), id.clone(),
page_navigation_request_text.clone(), page_navigation_request_text.clone(),
action_tab_page_navigation_base.clone(), action_tab_page_navigation_base.clone(),

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@ pub struct Widget {
impl Widget { impl Widget {
// Construct // 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() let gobject = Box::builder()
.orientation(Orientation::Horizontal) .orientation(Orientation::Horizontal)
.halign(Align::Center) .halign(Align::Center)

View File

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