[gnome-contacts] Move grab_widget_later to Utils
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Move grab_widget_later to Utils
- Date: Mon, 19 Dec 2011 13:52:19 +0000 (UTC)
commit e8c3f4667bc6620e73f28d875d77ac4985ba6b70
Author: Alexander Larsson <alexl redhat com>
Date: Mon Dec 19 12:03:35 2011 +0100
Move grab_widget_later to Utils
src/contacts-contact-pane.vala | 12 ++----------
src/contacts-utils.vala | 8 ++++++++
2 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 19bd3e7..56fd2fc 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -523,17 +523,9 @@ public abstract class Contacts.DataFieldRow : FieldRow {
field_set.save ();
}
- public void grab_widget_later (Widget widget) {
- ulong id = 0;
- id = widget.size_allocate.connect ( () => {
- widget.grab_focus ();
- widget.disconnect (id);
- });
- }
-
public void setup_entry_for_edit (Entry entry, bool grab_focus = true) {
if (grab_focus) {
- grab_widget_later (entry);
+ Utils.grab_widget_later (entry);
}
entry.activate.connect_after ( () => {
field_set.sheet.pane.exit_edit_mode (true);
@@ -548,7 +540,7 @@ public abstract class Contacts.DataFieldRow : FieldRow {
public void setup_text_view_for_edit (TextView text, bool grab_focus = true) {
if (grab_focus) {
- grab_widget_later (text);
+ Utils.grab_widget_later (text);
}
text.key_press_event.connect ( (key_event) => {
if (key_event.keyval == Gdk.keyval_from_name ("Escape")) {
diff --git a/src/contacts-utils.vala b/src/contacts-utils.vala
index f574fb4..6d00181 100644
--- a/src/contacts-utils.vala
+++ b/src/contacts-utils.vala
@@ -188,4 +188,12 @@ public class Contacts.Utils : Object {
}
return res.str;
}
+
+ public static void grab_widget_later (Widget widget) {
+ ulong id = 0;
+ id = widget.size_allocate.connect ( () => {
+ widget.grab_focus ();
+ widget.disconnect (id);
+ });
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]