[gnome-contacts] Window: moved signals handlers internally
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Window: moved signals handlers internally
- Date: Thu, 29 May 2014 20:25:50 +0000 (UTC)
commit 837fd69d91dfd9b877da481ab1b2179172480a44
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Sat Apr 26 10:29:50 2014 -0400
Window: moved signals handlers internally
src/contacts-app.vala | 32 --------------------------------
src/contacts-window.ui | 2 ++
src/contacts-window.vala | 32 ++++++++++++++++++++++++++++++++
3 files changed, 34 insertions(+), 32 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 336bb31..c367e02 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -34,35 +34,6 @@ public class Contacts.App : Gtk.Application {
private bool app_menu_created;
- private bool window_delete_event (Gdk.EventAny event) {
- // Clear the contacts so any changed information is stored
- contacts_pane.show_contact (null);
- return false;
- }
-
- private bool window_key_press_event (Gdk.EventKey event) {
- if ((event.keyval == Gdk.keyval_from_name ("q")) &&
- ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0)) {
- // Clear the contacts so any changed information is stored
- contacts_pane.show_contact (null);
- window.destroy ();
- } else if (((event.keyval == Gdk.Key.s) ||
- (event.keyval == Gdk.Key.f)) &&
- ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0)) {
- Utils.grab_entry_focus_no_select (list_pane.filter_entry);
- } else if (event.length >= 1 &&
- Gdk.keyval_to_unicode (event.keyval) != 0 &&
- (event.state & Gdk.ModifierType.CONTROL_MASK) == 0 &&
- (event.state & Gdk.ModifierType.MOD1_MASK) == 0 &&
- (event.keyval != Gdk.Key.Escape) &&
- (event.keyval != Gdk.Key.Tab) &&
- (event.keyval != Gdk.Key.BackSpace) ) {
- Utils.grab_entry_focus_no_select (list_pane.filter_entry);
- window.propagate_key_event (event);
- }
-
- return false;
- }
private void selection_changed (Contact? new_selection) {
/* FIXME: ask the user lo teave edit-mode and act accordingly */
@@ -239,9 +210,6 @@ public class Contacts.App : Gtk.Application {
contacts_store = window.contacts_store;
- window.delete_event.connect (window_delete_event);
- window.key_press_event.connect_after (window_key_press_event);
-
list_pane = window.list_pane;
list_pane.selection_changed.connect (selection_changed);
list_pane.link_contacts.connect (link_contacts);
diff --git a/src/contacts-window.ui b/src/contacts-window.ui
index 12e602b..ad40a57 100644
--- a/src/contacts-window.ui
+++ b/src/contacts-window.ui
@@ -8,6 +8,8 @@
<property name="default_width">800</property>
<property name="default_height">600</property>
<property name="icon_name">x-office-address-book</property>
+ <signal name="key-press-event" handler="key_press_event_cb" object="ContactsWindow" after="yes"
swapped="no"/>
+ <signal name="delete-event" handler="delete_event_cb" object="ContactsWindow" after="no" swapped="no"/>
<child type="titlebar">
<object class="GtkBox" id="box1">
<property name="visible">True</property>
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 2811a82..dfae97a 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -100,4 +100,36 @@ public class Contacts.Window : Gtk.ApplicationWindow {
public void add_notification (Widget notification) {
overlay.add_overlay (notification);
}
+
+ [GtkCallback]
+ bool key_press_event_cb (Gdk.EventKey event) {
+ if ((event.keyval == Gdk.keyval_from_name ("q")) &&
+ ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0)) {
+ // Clear the contacts so any changed information is stored
+ contacts_pane.show_contact (null);
+ destroy ();
+ } else if (((event.keyval == Gdk.Key.s) ||
+ (event.keyval == Gdk.Key.f)) &&
+ ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0)) {
+ Utils.grab_entry_focus_no_select (list_pane.filter_entry);
+ } else if (event.length >= 1 &&
+ Gdk.keyval_to_unicode (event.keyval) != 0 &&
+ (event.state & Gdk.ModifierType.CONTROL_MASK) == 0 &&
+ (event.state & Gdk.ModifierType.MOD1_MASK) == 0 &&
+ (event.keyval != Gdk.Key.Escape) &&
+ (event.keyval != Gdk.Key.Tab) &&
+ (event.keyval != Gdk.Key.BackSpace) ) {
+ Utils.grab_entry_focus_no_select (list_pane.filter_entry);
+ propagate_key_event (event);
+ }
+
+ return false;
+ }
+
+ [GtkCallback]
+ bool delete_event_cb (Gdk.EventAny event) {
+ // Clear the contacts so any changed information is stored
+ contacts_pane.show_contact (null);
+ return false;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]