Skip to content

Commit

Permalink
Add accelerators to copy, paste, new, and rename
Browse files Browse the repository at this point in the history
  • Loading branch information
apmasell committed Sep 20, 2014
1 parent b446601 commit 2065720
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
</object>
</child>
<child>
<object class="GtkMenuItem" id="rename_window">
<object class="GtkMenuItem" id="rename_window_item">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Rename Window...</property>
Expand Down
14 changes: 14 additions & 0 deletions window.vala
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,23 @@ public class TabbedMux.Window : Gtk.ApplicationWindow {
[GtkChild]
private Gtk.Menu new_menu;
[GtkChild]
private Gtk.MenuItem new_session_item;
[GtkChild]
private Gtk.Notebook notebook;
[GtkChild]
private Gtk.Menu disconnect_menu;
[GtkChild]
private Gtk.MenuItem paste_item;
[GtkChild]
private Gtk.Menu saved_menu;
[GtkChild]
private Gtk.MenuItem saved_sessions_item;
[GtkChild]
private Gtk.Menu remove_saved_menu;
[GtkChild]
private Gtk.MenuItem remove_saved_item;
[GtkChild]
private Gtk.MenuItem rename_window_item;

private Settings settings;
private uint configure_id;
Expand Down Expand Up @@ -93,6 +99,14 @@ public class TabbedMux.Window : Gtk.ApplicationWindow {
int y;
settings.get ("position", "(ii)", out x, out y);
move (x, y);

var accel_group = new Gtk.AccelGroup();
add_accel_group(accel_group);
copy_item.add_accelerator("activate", accel_group, 'C', Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK, Gtk.AccelFlags.VISIBLE);
new_session_item.add_accelerator("activate", accel_group, 'T', Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK, Gtk.AccelFlags.VISIBLE);
paste_item.add_accelerator("activate", accel_group, 'V', Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK, Gtk.AccelFlags.VISIBLE);
rename_window_item.add_accelerator("activate", accel_group, 'R', Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK, Gtk.AccelFlags.VISIBLE);

if (app is Application) {
/* Make menus and tabs for the open streams. */
foreach (var stream in ((Application) app).streams) {
Expand Down

0 comments on commit 2065720

Please sign in to comment.