mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 09:10:08 +00:00
draft ggemini 0.11.0 version api
This commit is contained in:
parent
5152d915d1
commit
88a37c545b
@ -17,7 +17,7 @@ features = ["v1_6"]
|
||||
|
||||
[dependencies.gemini]
|
||||
package = "ggemini"
|
||||
version = "0.10.0"
|
||||
version = "0.11.0"
|
||||
|
||||
[dependencies.gemtext]
|
||||
package = "ggemtext"
|
||||
|
@ -135,10 +135,10 @@ impl Tab {
|
||||
// Register dynamically created tab components in the HashMap index
|
||||
self.index
|
||||
.borrow_mut()
|
||||
.insert(item.id().clone(), item.clone());
|
||||
.insert(item.id.clone(), item.clone());
|
||||
|
||||
item.page()
|
||||
.navigation()
|
||||
item.page
|
||||
.navigation
|
||||
.request()
|
||||
.widget()
|
||||
.gobject()
|
||||
@ -163,7 +163,7 @@ impl Tab {
|
||||
if let Some(page) = self.widget.page(page_position) {
|
||||
if let Some(id) = page.keyword() {
|
||||
if let Some(item) = self.index.borrow().get(&id) {
|
||||
return match item.page().bookmark() {
|
||||
return match item.page.bookmark() {
|
||||
Ok(result) => Ok(result),
|
||||
Err(_) => Err(Error::Bookmark),
|
||||
};
|
||||
@ -182,7 +182,7 @@ impl Tab {
|
||||
if let Some(page) = self.widget.page(page_position) {
|
||||
if let Some(id) = page.keyword() {
|
||||
if let Some(item) = self.index.borrow().get(&id) {
|
||||
item.page().home();
|
||||
item.page.home();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -192,7 +192,7 @@ impl Tab {
|
||||
if let Some(page) = self.widget.page(page_position) {
|
||||
if let Some(id) = page.keyword() {
|
||||
if let Some(item) = self.index.borrow().get(&id) {
|
||||
item.page().history_back();
|
||||
item.page.history_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,7 +202,7 @@ impl Tab {
|
||||
if let Some(page) = self.widget.page(page_position) {
|
||||
if let Some(id) = page.keyword() {
|
||||
if let Some(item) = self.index.borrow().get(&id) {
|
||||
item.page().history_forward();
|
||||
item.page.history_forward();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -213,7 +213,7 @@ impl Tab {
|
||||
if let Some(page) = self.widget.page(page_position) {
|
||||
if let Some(id) = page.keyword() {
|
||||
if let Some(item) = self.index.borrow().get(&id) {
|
||||
item.page().reload();
|
||||
item.page.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -231,10 +231,10 @@ impl Tab {
|
||||
item.update();
|
||||
|
||||
// Update tab title on loading indicator inactive
|
||||
if !item.page().is_loading() {
|
||||
item.widget()
|
||||
if !item.page.is_loading() {
|
||||
item.widget
|
||||
.gobject()
|
||||
.set_title(item.page().meta().title().as_str())
|
||||
.set_title(item.page.meta.title().as_str())
|
||||
}
|
||||
}
|
||||
// Update all tabs on ID not found @TODO change initial update method
|
||||
@ -244,10 +244,10 @@ impl Tab {
|
||||
item.update();
|
||||
|
||||
// Update tab title on loading indicator inactive
|
||||
if !item.page().is_loading() {
|
||||
item.widget()
|
||||
if !item.page.is_loading() {
|
||||
item.widget
|
||||
.gobject()
|
||||
.set_title(item.page().meta().title().as_str())
|
||||
.set_title(item.page.meta.title().as_str())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -299,7 +299,7 @@ impl Tab {
|
||||
// Register dynamically created tab item in the HashMap index
|
||||
self.index
|
||||
.borrow_mut()
|
||||
.insert(item.id().clone(), item.clone());
|
||||
.insert(item.id.clone(), item.clone());
|
||||
}
|
||||
}
|
||||
Err(e) => return Err(e.to_string()),
|
||||
@ -327,10 +327,10 @@ impl Tab {
|
||||
item.save(
|
||||
transaction,
|
||||
&id,
|
||||
&self.widget.gobject().page_position(item.widget().gobject()),
|
||||
&item.widget().gobject().is_pinned(),
|
||||
&item.widget().gobject().is_selected(),
|
||||
&item.widget().gobject().needs_attention(),
|
||||
&self.widget.gobject().page_position(item.widget.gobject()),
|
||||
&item.widget.gobject().is_pinned(),
|
||||
&item.widget.gobject().is_selected(),
|
||||
&item.widget.gobject().needs_attention(),
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
@ -24,10 +24,10 @@ use std::rc::Rc;
|
||||
pub struct Item {
|
||||
// Auto-generated unique item ID
|
||||
// useful as widget name in GTK actions callback
|
||||
id: GString,
|
||||
pub id: GString,
|
||||
// Components
|
||||
page: Rc<Page>,
|
||||
widget: Rc<Widget>,
|
||||
pub page: Rc<Page>,
|
||||
pub widget: Rc<Widget>,
|
||||
}
|
||||
|
||||
impl Item {
|
||||
@ -57,7 +57,7 @@ impl Item {
|
||||
let widget = Rc::new(Widget::new(
|
||||
id.as_str(),
|
||||
tab_view,
|
||||
page.widget().gobject(),
|
||||
page.widget.gobject(),
|
||||
None,
|
||||
position,
|
||||
(is_pinned, is_selected, is_attention),
|
||||
@ -66,11 +66,7 @@ impl Item {
|
||||
// Init events
|
||||
|
||||
if let Some(text) = request {
|
||||
page.navigation()
|
||||
.request()
|
||||
.widget()
|
||||
.gobject()
|
||||
.set_text(&text);
|
||||
page.navigation.request().widget().gobject().set_text(&text);
|
||||
|
||||
if is_load {
|
||||
page.load(true);
|
||||
@ -83,7 +79,7 @@ impl Item {
|
||||
let parent = tab_view.clone().upcast::<gtk::Widget>();
|
||||
move || {
|
||||
// Request should match valid URI for all drivers supported
|
||||
if let Some(uri) = page.navigation().request().uri() {
|
||||
if let Some(uri) = page.navigation.request().uri() {
|
||||
// Rout by scheme
|
||||
if uri.scheme().to_lowercase() == "gemini" {
|
||||
return identity::new_gemini(profile.clone(), actions.1.clone(), uri)
|
||||
@ -100,11 +96,7 @@ impl Item {
|
||||
let page = page.clone();
|
||||
move |request, is_history| {
|
||||
if let Some(text) = request {
|
||||
page.navigation()
|
||||
.request()
|
||||
.widget()
|
||||
.gobject()
|
||||
.set_text(&text);
|
||||
page.navigation.request().widget().gobject().set_text(&text);
|
||||
}
|
||||
page.load(is_history);
|
||||
}
|
||||
@ -120,7 +112,7 @@ impl Item {
|
||||
self.page.update();
|
||||
|
||||
// Update tab loading indicator
|
||||
self.widget.gobject().set_loading(self.page().is_loading());
|
||||
self.widget.gobject().set_loading(self.page.is_loading());
|
||||
}
|
||||
|
||||
pub fn clean(
|
||||
@ -222,20 +214,6 @@ impl Item {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
||||
pub fn id(&self) -> &GString {
|
||||
&self.id
|
||||
}
|
||||
|
||||
pub fn page(&self) -> &Rc<Page> {
|
||||
&self.page
|
||||
}
|
||||
|
||||
pub fn widget(&self) -> &Rc<Widget> {
|
||||
&self.widget
|
||||
}
|
||||
}
|
||||
|
||||
// Tools
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user