mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-10 12:41:34 +00:00
init navbar components
This commit is contained in:
parent
38659b45ca
commit
0759f14843
@ -1,9 +1,22 @@
|
||||
#[path = "page/navigation.rs"] mod navigation;
|
||||
#[path = "page/content.rs"] mod content;
|
||||
|
||||
use gtk::Box;
|
||||
// use gtk::prelude::BoxExt; @TODO append
|
||||
use gtk::prelude::BoxExt;
|
||||
|
||||
pub fn new() -> Box
|
||||
{
|
||||
return Box::builder().orientation(
|
||||
let page = Box::builder().orientation(
|
||||
gtk::Orientation::Vertical
|
||||
).build();
|
||||
|
||||
page.append(
|
||||
&navigation::new()
|
||||
);
|
||||
|
||||
page.append(
|
||||
&content::new()
|
||||
);
|
||||
|
||||
return page;
|
||||
}
|
9
src/app/browser/main/tab/page/content.rs
Normal file
9
src/app/browser/main/tab/page/content.rs
Normal file
@ -0,0 +1,9 @@
|
||||
use gtk::Box;
|
||||
// use gtk::prelude::BoxExt; @TODO append
|
||||
|
||||
pub fn new() -> Box
|
||||
{
|
||||
return Box::builder().orientation(
|
||||
gtk::Orientation::Vertical
|
||||
).build();
|
||||
}
|
50
src/app/browser/main/tab/page/navigation.rs
Normal file
50
src/app/browser/main/tab/page/navigation.rs
Normal file
@ -0,0 +1,50 @@
|
||||
#[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;
|
||||
|
||||
use gtk::Box;
|
||||
use gtk::prelude::BoxExt;
|
||||
|
||||
pub fn new() -> Box
|
||||
{
|
||||
let navigation = Box::builder()
|
||||
|
||||
// Tuneup
|
||||
.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()
|
||||
);
|
||||
|
||||
navigation.append(
|
||||
&history::new()
|
||||
);
|
||||
|
||||
navigation.append(
|
||||
&reload::new()
|
||||
);
|
||||
|
||||
navigation.append(
|
||||
&request::new()
|
||||
);
|
||||
|
||||
navigation.append(
|
||||
&bookmark::new()
|
||||
);
|
||||
|
||||
return navigation;
|
||||
}
|
22
src/app/browser/main/tab/page/navigation/base.rs
Normal file
22
src/app/browser/main/tab/page/navigation/base.rs
Normal file
@ -0,0 +1,22 @@
|
||||
use gtk::Button;
|
||||
|
||||
pub fn new() -> Button
|
||||
{
|
||||
let button = Button::builder()
|
||||
|
||||
.icon_name(
|
||||
"go-home-symbolic"
|
||||
)
|
||||
|
||||
.tooltip_text(
|
||||
"Base"
|
||||
)
|
||||
|
||||
.sensitive(
|
||||
false
|
||||
)
|
||||
|
||||
.build();
|
||||
|
||||
return button;
|
||||
}
|
22
src/app/browser/main/tab/page/navigation/bookmark.rs
Normal file
22
src/app/browser/main/tab/page/navigation/bookmark.rs
Normal file
@ -0,0 +1,22 @@
|
||||
use gtk::Button;
|
||||
|
||||
pub fn new() -> Button
|
||||
{
|
||||
let button = Button::builder()
|
||||
|
||||
.icon_name(
|
||||
"starred-symbolic"
|
||||
)
|
||||
|
||||
.tooltip_text(
|
||||
"Toggle bookmark"
|
||||
)
|
||||
|
||||
.sensitive(
|
||||
false
|
||||
)
|
||||
|
||||
.build();
|
||||
|
||||
return button;
|
||||
}
|
34
src/app/browser/main/tab/page/navigation/history.rs
Normal file
34
src/app/browser/main/tab/page/navigation/history.rs
Normal file
@ -0,0 +1,34 @@
|
||||
#[path = "history/back.rs"] mod back;
|
||||
#[path = "history/forward.rs"] mod forward;
|
||||
|
||||
use gtk::Box;
|
||||
use gtk::prelude::BoxExt;
|
||||
|
||||
pub fn new() -> Box
|
||||
{
|
||||
let history = Box::builder()
|
||||
|
||||
// Tuneup
|
||||
.orientation(
|
||||
gtk::Orientation::Horizontal
|
||||
)
|
||||
|
||||
.css_classes(
|
||||
[
|
||||
"linked" // merge childs
|
||||
]
|
||||
)
|
||||
|
||||
.build();
|
||||
|
||||
// Compose childs
|
||||
history.append(
|
||||
&back::new()
|
||||
);
|
||||
|
||||
history.append(
|
||||
&forward::new()
|
||||
);
|
||||
|
||||
return history;
|
||||
}
|
22
src/app/browser/main/tab/page/navigation/history/back.rs
Normal file
22
src/app/browser/main/tab/page/navigation/history/back.rs
Normal file
@ -0,0 +1,22 @@
|
||||
use gtk::Button;
|
||||
|
||||
pub fn new() -> Button
|
||||
{
|
||||
let button = Button::builder()
|
||||
|
||||
.icon_name(
|
||||
"go-previous-symbolic"
|
||||
)
|
||||
|
||||
.tooltip_text(
|
||||
"Back"
|
||||
)
|
||||
|
||||
.sensitive(
|
||||
false
|
||||
)
|
||||
|
||||
.build();
|
||||
|
||||
return button;
|
||||
}
|
22
src/app/browser/main/tab/page/navigation/history/forward.rs
Normal file
22
src/app/browser/main/tab/page/navigation/history/forward.rs
Normal file
@ -0,0 +1,22 @@
|
||||
use gtk::Button;
|
||||
|
||||
pub fn new() -> Button
|
||||
{
|
||||
let button = Button::builder()
|
||||
|
||||
.icon_name(
|
||||
"go-next-symbolic"
|
||||
)
|
||||
|
||||
.tooltip_text(
|
||||
"Forward"
|
||||
)
|
||||
|
||||
.sensitive(
|
||||
false
|
||||
)
|
||||
|
||||
.build();
|
||||
|
||||
return button;
|
||||
}
|
22
src/app/browser/main/tab/page/navigation/reload.rs
Normal file
22
src/app/browser/main/tab/page/navigation/reload.rs
Normal file
@ -0,0 +1,22 @@
|
||||
use gtk::Button;
|
||||
|
||||
pub fn new() -> Button
|
||||
{
|
||||
let button = Button::builder()
|
||||
|
||||
.icon_name(
|
||||
"view-refresh-symbolic"
|
||||
)
|
||||
|
||||
.tooltip_text(
|
||||
"Reload"
|
||||
)
|
||||
|
||||
.sensitive(
|
||||
false
|
||||
)
|
||||
|
||||
.build();
|
||||
|
||||
return button;
|
||||
}
|
22
src/app/browser/main/tab/page/navigation/request.rs
Normal file
22
src/app/browser/main/tab/page/navigation/request.rs
Normal file
@ -0,0 +1,22 @@
|
||||
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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user