mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
detect primary icon on construct, rename some actions
This commit is contained in:
parent
93942dd83d
commit
91e674ae29
3 changed files with 13 additions and 10 deletions
|
|
@ -94,7 +94,7 @@ impl Item {
|
||||||
|
|
||||||
action.identity.connect_activate({
|
action.identity.connect_activate({
|
||||||
let page = page.clone();
|
let page = page.clone();
|
||||||
move |_, _| page.navigation.identity()
|
move |_, _| page.navigation.show_identity_dialog()
|
||||||
});
|
});
|
||||||
|
|
||||||
action.reload.connect_activate({
|
action.reload.connect_activate({
|
||||||
|
|
|
||||||
|
|
@ -131,8 +131,8 @@ impl Navigation {
|
||||||
self.request.grab_focus()
|
self.request.grab_focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn identity(&self) {
|
pub fn show_identity_dialog(&self) {
|
||||||
self.request.identity(&self.profile)
|
self.request.show_identity_dialog(&self.profile)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ pub trait Request {
|
||||||
app_browser_window_tab_item_page_navigation_id: &i64,
|
app_browser_window_tab_item_page_navigation_id: &i64,
|
||||||
) -> Result<(), String>;
|
) -> Result<(), String>;
|
||||||
|
|
||||||
fn update(&self, profile: &Profile);
|
fn update_primary_icon(&self, profile: &Profile);
|
||||||
fn identity(&self, profile: &Rc<Profile>);
|
fn show_identity_dialog(&self, profile: &Rc<Profile>);
|
||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
|
|
||||||
|
|
@ -71,11 +71,14 @@ impl Request for Entry {
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// Detect primary icon on construct
|
||||||
|
entry.update_primary_icon(profile);
|
||||||
|
|
||||||
// Connect events
|
// Connect events
|
||||||
entry.connect_icon_release({
|
entry.connect_icon_release({
|
||||||
let profile = profile.clone();
|
let profile = profile.clone();
|
||||||
move |this, position| match position {
|
move |this, position| match position {
|
||||||
EntryIconPosition::Primary => this.identity(&profile),
|
EntryIconPosition::Primary => this.show_identity_dialog(&profile),
|
||||||
EntryIconPosition::Secondary => {
|
EntryIconPosition::Secondary => {
|
||||||
this.activate();
|
this.activate();
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +104,7 @@ impl Request for Entry {
|
||||||
item_action.home.set_enabled(this.home().is_some());
|
item_action.home.set_enabled(this.home().is_some());
|
||||||
|
|
||||||
// Update primary icon
|
// Update primary icon
|
||||||
this.update(&profile)
|
this.update_primary_icon(&profile)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -210,7 +213,7 @@ impl Request for Entry {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&self, profile: &Profile) {
|
fn update_primary_icon(&self, profile: &Profile) {
|
||||||
// Update primary icon
|
// Update primary icon
|
||||||
self.first_child().unwrap().remove_css_class("success"); // @TODO handle
|
self.first_child().unwrap().remove_css_class("success"); // @TODO handle
|
||||||
|
|
||||||
|
|
@ -245,7 +248,7 @@ impl Request for Entry {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Present identity [AlertDialog](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.AlertDialog.html) for `Self`
|
/// Present identity [AlertDialog](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.AlertDialog.html) for `Self`
|
||||||
fn identity(&self, profile: &Rc<Profile>) {
|
fn show_identity_dialog(&self, profile: &Rc<Profile>) {
|
||||||
// connect identity traits
|
// connect identity traits
|
||||||
use identity::{Common, Unsupported};
|
use identity::{Common, Unsupported};
|
||||||
if let Some(uri) = self.uri() {
|
if let Some(uri) = self.uri() {
|
||||||
|
|
@ -257,7 +260,7 @@ impl Request for Entry {
|
||||||
let profile = profile.clone();
|
let profile = profile.clone();
|
||||||
let this = self.clone();
|
let this = self.clone();
|
||||||
move |is_reload| {
|
move |is_reload| {
|
||||||
this.update(&profile);
|
this.update_primary_icon(&profile);
|
||||||
if is_reload {
|
if is_reload {
|
||||||
this.emit_activate();
|
this.emit_activate();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue