apply rustfmt

This commit is contained in:
yggverse 2024-09-20 18:02:10 +03:00
parent e6e81e846a
commit f8d938a8af
24 changed files with 253 additions and 611 deletions

View file

@ -1,54 +1,29 @@
#[path = "tab/label.rs"] mod label;
#[path = "tab/page.rs"] mod page;
#[path = "tab/label.rs"]
mod label;
#[path = "tab/page.rs"]
mod page;
use gtk::Notebook;
pub fn new() -> Notebook
{
let tab = Notebook::builder()
.scrollable(
true
)
.build();
pub fn new() -> Notebook {
let tab = Notebook::builder().scrollable(true).build();
// Add test tab @TODO restore from session
append(
&tab,
true
);
append(&tab, true);
return tab;
tab
}
pub fn append(
tab: &Notebook,
current: bool
) -> u32
{
pub fn append(tab: &Notebook, current: bool) -> u32 {
let page = page::new();
let page_number = tab.append_page(
&page,
Some(
&label::new()
)
);
let page_number = tab.append_page(&page, Some(&label::new()));
tab.set_tab_reorderable(
&page,
true
);
tab.set_tab_reorderable(&page, true);
if current
{
tab.set_current_page(
Some(
page_number
)
);
if current {
tab.set_current_page(Some(page_number));
}
return page_number;
}
page_number
}

View file

@ -1,30 +1,18 @@
#[path = "label/pin.rs"] mod pin;
#[path = "label/title.rs"] mod title;
#[path = "label/pin.rs"]
mod pin;
#[path = "label/title.rs"]
mod title;
use gtk::Box;
use gtk::prelude::BoxExt;
use gtk::Box;
pub fn new() -> Box
{
pub fn new() -> Box {
let label = Box::builder()
// Tuneup
.orientation(
gtk::Orientation::Horizontal
)
.orientation(gtk::Orientation::Horizontal)
.build();
// Components
label.append(
&pin::new(
false
)
);
label.append(&pin::new(false));
label.append(&title::new());
label.append(
&title::new()
);
return label;
}
label
}

View file

@ -1,18 +1,8 @@
use gtk::Image;
pub fn new(
visible : bool
) -> Image
{
return Image::builder()
.icon_name(
"view-pin-symbolic"
)
.visible(
visible
)
.build();
}
pub fn new(visible: bool) -> Image {
Image::builder()
.icon_name("view-pin-symbolic")
.visible(visible)
.build()
}

View file

@ -1,24 +1,10 @@
use gtk::Label;
pub fn new() -> Label
{
return Label::builder()
.label(
"New page"
)
.ellipsize(
gtk::pango::EllipsizeMode::End
)
.width_chars(
16
)
.single_line_mode(
true
)
.build();
}
pub fn new() -> Label {
Label::builder()
.label("New page")
.ellipsize(gtk::pango::EllipsizeMode::End)
.width_chars(16)
.single_line_mode(true)
.build()
}

View file

@ -1,22 +1,18 @@
#[path = "page/navigation.rs"] mod navigation;
#[path = "page/content.rs"] mod content;
#[path = "page/content.rs"]
mod content;
#[path = "page/navigation.rs"]
mod navigation;
use gtk::Box;
use gtk::prelude::BoxExt;
use gtk::Box;
pub fn new() -> Box
{
let page = Box::builder().orientation(
gtk::Orientation::Vertical
).build();
pub fn new() -> Box {
let page = Box::builder()
.orientation(gtk::Orientation::Vertical)
.build();
page.append(
&navigation::new()
);
page.append(&navigation::new());
page.append(&content::new());
page.append(
&content::new()
);
return page;
}
page
}

View file

@ -1,9 +1,8 @@
use gtk::Box;
// use gtk::prelude::BoxExt; @TODO append
pub fn new() -> Box
{
return Box::builder().orientation(
gtk::Orientation::Vertical
).build();
}
pub fn new() -> Box {
Box::builder()
.orientation(gtk::Orientation::Vertical)
.build()
}

View file

@ -1,50 +1,34 @@
#[path = "navigation/base.rs"] mod base;
#[path = "navigation/history.rs"] mod history;
#[path = "navigation/reload.rs"] mod reload;
#[path = "navigation/request.rs"] mod request;
#[path = "navigation/bookmark.rs"] mod bookmark;
#[path = "navigation/base.rs"]
mod base;
#[path = "navigation/bookmark.rs"]
mod bookmark;
#[path = "navigation/history.rs"]
mod history;
#[path = "navigation/reload.rs"]
mod reload;
#[path = "navigation/request.rs"]
mod request;
use gtk::Box;
use gtk::prelude::BoxExt;
use gtk::Box;
pub fn new() -> Box
{
pub fn new() -> Box {
let navigation = Box::builder()
// Tuneup
.orientation(
gtk::Orientation::Horizontal
)
.orientation(gtk::Orientation::Horizontal)
.spacing(8)
.margin_top(8)
.margin_start(8)
.margin_end(8)
.margin_bottom(8)
.build();
// Compose childs
navigation.append(
&base::new()
);
// Compose childs
navigation.append(&base::new());
navigation.append(&history::new());
navigation.append(&reload::new());
navigation.append(&request::new());
navigation.append(&bookmark::new());
navigation.append(
&history::new()
);
navigation.append(
&reload::new()
);
navigation.append(
&request::new()
);
navigation.append(
&bookmark::new()
);
return navigation;
}
navigation
}

View file

@ -1,22 +1,9 @@
use gtk::Button;
pub fn new() -> Button
{
let button = Button::builder()
.icon_name(
"go-home-symbolic"
)
.tooltip_text(
"Base"
)
.sensitive(
false
)
.build();
return button;
}
pub fn new() -> Button {
Button::builder()
.icon_name("go-home-symbolic")
.tooltip_text("Base")
.sensitive(false)
.build()
}

View file

@ -1,22 +1,9 @@
use gtk::Button;
pub fn new() -> Button
{
let button = Button::builder()
.icon_name(
"starred-symbolic"
)
.tooltip_text(
"Toggle bookmark"
)
.sensitive(
false
)
.build();
return button;
}
pub fn new() -> Button {
Button::builder()
.icon_name("starred-symbolic")
.tooltip_text("Toggle bookmark")
.sensitive(false)
.build()
}

View file

@ -1,34 +1,22 @@
#[path = "history/back.rs"] mod back;
#[path = "history/forward.rs"] mod forward;
#[path = "history/back.rs"]
mod back;
#[path = "history/forward.rs"]
mod forward;
use gtk::Box;
use gtk::prelude::BoxExt;
use gtk::Box;
pub fn new() -> Box
{
pub fn new() -> Box {
let history = Box::builder()
// Tuneup
.orientation(
gtk::Orientation::Horizontal
)
.css_classes(
[
"linked" // merge childs
]
)
.orientation(gtk::Orientation::Horizontal)
.css_classes([
"linked", // merge childs
])
.build();
// Compose childs
history.append(
&back::new()
);
history.append(&back::new());
history.append(&forward::new());
history.append(
&forward::new()
);
return history;
}
history
}

View file

@ -1,22 +1,9 @@
use gtk::Button;
pub fn new() -> Button
{
let button = Button::builder()
.icon_name(
"go-previous-symbolic"
)
.tooltip_text(
"Back"
)
.sensitive(
false
)
.build();
return button;
}
pub fn new() -> Button {
Button::builder()
.icon_name("go-previous-symbolic")
.tooltip_text("Back")
.sensitive(false)
.build()
}

View file

@ -1,22 +1,9 @@
use gtk::Button;
pub fn new() -> Button
{
let button = Button::builder()
.icon_name(
"go-next-symbolic"
)
.tooltip_text(
"Forward"
)
.sensitive(
false
)
.build();
return button;
}
pub fn new() -> Button {
Button::builder()
.icon_name("go-next-symbolic")
.tooltip_text("Forward")
.sensitive(false)
.build()
}

View file

@ -1,22 +1,9 @@
use gtk::Button;
pub fn new() -> Button
{
let button = Button::builder()
.icon_name(
"view-refresh-symbolic"
)
.tooltip_text(
"Reload"
)
.sensitive(
false
)
pub fn new() -> Button {
return Button::builder()
.icon_name("view-refresh-symbolic")
.tooltip_text("Reload")
.sensitive(false)
.build();
return button;
}
}

View file

@ -1,22 +1,9 @@
use gtk::Entry;
pub fn new() -> Entry
{
let entry = Entry::builder()
.placeholder_text(
"URL or search term..."
)
.hexpand(
true
)
.progress_pulse_step(
0.1
)
.build();
return entry;
}
pub fn new() -> Entry {
Entry::builder()
.placeholder_text("URL or search term...")
.hexpand(true)
.progress_pulse_step(0.1)
.build()
}