[gnome-contacts/new-design] Centralize entry setup for edit mode
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts/new-design] Centralize entry setup for edit mode
- Date: Thu, 15 Dec 2011 09:38:51 +0000 (UTC)
commit 95dbe1d51e7bd91c5c190fb62c8f4bb5568e4914
Author: Alexander Larsson <alexl redhat com>
Date: Tue Dec 13 23:00:18 2011 +0100
Centralize entry setup for edit mode
src/contacts-contact-pane.vala | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 94944f1..bd49502 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -713,6 +713,17 @@ public abstract class Contacts.DataFieldRow : FieldRow {
if (save && changed)
field_set.save ();
}
+
+ public void setup_entry_for_edit (Entry entry) {
+ ulong id = 0;
+ id = entry.size_allocate.connect ( () => {
+ entry.grab_focus ();
+ entry.disconnect (id);
+ });
+ entry.activate.connect ( () => {
+ field_set.sheet.pane.exit_edit_mode (true);
+ });
+ }
}
class Contacts.LinkFieldRow : DataFieldRow {
@@ -742,11 +753,7 @@ class Contacts.LinkFieldRow : DataFieldRow {
public override void pack_edit_widgets () {
entry = this.pack_entry (details.value);
- entry.grab_focus ();
- entry.set_text (details.value);
- entry.activate.connect ( () => {
- field_set.sheet.pane.exit_edit_mode (true);
- });
+ setup_entry_for_edit (entry);
}
public override bool finish_edit_widgets (bool save) {
@@ -814,10 +821,7 @@ class Contacts.EmailFieldRow : DataFieldRow {
public override void pack_edit_widgets () {
this.pack_entry_detail_combo (details.value, details, TypeSet.general, out entry, out combo);
- entry.grab_focus ();
- entry.activate.connect ( () => {
- field_set.sheet.pane.exit_edit_mode (true);
- });
+ setup_entry_for_edit (entry);
}
public override bool finish_edit_widgets (bool save) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]