Added hotkeys for tab switching

The hotkeys are the same as in Placidus, as the original Astrognome didn't
have any.
This commit is contained in:
Gergely Polonkai 2013-09-20 12:41:21 +02:00
parent e180603a6b
commit 8ef33d3dec
2 changed files with 13 additions and 0 deletions

View File

@ -198,6 +198,8 @@ setup_accelerators(AgApp *app)
gtk_application_add_accelerator(GTK_APPLICATION(app), "<Primary>s", "win.save", NULL); gtk_application_add_accelerator(GTK_APPLICATION(app), "<Primary>s", "win.save", NULL);
gtk_application_add_accelerator(GTK_APPLICATION(app), "<Primary><Shift>s", "win.save-as", NULL); gtk_application_add_accelerator(GTK_APPLICATION(app), "<Primary><Shift>s", "win.save-as", NULL);
gtk_application_add_accelerator(GTK_APPLICATION(app), "F10", "win.gear-menu", 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 static void

View File

@ -277,11 +277,22 @@ tab_changed_cb(GdStack *stack, GParamSpec *pspec, AgWindow *window)
window->priv->current_tab = active_tab; 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[] = { static GActionEntry win_entries[] = {
{ "close", ag_window_close_action, NULL, NULL, NULL }, { "close", ag_window_close_action, NULL, NULL, NULL },
{ "save", ag_window_save_action, NULL, NULL, NULL }, { "save", ag_window_save_action, NULL, NULL, NULL },
{ "save-as", ag_window_save_as_action, NULL, NULL, NULL }, { "save-as", ag_window_save_as_action, NULL, NULL, NULL },
{ "gear-menu", ag_window_gear_menu_action, NULL, "false", NULL }, { "gear-menu", ag_window_gear_menu_action, NULL, "false", NULL },
{ "change-tab", ag_window_change_tab_action, "s", "'edit'", NULL },
}; };
static void static void