diff --git a/src/ag-app.c b/src/ag-app.c index 90a4597..c3e83b2 100644 --- a/src/ag-app.c +++ b/src/ag-app.c @@ -126,7 +126,7 @@ ag_app_open_chart(AgApp *app, GFile *file) uri = g_file_get_uri(file); ag_window_set_uri(AG_WINDOW(window), uri); g_free(uri); - ag_window_open_chart_tab(AG_WINDOW(window)); + ag_window_change_tab(AG_WINDOW(window), "chart"); } static void diff --git a/src/ag-window.c b/src/ag-window.c index cf1c460..1add944 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -65,6 +65,17 @@ ag_window_gear_menu_action(GSimpleAction *action, GVariant *parameter, gpointer g_variant_unref(state); } +static void +ag_window_view_menu_action(GSimpleAction *action, GVariant *parameter, gpointer user_data) +{ + GVariant *state; + + state = g_action_get_state(G_ACTION(action)); + g_action_change_state(G_ACTION(action), g_variant_new_boolean(!g_variant_get_boolean(state))); + + g_variant_unref(state); +} + static void ag_window_close_action(GSimpleAction *action, GVariant *parameter, gpointer user_data) { @@ -475,6 +486,7 @@ static GActionEntry win_entries[] = { { "save", ag_window_save_action, NULL, NULL, NULL }, { "save-as", ag_window_save_as_action, NULL, NULL, NULL }, { "export-svg", ag_window_export_svg_action, NULL, NULL, NULL }, + { "view-menu", ag_window_view_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 }, }; @@ -677,7 +689,11 @@ ag_window_settings_save(GtkWindow *window, GSettings *settings) } void -ag_window_open_chart_tab(AgWindow *window) +ag_window_change_tab(AgWindow *window, const gchar *tab_name) { - gtk_stack_set_visible_child_name(GTK_STACK(window->priv->stack), "chart"); + gtk_stack_set_visible_child_name(GTK_STACK(window->priv->stack), tab_name); + g_action_change_state( + g_action_map_lookup_action(G_ACTION_MAP(window), "change-tab"), + g_variant_new_string(tab_name) + ); } diff --git a/src/ag-window.h b/src/ag-window.h index c4d34ed..4ddb2e4 100644 --- a/src/ag-window.h +++ b/src/ag-window.h @@ -45,7 +45,7 @@ void ag_window_settings_restore(GtkWindow *window, GSettings *settings); void ag_window_settings_save(GtkWindow *window, GSettings *settings); -void ag_window_open_chart_tab(AgWindow *window); +void ag_window_change_tab(AgWindow *window, const gchar *tab_name); #define AG_WINDOW_ERROR (ag_window_error_quark()) GQuark ag_window_error_quark(void); diff --git a/src/ag-window.ui b/src/ag-window.ui index 4b56309..7d67ae9 100644 --- a/src/ag-window.ui +++ b/src/ag-window.ui @@ -2,6 +2,34 @@ + +
+ + Edit + win.change-tab + <F3> + edit + + + Chart + win.change-tab + <F5> + chart + + + Aspects + win.change-tab + <F6> + aspects + + + Points + win.change-tab + <F7> + points + +
+
@@ -87,7 +115,6 @@ True False False - True True @@ -97,37 +124,53 @@ + + + + + True + center + False + win.gear-menu + gear_menu + True + - + True - False - stack + 1 + emblem-system-symbolic - - - True - center - False - win.gear-menu - gear_menu - True - - - - True - 1 - emblem-system-symbolic - - - - - end - - + + end + + + + + True + center + False + win.view-menu + view_menu + True + + + + True + 1 + document-properties-symbolic + + + + + end +