mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-10 10:24:13 +00:00
update struct member name
This commit is contained in:
parent
0c98b869d3
commit
c97222d68c
@ -98,7 +98,7 @@ impl Browser {
|
|||||||
// Init widget
|
// Init widget
|
||||||
let widget = Arc::new(Widget::new(
|
let widget = Arc::new(Widget::new(
|
||||||
profile_database_connection.clone(),
|
profile_database_connection.clone(),
|
||||||
header.widget(),
|
header.gobject(),
|
||||||
window.gobject(),
|
window.gobject(),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ use gtk::{gio::SimpleAction, glib::GString, HeaderBar};
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Header {
|
pub struct Header {
|
||||||
widget: HeaderBar,
|
gobject: HeaderBar,
|
||||||
subject: Subject,
|
subject: Subject,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,12 +46,12 @@ impl Header {
|
|||||||
let subject = Subject::new();
|
let subject = Subject::new();
|
||||||
|
|
||||||
// Init widget
|
// Init widget
|
||||||
let widget = HeaderBar::builder().build();
|
let gobject = HeaderBar::builder().build();
|
||||||
widget.pack_start(tray.widget());
|
gobject.pack_start(tray.gobject());
|
||||||
widget.set_title_widget(Some(subject.widget()));
|
gobject.set_title_widget(Some(subject.gobject()));
|
||||||
|
|
||||||
// Return new struct
|
// Return new struct
|
||||||
Self { widget, subject }
|
Self { gobject, subject }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
@ -60,7 +60,7 @@ impl Header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
pub fn widget(&self) -> &HeaderBar {
|
pub fn gobject(&self) -> &HeaderBar {
|
||||||
&self.widget
|
&self.gobject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ use title::Title;
|
|||||||
use gtk::{glib::GString, prelude::BoxExt, Align, Box, Orientation};
|
use gtk::{glib::GString, prelude::BoxExt, Align, Box, Orientation};
|
||||||
|
|
||||||
pub struct Subject {
|
pub struct Subject {
|
||||||
widget: Box,
|
gobject: Box,
|
||||||
title: Title,
|
title: Title,
|
||||||
description: Description,
|
description: Description,
|
||||||
}
|
}
|
||||||
@ -18,16 +18,16 @@ impl Subject {
|
|||||||
let title = Title::new();
|
let title = Title::new();
|
||||||
let description = Description::new();
|
let description = Description::new();
|
||||||
|
|
||||||
let widget = Box::builder()
|
let gobject = Box::builder()
|
||||||
.orientation(Orientation::Vertical)
|
.orientation(Orientation::Vertical)
|
||||||
.valign(Align::Center)
|
.valign(Align::Center)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
widget.append(title.widget());
|
gobject.append(title.gobject());
|
||||||
widget.append(description.widget());
|
gobject.append(description.gobject());
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
widget,
|
gobject,
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ impl Subject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
pub fn widget(&self) -> &Box {
|
pub fn gobject(&self) -> &Box {
|
||||||
&self.widget
|
&self.gobject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,33 +3,33 @@ use gtk::prelude::WidgetExt;
|
|||||||
use gtk::{pango::EllipsizeMode, Label};
|
use gtk::{pango::EllipsizeMode, Label};
|
||||||
|
|
||||||
pub struct Description {
|
pub struct Description {
|
||||||
widget: Label,
|
gobject: Label,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Description {
|
impl Description {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let widget = Label::builder()
|
let gobject = Label::builder()
|
||||||
.css_classes(["subtitle"])
|
.css_classes(["subtitle"])
|
||||||
.single_line_mode(true)
|
.single_line_mode(true)
|
||||||
.ellipsize(EllipsizeMode::End)
|
.ellipsize(EllipsizeMode::End)
|
||||||
.visible(false)
|
.visible(false)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Self { widget }
|
Self { gobject }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, text: Option<GString>) {
|
pub fn update(&self, text: Option<GString>) {
|
||||||
match text {
|
match text {
|
||||||
Some(value) => self.widget.set_text(&value),
|
Some(value) => self.gobject.set_text(&value),
|
||||||
None => self.widget.set_text(""), // @TODO
|
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
|
// Getters
|
||||||
pub fn widget(&self) -> &Label {
|
pub fn gobject(&self) -> &Label {
|
||||||
&self.widget
|
&self.gobject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,20 +3,20 @@ use gtk::{glib::GString, pango::EllipsizeMode, Label};
|
|||||||
const DEFAULT_TEXT: &str = "Yoda"; // @TODO
|
const DEFAULT_TEXT: &str = "Yoda"; // @TODO
|
||||||
|
|
||||||
pub struct Title {
|
pub struct Title {
|
||||||
widget: Label,
|
gobject: Label,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Title {
|
impl Title {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let widget = gtk::Label::builder()
|
let gobject = gtk::Label::builder()
|
||||||
.css_classes(["title"])
|
.css_classes(["title"])
|
||||||
.single_line_mode(true)
|
.single_line_mode(true)
|
||||||
.ellipsize(EllipsizeMode::End)
|
.ellipsize(EllipsizeMode::End)
|
||||||
.label(DEFAULT_TEXT)
|
.label(DEFAULT_TEXT)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Self { widget }
|
Self { gobject }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
@ -31,11 +31,11 @@ impl Title {
|
|||||||
|
|
||||||
name.push(GString::from(DEFAULT_TEXT));
|
name.push(GString::from(DEFAULT_TEXT));
|
||||||
|
|
||||||
self.widget.set_text(&name.join(" - "));
|
self.gobject.set_text(&name.join(" - "));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
pub fn widget(&self) -> &Label {
|
pub fn gobject(&self) -> &Label {
|
||||||
&self.widget
|
&self.gobject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ use gtk::{
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Tray {
|
pub struct Tray {
|
||||||
widget: Box,
|
gobject: Box,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tray {
|
impl Tray {
|
||||||
@ -48,20 +48,20 @@ impl Tray {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Init widget
|
// Init widget
|
||||||
let widget = Box::builder()
|
let gobject = Box::builder()
|
||||||
.orientation(Orientation::Horizontal)
|
.orientation(Orientation::Horizontal)
|
||||||
.spacing(8)
|
.spacing(8)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
widget.append(menu.widget());
|
gobject.append(menu.gobject());
|
||||||
widget.append(tab.widget());
|
gobject.append(tab.gobject());
|
||||||
|
|
||||||
// Return new struct
|
// Return new struct
|
||||||
Self { widget }
|
Self { gobject }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
pub fn widget(&self) -> &Box {
|
pub fn gobject(&self) -> &Box {
|
||||||
&self.widget
|
&self.gobject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ use gtk::{
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Menu {
|
pub struct Menu {
|
||||||
widget: MenuButton,
|
gobject: MenuButton,
|
||||||
}
|
}
|
||||||
#[rustfmt::skip] // @TODO template builder?
|
#[rustfmt::skip] // @TODO template builder?
|
||||||
impl Menu {
|
impl Menu {
|
||||||
@ -66,16 +66,16 @@ impl Menu {
|
|||||||
model.append(Some("Quit"), Some(&detailed_action_name(action_quit)));
|
model.append(Some("Quit"), Some(&detailed_action_name(action_quit)));
|
||||||
|
|
||||||
// Init widget
|
// Init widget
|
||||||
let widget = MenuButton::builder().tooltip_text("Menu").build();
|
let gobject = MenuButton::builder().tooltip_text("Menu").build();
|
||||||
widget.set_menu_model(Some(&model));
|
gobject.set_menu_model(Some(&model));
|
||||||
|
|
||||||
// Result
|
// Result
|
||||||
Self { widget }
|
Self { gobject }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
pub fn widget(&self) -> &MenuButton {
|
pub fn gobject(&self) -> &MenuButton {
|
||||||
&self.widget
|
&self.gobject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,29 +2,29 @@ use gtk::{gio::SimpleAction, prelude::ActionExt, prelude::ButtonExt, Button};
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Tab {
|
pub struct Tab {
|
||||||
pub widget: Button,
|
pub gobject: Button,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tab {
|
impl Tab {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new(action_tab_append: Arc<SimpleAction>) -> Self {
|
pub fn new(action_tab_append: Arc<SimpleAction>) -> Self {
|
||||||
// Init widget
|
// Init widget
|
||||||
let widget = Button::builder()
|
let gobject = Button::builder()
|
||||||
.icon_name("tab-new-symbolic")
|
.icon_name("tab-new-symbolic")
|
||||||
.tooltip_text("New tab")
|
.tooltip_text("New tab")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
widget.connect_clicked(move |_| {
|
gobject.connect_clicked(move |_| {
|
||||||
action_tab_append.activate(None);
|
action_tab_append.activate(None);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Return activated struct
|
// Return activated struct
|
||||||
Self { widget }
|
Self { gobject }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
pub fn widget(&self) -> &Button {
|
pub fn gobject(&self) -> &Button {
|
||||||
&self.widget
|
&self.gobject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user