diff --git a/src/app/browser/action/focus.rs b/src/app/browser/action/focus.rs index 0e8be6f6..0b0c0b6b 100644 --- a/src/app/browser/action/focus.rs +++ b/src/app/browser/action/focus.rs @@ -1,4 +1,4 @@ -use gtk::{gio::SimpleAction, glib::uuid_string_random}; +use gtk::{gio::SimpleAction, glib::uuid_string_random, prelude::ActionExt}; /// [SimpleAction](https://docs.gtk.org/gio/class.SimpleAction.html) wrapper for `Focus` action of `Browser` group pub struct Focus { @@ -15,6 +15,14 @@ impl Focus { } } + // Actions + + /// Emit [activate](https://docs.gtk.org/gio/signal.SimpleAction.activate.html) signal + /// with formatted for this action [Variant](https://docs.gtk.org/glib/struct.Variant.html) value + pub fn activate(&self) { + self.gobject.activate(None); // @TODO custom value + } + // Events /// Define callback function for diff --git a/src/app/browser/window/tab/item/page.rs b/src/app/browser/window/tab/item/page.rs index dc4cef4d..9df13a2a 100644 --- a/src/app/browser/window/tab/item/page.rs +++ b/src/app/browser/window/tab/item/page.rs @@ -149,14 +149,11 @@ impl Page { const DEFAULT_MAX_REDIRECT_COUNT: usize = 10; // Move focus out from navigation entry - // self.navigation.reload.widget.gobject.grab_focus(); + self.browser_action.focus.activate(); // Reset widgets self.input.unset(); - // Create shared variant value - let id = self.id.clone(); - // Prevent infinitive redirection if self.meta.redirects() > DEFAULT_MAX_REDIRECT_COUNT { todo!() @@ -184,7 +181,7 @@ impl Page { // Update self.meta.set_status(Status::Reload).set_title("Loading.."); - self.browser_action.update.activate(Some(&id)); + self.browser_action.update.activate(Some(&self.id)); // Route by request match request { @@ -217,7 +214,7 @@ impl Page { .set_title(&status.title()); // Update window - self.browser_action.update.activate(Some(&id)); + self.browser_action.update.activate(Some(&self.id)); } } }