Added Open/Save functionality to the menus

This commit is contained in:
Gergely Polonkai 2013-09-17 13:58:49 +02:00
parent 6c7bd24ff6
commit 72df6b944d
3 changed files with 23 additions and 0 deletions

View File

@ -103,6 +103,11 @@ quit_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
}
}
static void
open_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
}
static void
raise_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
@ -119,6 +124,7 @@ static GActionEntry app_entries[] = {
{ "about", about_cb, NULL, NULL, NULL },
{ "quit", quit_cb, NULL, NULL, NULL },
{ "raise", raise_cb, NULL, NULL, NULL },
{ "open", open_cb, NULL, NULL, NULL },
};
static void
@ -131,6 +137,7 @@ static void
setup_accelerators(AgApp *app)
{
gtk_application_add_accelerator(GTK_APPLICATION(app), "<Primary>w", "win.close", NULL);
gtk_application_add_accelerator(GTK_APPLICATION(app), "<Primary>s", "win.save", NULL);
gtk_application_add_accelerator(GTK_APPLICATION(app), "F10", "win.gear-menu", NULL);
}

View File

@ -62,6 +62,11 @@ close_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
gtk_widget_destroy(GTK_WIDGET(window));
}
static void
save_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
}
static void
chart_changed(AgChart *chart, gpointer user_data)
{
@ -128,6 +133,7 @@ tab_changed_cb(GdStack *stack, GParamSpec *pspec, AgWindow *window)
static GActionEntry win_entries[] = {
{ "close", close_cb, NULL, NULL, NULL },
{ "save", save_cb, NULL, NULL, NULL },
{ "gear-menu", gear_menu_cb, NULL, "false", NULL },
};

View File

@ -8,6 +8,11 @@
<attribute name="action">app.new-window</attribute>
<attribute name="accel">&lt;Primary&gt;n</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Open</attribute>
<attribute name="action">app.open</attribute>
<attribute name="accel">&lt;Primary&gt;o</attribute>
</item>
</section>
<section>
<item>
@ -29,5 +34,10 @@
</section>
</menu>
<menu id="window-menu">
<item>
<attribute name="label" translatable="yes">Save</attribute>
<attribute name="action">win.save</attribute>
<attribute name="accel">&lt;Primary&gt;s</attribute>
</item>
</menu>
</interface>