mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-05 07:54:14 +00:00
apply rustfmt
This commit is contained in:
parent
e6e81e846a
commit
f8d938a8af
@ -1,83 +1,39 @@
|
||||
#[path = "browser/header.rs"] mod header;
|
||||
#[path = "browser/main.rs"] mod main;
|
||||
#[path = "browser/header.rs"]
|
||||
mod header;
|
||||
#[path = "browser/main.rs"]
|
||||
mod main;
|
||||
|
||||
use gtk::{
|
||||
Application,
|
||||
ApplicationWindow,
|
||||
gio::ActionEntry,
|
||||
prelude::{
|
||||
ActionMapExtManual,
|
||||
GtkWindowExt
|
||||
}
|
||||
prelude::{ActionMapExtManual, GtkWindowExt},
|
||||
Application, ApplicationWindow,
|
||||
};
|
||||
|
||||
pub fn new(
|
||||
app: &Application,
|
||||
width: i32,
|
||||
height: i32
|
||||
) -> ApplicationWindow
|
||||
{
|
||||
pub fn new(app: &Application, width: i32, height: i32) -> ApplicationWindow {
|
||||
// Init browser window
|
||||
let browser = ApplicationWindow::builder()
|
||||
|
||||
// Tuneup
|
||||
.default_width(
|
||||
width
|
||||
)
|
||||
|
||||
.default_height(
|
||||
height
|
||||
)
|
||||
|
||||
// Relate
|
||||
.application(
|
||||
app
|
||||
)
|
||||
|
||||
// Init components
|
||||
.titlebar(
|
||||
&header::new()
|
||||
)
|
||||
|
||||
.child(
|
||||
&main::new()
|
||||
)
|
||||
|
||||
// Make
|
||||
.default_width(width)
|
||||
.default_height(height)
|
||||
.application(app)
|
||||
.titlebar(&header::new())
|
||||
.child(&main::new())
|
||||
.build();
|
||||
|
||||
// Init actions
|
||||
let action_debug = ActionEntry::builder("debug")
|
||||
// Init actions
|
||||
let action_debug = ActionEntry::builder("debug")
|
||||
.activate(|browser: &ApplicationWindow, _, _| {
|
||||
browser.emit_enable_debugging(true);
|
||||
})
|
||||
.build();
|
||||
|
||||
.activate(
|
||||
|browser: &ApplicationWindow, _, _|
|
||||
{
|
||||
browser.emit_enable_debugging(
|
||||
true
|
||||
);
|
||||
}
|
||||
)
|
||||
let action_quit = ActionEntry::builder("quit")
|
||||
.activate(|browser: &ApplicationWindow, _, _| {
|
||||
browser.close();
|
||||
})
|
||||
.build();
|
||||
|
||||
.build();
|
||||
|
||||
let action_quit = ActionEntry::builder("quit")
|
||||
|
||||
.activate(
|
||||
|browser: &ApplicationWindow, _, _|
|
||||
{
|
||||
browser.close();
|
||||
}
|
||||
)
|
||||
|
||||
.build();
|
||||
|
||||
browser.add_action_entries(
|
||||
[
|
||||
action_debug,
|
||||
action_quit
|
||||
]
|
||||
);
|
||||
browser.add_action_entries([action_debug, action_quit]);
|
||||
|
||||
// Done
|
||||
browser
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,14 @@
|
||||
#[path = "header/subject.rs"] mod subject;
|
||||
#[path = "header/tray.rs"] mod tray;
|
||||
#[path = "header/subject.rs"]
|
||||
mod subject;
|
||||
#[path = "header/tray.rs"]
|
||||
mod tray;
|
||||
|
||||
use gtk::HeaderBar;
|
||||
|
||||
pub fn new() -> HeaderBar
|
||||
{
|
||||
pub fn new() -> HeaderBar {
|
||||
let header = HeaderBar::builder().build();
|
||||
|
||||
header.pack_start(
|
||||
&tray::new()
|
||||
);
|
||||
|
||||
header.set_title_widget(
|
||||
Some(
|
||||
&subject::new()
|
||||
)
|
||||
);
|
||||
|
||||
header.pack_start(&tray::new());
|
||||
header.set_title_widget(Some(&subject::new()));
|
||||
header
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +1,22 @@
|
||||
#[path = "subject/title.rs"] mod title;
|
||||
#[path = "subject/description.rs"] mod description;
|
||||
#[path = "subject/description.rs"]
|
||||
mod description;
|
||||
#[path = "subject/title.rs"]
|
||||
mod title;
|
||||
|
||||
use gtk::Box;
|
||||
use gtk::prelude::BoxExt;
|
||||
use gtk::Box;
|
||||
|
||||
pub fn new() -> Box
|
||||
{
|
||||
pub fn new() -> Box {
|
||||
let subject = Box::builder()
|
||||
|
||||
// Tuneup
|
||||
.orientation(
|
||||
gtk::Orientation::Vertical
|
||||
)
|
||||
|
||||
.valign(
|
||||
gtk::Align::Center
|
||||
)
|
||||
|
||||
.orientation(gtk::Orientation::Vertical)
|
||||
.valign(gtk::Align::Center)
|
||||
.build();
|
||||
|
||||
// Compose childs
|
||||
subject.append(
|
||||
&title::new()
|
||||
);
|
||||
|
||||
subject.append(
|
||||
&description::new()
|
||||
);
|
||||
// Compose childs
|
||||
subject.append(&title::new());
|
||||
subject.append(&description::new());
|
||||
|
||||
// Done
|
||||
subject
|
||||
}
|
||||
}
|
||||
|
@ -1,49 +1,27 @@
|
||||
use gtk::Label;
|
||||
use gtk::prelude::WidgetExt;
|
||||
use gtk::Label;
|
||||
|
||||
pub fn new() -> Label
|
||||
{
|
||||
pub fn new() -> Label {
|
||||
let description = Label::builder()
|
||||
|
||||
.css_classes(
|
||||
[
|
||||
"subtitle"
|
||||
]
|
||||
)
|
||||
|
||||
.single_line_mode(
|
||||
true
|
||||
)
|
||||
|
||||
.ellipsize(
|
||||
gtk::pango::EllipsizeMode::End
|
||||
)
|
||||
|
||||
.css_classes(["subtitle"])
|
||||
.single_line_mode(true)
|
||||
.ellipsize(gtk::pango::EllipsizeMode::End)
|
||||
.build();
|
||||
|
||||
update(
|
||||
&description,
|
||||
"" // @TODO
|
||||
"", // @TODO
|
||||
);
|
||||
|
||||
return description;
|
||||
description
|
||||
}
|
||||
|
||||
pub fn update(
|
||||
description: &Label,
|
||||
text: &str
|
||||
) {
|
||||
description.set_text(
|
||||
text
|
||||
);
|
||||
pub fn update(description: &Label, text: &str) {
|
||||
description.set_text(text);
|
||||
|
||||
if text.is_empty()
|
||||
{
|
||||
if text.is_empty() {
|
||||
description.hide();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
description.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,50 +1,23 @@
|
||||
use gtk::Label;
|
||||
|
||||
pub fn new() -> Label
|
||||
{
|
||||
pub fn new() -> Label {
|
||||
let title = Label::builder()
|
||||
|
||||
.css_classes(
|
||||
[
|
||||
"title"
|
||||
]
|
||||
)
|
||||
|
||||
.single_line_mode(
|
||||
true
|
||||
)
|
||||
|
||||
.ellipsize(
|
||||
gtk::pango::EllipsizeMode::End
|
||||
)
|
||||
|
||||
.css_classes(["title"])
|
||||
.single_line_mode(true)
|
||||
.ellipsize(gtk::pango::EllipsizeMode::End)
|
||||
.build();
|
||||
|
||||
update(
|
||||
&title,
|
||||
"Welcome"
|
||||
);
|
||||
update(&title, "Welcome");
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
pub fn update(
|
||||
title: &Label,
|
||||
text: &str
|
||||
) {
|
||||
pub fn update(title: &Label, text: &str) {
|
||||
let default_text = "Yoda"; // @TODO
|
||||
|
||||
if text.is_empty()
|
||||
{
|
||||
title.set_text(
|
||||
default_text
|
||||
);
|
||||
if text.is_empty() {
|
||||
title.set_text(default_text);
|
||||
} else {
|
||||
title.set_text(&format!("{} - {}", text, default_text));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
title.set_text(
|
||||
&format!("{} - {}", text, default_text)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +1,20 @@
|
||||
#[path = "tray/menu.rs"] mod menu;
|
||||
#[path = "tray/tab.rs"] mod tab;
|
||||
#[path = "tray/menu.rs"]
|
||||
mod menu;
|
||||
#[path = "tray/tab.rs"]
|
||||
mod tab;
|
||||
|
||||
use gtk::Box;
|
||||
use gtk::prelude::BoxExt;
|
||||
use gtk::Box;
|
||||
|
||||
pub fn new() -> Box
|
||||
{
|
||||
pub fn new() -> Box {
|
||||
let tray = Box::builder()
|
||||
|
||||
// Tuneup
|
||||
.orientation(
|
||||
gtk::Orientation::Horizontal
|
||||
)
|
||||
|
||||
.orientation(gtk::Orientation::Horizontal)
|
||||
.spacing(8)
|
||||
|
||||
// Make
|
||||
.build();
|
||||
|
||||
// Compose childs
|
||||
tray.append(
|
||||
&menu::new()
|
||||
);
|
||||
|
||||
tray.append(
|
||||
&tab::new()
|
||||
);
|
||||
// Compose childs
|
||||
tray.append(&menu::new());
|
||||
tray.append(&tab::new());
|
||||
|
||||
tray
|
||||
}
|
||||
}
|
||||
|
@ -1,45 +1,17 @@
|
||||
use gtk::{
|
||||
gio,
|
||||
MenuButton
|
||||
};
|
||||
use gtk::{gio, MenuButton};
|
||||
|
||||
pub fn new() -> MenuButton
|
||||
{
|
||||
let menu = MenuButton::builder()
|
||||
|
||||
.tooltip_text(
|
||||
"Menu"
|
||||
)
|
||||
|
||||
.build();
|
||||
pub fn new() -> MenuButton {
|
||||
let menu = MenuButton::builder().tooltip_text("Menu").build();
|
||||
|
||||
let model = gio::Menu::new();
|
||||
let model_tab = gio::Menu::new();
|
||||
|
||||
let model_tab = gio::Menu::new();
|
||||
model_tab.append(Some("Append"), Some("win.tab_append"));
|
||||
model.append_submenu(Some("Tab"), &model_tab);
|
||||
model.append(Some("Debug"), Some("win.debug"));
|
||||
model.append(Some("Quit"), Some("win.quit"));
|
||||
|
||||
model_tab.append(
|
||||
Some("Append"),
|
||||
Some("win.tab_append")
|
||||
);
|
||||
|
||||
model.append_submenu(
|
||||
Some("Tab"),
|
||||
&model_tab
|
||||
);
|
||||
|
||||
model.append(
|
||||
Some("Debug"),
|
||||
Some("win.debug")
|
||||
);
|
||||
|
||||
model.append(
|
||||
Some("Quit"),
|
||||
Some("win.quit")
|
||||
);
|
||||
|
||||
menu.set_menu_model(
|
||||
Some(&model)
|
||||
);
|
||||
menu.set_menu_model(Some(&model));
|
||||
|
||||
menu
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,10 @@
|
||||
use gtk::Button;
|
||||
|
||||
pub fn new() -> Button
|
||||
{
|
||||
pub fn new() -> Button {
|
||||
let tab = Button::builder()
|
||||
|
||||
.icon_name(
|
||||
"tab-new-symbolic"
|
||||
)
|
||||
|
||||
.tooltip_text(
|
||||
"New tab"
|
||||
)
|
||||
|
||||
.icon_name("tab-new-symbolic")
|
||||
.tooltip_text("New tab")
|
||||
.build();
|
||||
|
||||
return tab;
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,15 @@
|
||||
#[path = "main/tab.rs"] mod tab;
|
||||
#[path = "main/tab.rs"]
|
||||
mod tab;
|
||||
|
||||
use gtk::Box;
|
||||
use gtk::prelude::BoxExt;
|
||||
use gtk::Box;
|
||||
|
||||
pub fn new() -> Box
|
||||
{
|
||||
let main = Box::builder().orientation(
|
||||
gtk::Orientation::Vertical
|
||||
).build();
|
||||
pub fn new() -> Box {
|
||||
let main = Box::builder()
|
||||
.orientation(gtk::Orientation::Vertical)
|
||||
.build();
|
||||
|
||||
main.append(
|
||||
&tab::new()
|
||||
);
|
||||
main.append(&tab::new());
|
||||
|
||||
return main;
|
||||
}
|
||||
main
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
58
src/main.rs
58
src/main.rs
@ -1,53 +1,27 @@
|
||||
#[path = "app/browser.rs"] mod browser;
|
||||
#[path = "app/browser.rs"]
|
||||
mod browser;
|
||||
|
||||
use gtk::prelude::{
|
||||
ApplicationExt,
|
||||
ApplicationExtManual,
|
||||
GtkApplicationExt,
|
||||
GtkWindowExt
|
||||
};
|
||||
use gtk::prelude::{ApplicationExt, ApplicationExtManual, GtkApplicationExt, GtkWindowExt};
|
||||
|
||||
use gtk::{
|
||||
Application,
|
||||
glib
|
||||
};
|
||||
use gtk::{glib, Application};
|
||||
|
||||
fn main() -> glib::ExitCode
|
||||
{
|
||||
fn main() -> glib::ExitCode {
|
||||
// Init app
|
||||
let app = Application::builder().application_id(
|
||||
"io.github.yggverse.Yoda.app"
|
||||
).build();
|
||||
let app = Application::builder()
|
||||
.application_id("io.github.yggverse.Yoda.app")
|
||||
.build();
|
||||
|
||||
// Init accels
|
||||
app.set_accels_for_action(
|
||||
"win.tab_append", &["<Ctrl>t"]
|
||||
);
|
||||
|
||||
app.set_accels_for_action(
|
||||
"win.tab_close", &["<Ctrl>q"]
|
||||
);
|
||||
|
||||
app.set_accels_for_action(
|
||||
"win.debug", &["<Ctrl>i"]
|
||||
);
|
||||
|
||||
app.set_accels_for_action(
|
||||
"win.quit", &["<Ctrl>Escape"]
|
||||
);
|
||||
app.set_accels_for_action("win.tab_append", &["<Ctrl>t"]);
|
||||
app.set_accels_for_action("win.tab_close", &["<Ctrl>q"]);
|
||||
app.set_accels_for_action("win.debug", &["<Ctrl>i"]);
|
||||
app.set_accels_for_action("win.quit", &["<Ctrl>Escape"]);
|
||||
|
||||
// Create new window
|
||||
app.connect_activate(
|
||||
|app|
|
||||
{
|
||||
browser::new(
|
||||
app,
|
||||
640,
|
||||
480
|
||||
).present();
|
||||
}
|
||||
);
|
||||
app.connect_activate(|app| {
|
||||
browser::new(app, 640, 480).present();
|
||||
});
|
||||
|
||||
// Start
|
||||
app.run()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user