[gnome-contacts/new-design] Add common helper for grab later
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts/new-design] Add common helper for grab later
- Date: Thu, 15 Dec 2011 22:34:17 +0000 (UTC)
commit 54fb62902dd8ee3cae1f662c88ec209bb42765d0
Author: Alexander Larsson <alexl redhat com>
Date: Thu Dec 15 23:18:06 2011 +0100
Add common helper for grab later
src/contacts-contact-pane.vala | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 17cbb23..0c13b1b 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -827,13 +827,17 @@ public abstract class Contacts.DataFieldRow : FieldRow {
field_set.save ();
}
- public void setup_entry_for_edit (Entry entry, bool grab_focus = true) {
- if (grab_focus) {
+ public void grab_widget_later (Widget widget) {
ulong id = 0;
- id = entry.size_allocate.connect ( () => {
- entry.grab_focus ();
- entry.disconnect (id);
+ 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);
}
entry.activate.connect ( () => {
field_set.sheet.pane.exit_edit_mode (true);
@@ -848,11 +852,7 @@ public abstract class Contacts.DataFieldRow : FieldRow {
public void setup_text_view_for_edit (TextView text, bool grab_focus = true) {
if (grab_focus) {
- ulong id = 0;
- id = text.size_allocate.connect ( () => {
- text.grab_focus ();
- text.disconnect (id);
- });
+ grab_widget_later (text);
}
text.key_press_event.connect ( (key_event) => {
if (key_event.keyval == Gdk.keyval_from_name ("Escape")) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]