[gnome-contacts/new-design] Make chat fields non-editable
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts/new-design] Make chat fields non-editable
- Date: Thu, 15 Dec 2011 20:55:22 +0000 (UTC)
commit d9dcbdcd23f7497956b0af83265b657dbcfcf0c5
Author: Alexander Larsson <alexl redhat com>
Date: Thu Dec 15 19:37:52 2011 +0100
Make chat fields non-editable
src/contacts-contact-pane.vala | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index 8232f96..773734b 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -730,12 +730,19 @@ public abstract class Contacts.FieldSet : Grid {
public abstract class Contacts.DataFieldRow : FieldRow {
public FieldSet field_set;
ulong set_focus_child_id;
+ bool editable;
public DataFieldRow (FieldSet field_set) {
base (field_set.sheet.pane.row_group);
- this.set_can_focus (true);
+ set_editable (true);
this.field_set = field_set;
}
+
+ public void set_editable (bool editable) {
+ this.editable = editable;
+ set_can_focus (editable);
+ }
+
public abstract void update ();
public virtual void pack_edit_widgets () {
}
@@ -743,7 +750,10 @@ public abstract class Contacts.DataFieldRow : FieldRow {
return false;
}
- public void enter_edit_mode () {
+ public bool enter_edit_mode () {
+ if (!editable)
+ return false;
+
this.set_can_focus (false);
foreach (var w in this.get_children ()) {
w.hide ();
@@ -775,9 +785,14 @@ public abstract class Contacts.DataFieldRow : FieldRow {
});
}
});
+
+ return true;
}
public void exit_edit_mode (bool save) {
+ if (!editable)
+ return;
+
var had_child_focus = this.get_focus_child () != null;
var parent = this.get_parent ();
@@ -1017,6 +1032,7 @@ class Contacts.ChatFieldRow : DataFieldRow {
this.protocol = protocol;
this.details = details;
text_label = this.pack_text ();
+ this.set_editable (false);
}
public override void update () {
@@ -1481,8 +1497,9 @@ public class Contacts.ContactPane : ScrolledWindow {
public void enter_edit_mode (DataFieldRow row) {
if (editing_row != row) {
exit_edit_mode (true);
- editing_row = row;
- editing_row.enter_edit_mode ();
+ editing_row = null;
+ if (row.enter_edit_mode ())
+ editing_row = row;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]