From c97222d68ca76216886797d1c0e510e0078c4162 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 6 Oct 2024 05:23:19 +0300 Subject: [PATCH] update struct member name --- src/app/browser.rs | 2 +- src/app/browser/header.rs | 14 +++++++------- src/app/browser/header/subject.rs | 14 +++++++------- src/app/browser/header/subject/description.rs | 16 ++++++++-------- src/app/browser/header/subject/title.rs | 12 ++++++------ src/app/browser/header/tray.rs | 14 +++++++------- src/app/browser/header/tray/menu.rs | 12 ++++++------ src/app/browser/header/tray/tab.rs | 12 ++++++------ 8 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/app/browser.rs b/src/app/browser.rs index 66be9ea2..5b52d6d3 100644 --- a/src/app/browser.rs +++ b/src/app/browser.rs @@ -98,7 +98,7 @@ impl Browser { // Init widget let widget = Arc::new(Widget::new( profile_database_connection.clone(), - header.widget(), + header.gobject(), window.gobject(), )); diff --git a/src/app/browser/header.rs b/src/app/browser/header.rs index e298b782..0f9cc5b3 100644 --- a/src/app/browser/header.rs +++ b/src/app/browser/header.rs @@ -9,7 +9,7 @@ use gtk::{gio::SimpleAction, glib::GString, HeaderBar}; use std::sync::Arc; pub struct Header { - widget: HeaderBar, + gobject: HeaderBar, subject: Subject, } @@ -46,12 +46,12 @@ impl Header { let subject = Subject::new(); // Init widget - let widget = HeaderBar::builder().build(); - widget.pack_start(tray.widget()); - widget.set_title_widget(Some(subject.widget())); + let gobject = HeaderBar::builder().build(); + gobject.pack_start(tray.gobject()); + gobject.set_title_widget(Some(subject.gobject())); // Return new struct - Self { widget, subject } + Self { gobject, subject } } // Actions @@ -60,7 +60,7 @@ impl Header { } // Getters - pub fn widget(&self) -> &HeaderBar { - &self.widget + pub fn gobject(&self) -> &HeaderBar { + &self.gobject } } diff --git a/src/app/browser/header/subject.rs b/src/app/browser/header/subject.rs index 494ae4fd..f9ac9547 100644 --- a/src/app/browser/header/subject.rs +++ b/src/app/browser/header/subject.rs @@ -7,7 +7,7 @@ use title::Title; use gtk::{glib::GString, prelude::BoxExt, Align, Box, Orientation}; pub struct Subject { - widget: Box, + gobject: Box, title: Title, description: Description, } @@ -18,16 +18,16 @@ impl Subject { let title = Title::new(); let description = Description::new(); - let widget = Box::builder() + let gobject = Box::builder() .orientation(Orientation::Vertical) .valign(Align::Center) .build(); - widget.append(title.widget()); - widget.append(description.widget()); + gobject.append(title.gobject()); + gobject.append(description.gobject()); Self { - widget, + gobject, title, description, } @@ -40,7 +40,7 @@ impl Subject { } // Getters - pub fn widget(&self) -> &Box { - &self.widget + pub fn gobject(&self) -> &Box { + &self.gobject } } diff --git a/src/app/browser/header/subject/description.rs b/src/app/browser/header/subject/description.rs index b90a05ec..f41cf58b 100644 --- a/src/app/browser/header/subject/description.rs +++ b/src/app/browser/header/subject/description.rs @@ -3,33 +3,33 @@ use gtk::prelude::WidgetExt; use gtk::{pango::EllipsizeMode, Label}; pub struct Description { - widget: Label, + gobject: Label, } impl Description { // Construct pub fn new() -> Self { - let widget = Label::builder() + let gobject = Label::builder() .css_classes(["subtitle"]) .single_line_mode(true) .ellipsize(EllipsizeMode::End) .visible(false) .build(); - Self { widget } + Self { gobject } } // Actions pub fn update(&self, text: Option) { match text { - Some(value) => self.widget.set_text(&value), - None => self.widget.set_text(""), // @TODO + Some(value) => self.gobject.set_text(&value), + None => self.gobject.set_text(""), // @TODO }; - self.widget.set_visible(!self.widget.text().is_empty()); + self.gobject.set_visible(!self.gobject.text().is_empty()); } // Getters - pub fn widget(&self) -> &Label { - &self.widget + pub fn gobject(&self) -> &Label { + &self.gobject } } diff --git a/src/app/browser/header/subject/title.rs b/src/app/browser/header/subject/title.rs index ee0ff679..01ce8edf 100644 --- a/src/app/browser/header/subject/title.rs +++ b/src/app/browser/header/subject/title.rs @@ -3,20 +3,20 @@ use gtk::{glib::GString, pango::EllipsizeMode, Label}; const DEFAULT_TEXT: &str = "Yoda"; // @TODO pub struct Title { - widget: Label, + gobject: Label, } impl Title { // Construct pub fn new() -> Self { - let widget = gtk::Label::builder() + let gobject = gtk::Label::builder() .css_classes(["title"]) .single_line_mode(true) .ellipsize(EllipsizeMode::End) .label(DEFAULT_TEXT) .build(); - Self { widget } + Self { gobject } } // Actions @@ -31,11 +31,11 @@ impl Title { name.push(GString::from(DEFAULT_TEXT)); - self.widget.set_text(&name.join(" - ")); + self.gobject.set_text(&name.join(" - ")); } // Getters - pub fn widget(&self) -> &Label { - &self.widget + pub fn gobject(&self) -> &Label { + &self.gobject } } diff --git a/src/app/browser/header/tray.rs b/src/app/browser/header/tray.rs index 60007f32..aa541475 100644 --- a/src/app/browser/header/tray.rs +++ b/src/app/browser/header/tray.rs @@ -13,7 +13,7 @@ use gtk::{ use std::sync::Arc; pub struct Tray { - widget: Box, + gobject: Box, } impl Tray { @@ -48,20 +48,20 @@ impl Tray { ); // Init widget - let widget = Box::builder() + let gobject = Box::builder() .orientation(Orientation::Horizontal) .spacing(8) .build(); - widget.append(menu.widget()); - widget.append(tab.widget()); + gobject.append(menu.gobject()); + gobject.append(tab.gobject()); // Return new struct - Self { widget } + Self { gobject } } // Getters - pub fn widget(&self) -> &Box { - &self.widget + pub fn gobject(&self) -> &Box { + &self.gobject } } diff --git a/src/app/browser/header/tray/menu.rs b/src/app/browser/header/tray/menu.rs index ef7a0666..331b87e3 100644 --- a/src/app/browser/header/tray/menu.rs +++ b/src/app/browser/header/tray/menu.rs @@ -8,7 +8,7 @@ use gtk::{ use std::sync::Arc; pub struct Menu { - widget: MenuButton, + gobject: MenuButton, } #[rustfmt::skip] // @TODO template builder? impl Menu { @@ -66,16 +66,16 @@ impl Menu { model.append(Some("Quit"), Some(&detailed_action_name(action_quit))); // Init widget - let widget = MenuButton::builder().tooltip_text("Menu").build(); - widget.set_menu_model(Some(&model)); + let gobject = MenuButton::builder().tooltip_text("Menu").build(); + gobject.set_menu_model(Some(&model)); // Result - Self { widget } + Self { gobject } } // Getters - pub fn widget(&self) -> &MenuButton { - &self.widget + pub fn gobject(&self) -> &MenuButton { + &self.gobject } } diff --git a/src/app/browser/header/tray/tab.rs b/src/app/browser/header/tray/tab.rs index 352297f4..2dbeaaf4 100644 --- a/src/app/browser/header/tray/tab.rs +++ b/src/app/browser/header/tray/tab.rs @@ -2,29 +2,29 @@ use gtk::{gio::SimpleAction, prelude::ActionExt, prelude::ButtonExt, Button}; use std::sync::Arc; pub struct Tab { - pub widget: Button, + pub gobject: Button, } impl Tab { // Construct pub fn new(action_tab_append: Arc) -> Self { // Init widget - let widget = Button::builder() + let gobject = Button::builder() .icon_name("tab-new-symbolic") .tooltip_text("New tab") .build(); // Init events - widget.connect_clicked(move |_| { + gobject.connect_clicked(move |_| { action_tab_append.activate(None); }); // Return activated struct - Self { widget } + Self { gobject } } // Getters - pub fn widget(&self) -> &Button { - &self.widget + pub fn gobject(&self) -> &Button { + &self.gobject } }