From 7d14cfcf94f4c43f0c1992944128fde382dbdce8 Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 5 Nov 2024 03:26:55 +0200 Subject: [PATCH] use single variant conversion for defaults --- src/app.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/app.rs b/src/app.rs index 9e4120fb..4684b169 100644 --- a/src/app.rs +++ b/src/app.rs @@ -41,7 +41,7 @@ impl App { profile_path: PathBuf, ) -> Self { // Init defaults - const DEFAULT_ACTION_PAGE_STATE: i32 = -1; + let default_state = (-1).to_variant(); // Init actions let action_about = Action::new("win", true, None); @@ -50,19 +50,13 @@ impl App { let action_quit = Action::new("win", true, None); let action_update = Action::new("win", true, Some(&String::static_variant_type())); let action_page_new = Action::new("win", true, None); - let action_page_close = - Action::new_stateful("win", true, None, &DEFAULT_ACTION_PAGE_STATE.to_variant()); + let action_page_close = Action::new_stateful("win", true, None, &default_state); let action_page_close_all = Action::new("win", true, None); - let action_page_home = - Action::new_stateful("win", false, None, &DEFAULT_ACTION_PAGE_STATE.to_variant()); - let action_page_history_back = - Action::new_stateful("win", false, None, &DEFAULT_ACTION_PAGE_STATE.to_variant()); - let action_page_history_forward = - Action::new_stateful("win", false, None, &DEFAULT_ACTION_PAGE_STATE.to_variant()); - let action_page_reload = - Action::new_stateful("win", true, None, &DEFAULT_ACTION_PAGE_STATE.to_variant()); - let action_page_pin = - Action::new_stateful("win", true, None, &DEFAULT_ACTION_PAGE_STATE.to_variant()); + let action_page_home = Action::new_stateful("win", false, None, &default_state); + let action_page_history_back = Action::new_stateful("win", false, None, &default_state); + let action_page_history_forward = Action::new_stateful("win", false, None, &default_state); + let action_page_reload = Action::new_stateful("win", true, None, &default_state); + let action_page_pin = Action::new_stateful("win", true, None, &default_state); // Init GTK let gobject = Application::builder()