use single variant conversion for defaults

This commit is contained in:
yggverse 2024-11-05 03:26:55 +02:00
parent 6fff9be393
commit 7d14cfcf94

View File

@ -41,7 +41,7 @@ impl App {
profile_path: PathBuf, profile_path: PathBuf,
) -> Self { ) -> Self {
// Init defaults // Init defaults
const DEFAULT_ACTION_PAGE_STATE: i32 = -1; let default_state = (-1).to_variant();
// Init actions // Init actions
let action_about = Action::new("win", true, None); let action_about = Action::new("win", true, None);
@ -50,19 +50,13 @@ impl App {
let action_quit = Action::new("win", true, None); let action_quit = Action::new("win", true, None);
let action_update = Action::new("win", true, Some(&String::static_variant_type())); let action_update = Action::new("win", true, Some(&String::static_variant_type()));
let action_page_new = Action::new("win", true, None); let action_page_new = Action::new("win", true, None);
let action_page_close = let action_page_close = Action::new_stateful("win", true, None, &default_state);
Action::new_stateful("win", true, None, &DEFAULT_ACTION_PAGE_STATE.to_variant());
let action_page_close_all = Action::new("win", true, None); let action_page_close_all = Action::new("win", true, None);
let action_page_home = let action_page_home = Action::new_stateful("win", false, None, &default_state);
Action::new_stateful("win", false, None, &DEFAULT_ACTION_PAGE_STATE.to_variant()); let action_page_history_back = Action::new_stateful("win", false, None, &default_state);
let action_page_history_back = let action_page_history_forward = Action::new_stateful("win", false, None, &default_state);
Action::new_stateful("win", false, None, &DEFAULT_ACTION_PAGE_STATE.to_variant()); let action_page_reload = Action::new_stateful("win", true, None, &default_state);
let action_page_history_forward = let action_page_pin = Action::new_stateful("win", true, None, &default_state);
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());
// Init GTK // Init GTK
let gobject = Application::builder() let gobject = Application::builder()