From 8ef33d3dec6333171e9e75d419d35f8d6317e08f Mon Sep 17 00:00:00 2001 From: "Gergely POLONKAI (W00d5t0ck)" Date: Fri, 20 Sep 2013 12:41:21 +0200 Subject: [PATCH] Added hotkeys for tab switching The hotkeys are the same as in Placidus, as the original Astrognome didn't have any. --- src/ag-app.c | 2 ++ src/ag-window.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/ag-app.c b/src/ag-app.c index f71fc40..54772fd 100644 --- a/src/ag-app.c +++ b/src/ag-app.c @@ -198,6 +198,8 @@ setup_accelerators(AgApp *app) gtk_application_add_accelerator(GTK_APPLICATION(app), "s", "win.save", NULL); gtk_application_add_accelerator(GTK_APPLICATION(app), "s", "win.save-as", NULL); gtk_application_add_accelerator(GTK_APPLICATION(app), "F10", "win.gear-menu", NULL); + gtk_application_add_accelerator(GTK_APPLICATION(app), "F5", "win.change-tab", g_variant_new_string("chart")); + gtk_application_add_accelerator(GTK_APPLICATION(app), "F9", "win.change-tab", g_variant_new_string("aspects")); } static void diff --git a/src/ag-window.c b/src/ag-window.c index 90be347..16fb380 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -277,11 +277,22 @@ tab_changed_cb(GdStack *stack, GParamSpec *pspec, AgWindow *window) window->priv->current_tab = active_tab; } +static void +ag_window_change_tab_action(GSimpleAction *action, GVariant *parameter, gpointer user_data) +{ + AgWindow *window = user_data; + const gchar *target_tab = g_variant_get_string(parameter, NULL); + + gd_stack_set_visible_child_name(GD_STACK(window->priv->stack), target_tab); + g_action_change_state(G_ACTION(action), parameter); +} + static GActionEntry win_entries[] = { { "close", ag_window_close_action, NULL, NULL, NULL }, { "save", ag_window_save_action, NULL, NULL, NULL }, { "save-as", ag_window_save_as_action, NULL, NULL, NULL }, { "gear-menu", ag_window_gear_menu_action, NULL, "false", NULL }, + { "change-tab", ag_window_change_tab_action, "s", "'edit'", NULL }, }; static void