[gnome-contacts] Add F1 and Ctrl+N keyboard shortcuts for Help & New Contact



commit df4f925fa19d72e87a93a6442982c87c0f9b2ccb
Author: Jeremy Bicha <jbicha ubuntu com>
Date:   Sat Nov 3 22:36:12 2012 -0400

    Add F1 and Ctrl+N keyboard shortcuts for Help & New Contact
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685587

 src/contacts-app.vala |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index c11c931..b8a577f 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -217,6 +217,7 @@ public class Contacts.App : Gtk.Application {
     action = new GLib.SimpleAction ("help", null);
     action.activate.connect (() => { show_help (); });
     this.add_action (action);
+    this.add_accelerator ("F1", "app.help", null);
 
     action = new GLib.SimpleAction ("about", null);
     action.activate.connect (() => { show_about (); });
@@ -226,6 +227,11 @@ public class Contacts.App : Gtk.Application {
     action.activate.connect (() => { change_address_book (); });
     this.add_action (action);
 
+    action = new GLib.SimpleAction ("new_contact", null);
+    action.activate.connect (() => { new_contact (); });
+    this.add_action (action);
+    this.add_accelerator ("<Primary>n", "app.new_contact", null);
+
     var builder = new Builder ();
     builder.set_translation_domain (Config.GETTEXT_PACKAGE);
     try {
@@ -257,10 +263,7 @@ public class Contacts.App : Gtk.Application {
     add_button.margin_left = 4;
     add_button.is_important = true;
     toolbar.add (add_button);
-    add_button.clicked.connect ( (button) => {
-	var dialog = new NewContactDialog (contacts_store, window);
-	dialog.show_all ();
-      });
+    add_button.clicked.connect (app.new_contact);
 
     toolbar = new Toolbar ();
     toolbar.set_icon_size (IconSize.MENU);
@@ -381,6 +384,11 @@ public class Contacts.App : Gtk.Application {
     overlay.add_overlay (notification);
   }
 
+  public void new_contact () {
+    var dialog = new NewContactDialog (contacts_store, window);
+    dialog.show_all ();
+  }
+
   private void delete_contact (Contact contact) {
     var notification = new Gtk.Notification ();
 



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