[gnome-contacts] Use new generic child-has-focus tracking
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Use new generic child-has-focus tracking
- Date: Mon, 19 Dec 2011 13:52:04 +0000 (UTC)
commit 39f13c46701b33779be57438c191827dc2f37d10
Author: Alexander Larsson <alexl redhat com>
Date: Mon Dec 19 11:26:42 2011 +0100
Use new generic child-has-focus tracking
src/contacts-contact-pane.vala | 49 ++++++++-------------------------------
1 files changed, 10 insertions(+), 39 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 1a44e41..18e2dc7 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -397,7 +397,6 @@ public abstract class Contacts.FieldSet : Grid {
public class Contacts.TitleFieldRow : FieldRow {
PersonaSheet sheet;
- ulong set_focus_child_id;
Grid grid;
public TitleFieldRow (PersonaSheet sheet, string text) {
@@ -430,37 +429,23 @@ public class Contacts.TitleFieldRow : FieldRow {
});
});
- var parent_container = (this.get_parent () as Container);
- var pane = sheet.pane;
- var row = this;
- set_focus_child_id = parent_container.set_focus_child.connect ( (widget) => {
- if (parent_container.get_focus_child () != row) {
- Idle.add(() => {
- if (pane.editing_row == row)
- pane.exit_edit_mode (true);
- return false;
- });
- }
- });
-
return true;
}
+ public override void lost_child_focus () {
+ if (sheet.pane.editing_row == this)
+ sheet.pane.exit_edit_mode (true);
+ }
+
public override void exit_edit_mode (bool save) {
unlink_button.destroy ();
- var parent = this.get_parent ();
- if (parent != null) {
- var parent_container = (parent as Container);
- parent_container.disconnect (set_focus_child_id);
- }
this.set_can_focus (true);
}
}
public abstract class Contacts.DataFieldRow : FieldRow {
public FieldSet field_set;
- ulong set_focus_child_id;
bool editable;
protected Button? delete_button;
@@ -506,34 +491,20 @@ public abstract class Contacts.DataFieldRow : FieldRow {
w.show_all ();
}
- var parent_container = (this.get_parent () as Container);
- var pane = field_set.sheet.pane;
- var row = this;
- set_focus_child_id = parent_container.set_focus_child.connect ( (widget) => {
- if (parent_container.get_focus_child () != row) {
- Idle.add(() => {
- if (pane.editing_row == row)
- pane.exit_edit_mode (true);
- return false;
- });
- }
- });
-
return true;
}
+ public override void lost_child_focus () {
+ if (field_set.sheet.pane.editing_row == this)
+ field_set.sheet.pane.exit_edit_mode (true);
+ }
+
public override void exit_edit_mode (bool save) {
if (!editable)
return;
var had_child_focus = this.get_focus_child () != null;
- var parent = this.get_parent ();
- if (parent != null) {
- var parent_container = (parent as Container);
- parent_container.disconnect (set_focus_child_id);
- }
-
var changed = finish_edit_widgets (save);
delete_button = null;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]