[gnome-contacts] App: hooked Ctrl+n to new contact creation mode



commit 8ca4c4078f3a1fa8f61fb342a190b93fa7228681
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Sun Aug 10 16:57:23 2014 -0400

    App: hooked Ctrl+n to new contact creation mode
    
    Fixed function name in Contacts.Window, reordered

 data/ui/contacts-window.ui |    2 +-
 src/contacts-app.vala      |    3 +--
 src/contacts-window.vala   |   34 +++++++++++++++++-----------------
 3 files changed, 19 insertions(+), 20 deletions(-)
---
diff --git a/data/ui/contacts-window.ui b/data/ui/contacts-window.ui
index f27b806..5272ecd 100644
--- a/data/ui/contacts-window.ui
+++ b/data/ui/contacts-window.ui
@@ -176,7 +176,7 @@
             <property name="can_focus">True</property>
             <property name="halign">center</property>
             <property name="valign">center</property>
-            <signal name="clicked" handler="add_button_clicked_cb" object="ContactsWindow" after="no" 
swapped="no"/>
+            <signal name="clicked" handler="new_contact" object="ContactsWindow" after="no" swapped="no"/>
             <child internal-child="accessible">
               <object class="AtkObject" id="add_button_atkobject">
                 <property name="AtkObject::accessible-name" translatable="yes">Add contact</property>
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 3b7440f..c1ca0c9 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -294,8 +294,7 @@ public class Contacts.App : Gtk.Application {
   }
 
   public void new_contact () {
-    var dialog = NewContactDialog.get_default (contacts_store, window);
-    dialog.show_all ();
+    window.new_contact ();
   }
 
   private static string individual_id = null;
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 2b2f96b..fca514c 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -305,6 +305,23 @@ public class Contacts.Window : Gtk.ApplicationWindow {
     edit_button.visible = (c != null) && !select_button.active;
   }
 
+  [GtkCallback]
+  public void new_contact () {
+    /* FIXME: eventually ContactPane will become just a skeleton and
+     * this call will go through to ContactEditor */
+    edit_mode = true;
+    new_contact_mode = true;
+
+    right_title = _("New Contact");
+
+    left_toolbar.get_style_context ().add_class ("selection-mode");
+    right_toolbar.get_style_context ().add_class ("selection-mode");
+
+    done_button.label = _("Add");
+
+    contact_pane.new_contact ();
+  }
+
   /* internal API */
   void init_content_widgets () {
     string layout_desc;
@@ -335,23 +352,6 @@ public class Contacts.Window : Gtk.ApplicationWindow {
   }
 
   [GtkCallback]
-  void add_button_clicked_cb (Button button) {
-    /* FIXME: eventually ContactPane will become just a skeleton and
-     * this call will go through to ContactEditor */
-    edit_mode = true;
-    new_contact_mode = true;
-
-    right_title = _("New Contact");
-
-    left_toolbar.get_style_context ().add_class ("selection-mode");
-    right_toolbar.get_style_context ().add_class ("selection-mode");
-
-    done_button.label = _("Add");
-
-    contact_pane.new_contact ();
-  }
-
-  [GtkCallback]
   bool key_press_event_cb (Gdk.EventKey event) {
     if ((event.keyval == Gdk.keyval_from_name ("q")) &&
         ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0)) {


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