Created a Save As... menu item

This commit is contained in:
Gergely Polonkai 2013-09-18 10:09:32 +02:00
parent 573f05ceb4
commit c921e29c4a
3 changed files with 15 additions and 3 deletions

View File

@ -190,9 +190,10 @@ setup_actions(AgApp *app)
static void static void
setup_accelerators(AgApp *app) setup_accelerators(AgApp *app)
{ {
gtk_application_add_accelerator(GTK_APPLICATION(app), "<Primary>w", "win.close", NULL); 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), "<Primary>s", "win.save", NULL);
gtk_application_add_accelerator(GTK_APPLICATION(app), "F10", "win.gear-menu", 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);
} }
static void static void

View File

@ -166,6 +166,11 @@ save_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
xmlFreeDoc(doc); xmlFreeDoc(doc);
} }
static void
save_as_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
}
void void
ag_window_redraw_chart(AgWindow *window) ag_window_redraw_chart(AgWindow *window)
{ {
@ -265,6 +270,7 @@ tab_changed_cb(GdStack *stack, GParamSpec *pspec, AgWindow *window)
static GActionEntry win_entries[] = { static GActionEntry win_entries[] = {
{ "close", close_cb, NULL, NULL, NULL }, { "close", close_cb, NULL, NULL, NULL },
{ "save", save_cb, NULL, NULL, NULL }, { "save", save_cb, NULL, NULL, NULL },
{ "save-as", save_as_cb, NULL, NULL, NULL },
{ "gear-menu", gear_menu_cb, NULL, "false", NULL }, { "gear-menu", gear_menu_cb, NULL, "false", NULL },
}; };

View File

@ -39,5 +39,10 @@
<attribute name="action">win.save</attribute> <attribute name="action">win.save</attribute>
<attribute name="accel">&lt;Primary&gt;s</attribute> <attribute name="accel">&lt;Primary&gt;s</attribute>
</item> </item>
<item>
<attribute name="label" translatable="yes">Save as…</attribute>
<attribute name="action">win.save-as</attribute>
<attribute name="accel">&lt;Primary&gt;&lt;Shift&gt;s</attribute>
</item>
</menu> </menu>
</interface> </interface>