Browse Source

init navbar components

master
yggverse 2 months ago
parent
commit
0759f14843
  1. 17
      src/app/browser/main/tab/page.rs
  2. 9
      src/app/browser/main/tab/page/content.rs
  3. 50
      src/app/browser/main/tab/page/navigation.rs
  4. 22
      src/app/browser/main/tab/page/navigation/base.rs
  5. 22
      src/app/browser/main/tab/page/navigation/bookmark.rs
  6. 34
      src/app/browser/main/tab/page/navigation/history.rs
  7. 22
      src/app/browser/main/tab/page/navigation/history/back.rs
  8. 22
      src/app/browser/main/tab/page/navigation/history/forward.rs
  9. 22
      src/app/browser/main/tab/page/navigation/reload.rs
  10. 22
      src/app/browser/main/tab/page/navigation/request.rs

17
src/app/browser/main/tab/page.rs

@ -1,9 +1,22 @@ @@ -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

@ -0,0 +1,9 @@ @@ -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

@ -0,0 +1,50 @@ @@ -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

@ -0,0 +1,22 @@ @@ -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

@ -0,0 +1,22 @@ @@ -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

@ -0,0 +1,34 @@ @@ -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

@ -0,0 +1,22 @@ @@ -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

@ -0,0 +1,22 @@ @@ -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

@ -0,0 +1,22 @@ @@ -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

@ -0,0 +1,22 @@ @@ -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…
Cancel
Save