mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
rename wrapper mod to window
This commit is contained in:
parent
992ecfc0f6
commit
d5101a6465
26 changed files with 8 additions and 8 deletions
22
src/app/browser/window/tab/label/pin.rs
Normal file
22
src/app/browser/window/tab/label/pin.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
use gtk::Image;
|
||||
|
||||
pub struct Pin {
|
||||
widget: Image,
|
||||
}
|
||||
|
||||
impl Pin {
|
||||
// Construct
|
||||
pub fn new(visible: bool) -> Pin {
|
||||
let widget = Image::builder()
|
||||
.icon_name("view-pin-symbolic")
|
||||
.visible(visible)
|
||||
.build();
|
||||
|
||||
Self { widget }
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn widget(&self) -> &Image {
|
||||
&self.widget
|
||||
}
|
||||
}
|
||||
34
src/app/browser/window/tab/label/title.rs
Normal file
34
src/app/browser/window/tab/label/title.rs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
use gtk::{glib::GString, pango::EllipsizeMode, Label};
|
||||
|
||||
const DEFAULT_LABEL_TEXT: &str = "New page";
|
||||
|
||||
pub struct Title {
|
||||
widget: Label,
|
||||
}
|
||||
|
||||
impl Title {
|
||||
// Construct
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
widget: Label::builder()
|
||||
.label(DEFAULT_LABEL_TEXT)
|
||||
.ellipsize(EllipsizeMode::End)
|
||||
.width_chars(16)
|
||||
.single_line_mode(true)
|
||||
.build(),
|
||||
}
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self, title: Option<&GString>) {
|
||||
match title {
|
||||
Some(title) => self.widget.set_text(title),
|
||||
None => self.widget.set_text(DEFAULT_LABEL_TEXT),
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn widget(&self) -> &Label {
|
||||
&self.widget
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue