From 70df09855eed403029319f3cdfac035deae40b3a Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 5 Nov 2024 04:30:00 +0200 Subject: [PATCH] draft accels configuration array --- src/app.rs | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/app.rs b/src/app.rs index 4684b169..257c95a0 100644 --- a/src/app.rs +++ b/src/app.rs @@ -64,22 +64,25 @@ impl App { .build(); // Init accels - gobject.set_accels_for_action(&action_debug.detailed_name(), &["i"]); - gobject.set_accels_for_action(&action_update.detailed_name(), &["u"]); - gobject.set_accels_for_action(&action_quit.detailed_name(), &["Escape"]); - gobject.set_accels_for_action(&action_page_new.detailed_name(), &["t"]); - gobject.set_accels_for_action(&action_page_pin.detailed_name(), &["p"]); - gobject.set_accels_for_action(&action_page_close.detailed_name(), &["q"]); - gobject.set_accels_for_action(&action_page_home.detailed_name(), &["h"]); - gobject.set_accels_for_action( - &action_page_history_back.detailed_name(), - &["Left"], - ); - gobject.set_accels_for_action( - &action_page_history_forward.detailed_name(), - &["Right"], - ); - gobject.set_accels_for_action(&action_page_reload.detailed_name(), &["r"]); + let accels_config = &[ + (action_page_reload.detailed_name(), &["r"]), + (action_debug.detailed_name(), &["i"]), + (action_page_close.detailed_name(), &["q"]), + (action_page_history_back.detailed_name(), &["Left"]), + ( + action_page_history_forward.detailed_name(), + &["Right"], + ), + (action_page_home.detailed_name(), &["h"]), + (action_page_new.detailed_name(), &["t"]), + (action_page_pin.detailed_name(), &["p"]), + (action_quit.detailed_name(), &["Escape"]), + (action_update.detailed_name(), &["u"]), + ]; // @TODO config + + for (detailed_action_name, &accels) in accels_config { + gobject.set_accels_for_action(detailed_action_name, &accels); + } // Init components let browser = Arc::new(Browser::new(