Skip to content

Commit 59f6685

Browse files
authored
Add keyboard support for save as (#19)
* Add keyboard support for save as * Use common hotkey for save as
1 parent 1b10cc1 commit 59f6685

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/Application.vala

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,17 @@ public class Application : Gtk.Application {
4949
open_document_action.activate.connect (on_open_document);
5050
this.add_action (open_document_action);
5151

52-
//TODO: Vala complains about the method not existing
53-
/*SimpleAction saveas_action = new SimpleAction ("saveas", null);
54-
set_accels_for_action ("app.saveas", {"<Control>s"});
55-
add_action (saveas);
52+
SimpleAction saveas_action = new SimpleAction ("saveas", null);
53+
set_accels_for_action ("app.saveas", {"<Control><Shift>s"});
54+
add_action (saveas_action);
5655
saveas_action.activate.connect (() => {
57-
this.get_active_window ().on_save_as ();
58-
});*/
56+
unowned var window = this.get_active_window () as AppWindow;
57+
if (window == null) {
58+
return;
59+
}
60+
61+
window.on_save_as ();
62+
});
5963

6064
SimpleAction quit_action = new SimpleAction ("quit", null);
6165
set_accels_for_action ("app.quit", {"<Control>q"});

src/Window.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class AppWindow : Gtk.Window {
3333
};
3434
var save_as_button = new Gtk.Button.from_icon_name ("document-save-as") {
3535
tooltip_markup = Granite.markup_accel_tooltip (
36-
{"<Control>s"},
36+
{"<Control><Shift>s"},
3737
_("Save as")
3838
)
3939
};

0 commit comments

Comments
 (0)