[gitg] Activate commit on Ctrl+Enter



commit 2e77c44b3444cc2ea58e1d3715af11244bda59ab
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sun Jul 7 13:47:29 2013 +0200

    Activate commit on Ctrl+Enter

 gitg/commit/gitg-commit-dialog.vala |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/gitg/commit/gitg-commit-dialog.vala b/gitg/commit/gitg-commit-dialog.vala
index 843e1a3..900cb14 100644
--- a/gitg/commit/gitg-commit-dialog.vala
+++ b/gitg/commit/gitg-commit-dialog.vala
@@ -338,8 +338,24 @@ class Dialog : Gtk.Dialog
                d_too_long_tag.foreground_rgba = fg;
        }
 
+       private bool on_commit_message_key_press_event(Gtk.Widget widget, Gdk.EventKey event)
+       {
+               var mmask = Gtk.accelerator_get_default_mod_mask();
+
+               if ((mmask & event.state) == Gdk.ModifierType.CONTROL_MASK &&
+                   (event.keyval == Gdk.Key.Return || event.keyval == Gdk.Key.KP_Enter))
+               {
+                       d_button_ok.activate();
+                       return true;
+               }
+
+               return false;
+       }
+
        private void init_message_area()
        {
+               d_source_view_message.key_press_event.connect(on_commit_message_key_press_event);
+
                var b = d_source_view_message.buffer;
 
                d_subject_tag = b.create_tag("subject",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]