[gnome-contacts] Don't allow empty custom types
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Don't allow empty custom types
- Date: Wed, 31 Aug 2011 10:41:45 +0000 (UTC)
commit 7517a29c1ef132aee4947aed7e07cda604070158
Author: Alexander Larsson <alexl redhat com>
Date: Wed Aug 31 12:31:28 2011 +0200
Don't allow empty custom types
src/contacts-types.vala | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/contacts-types.vala b/src/contacts-types.vala
index 1b7388d..2c4b3c0 100644
--- a/src/contacts-types.vala
+++ b/src/contacts-types.vala
@@ -332,6 +332,7 @@ public class Contacts.TypeCombo : Grid {
TypeSet type_set;
ComboBox combo;
Entry entry;
+ TreeIter last_active;
bool custom_mode;
bool in_manual_change;
@@ -383,10 +384,15 @@ public class Contacts.TypeCombo : Grid {
custom_mode = false;
var text = entry.get_text ();
- TreeIter iter;
- type_set.add_custom_label (text, out iter);
+ if (text != "") {
+ TreeIter iter;
+ type_set.add_custom_label (text, out iter);
- combo.set_active_iter (iter);
+ last_active = iter;
+ combo.set_active_iter (iter);
+ } else {
+ combo.set_active_iter (last_active);
+ }
combo.show ();
entry.hide ();
@@ -413,6 +419,7 @@ public class Contacts.TypeCombo : Grid {
entry.show ();
entry.grab_focus ();
} else {
+ last_active = iter;
this.changed ();
}
}
@@ -422,6 +429,7 @@ public class Contacts.TypeCombo : Grid {
TreeIter iter;
type_set.lookup_type (details, out iter);
in_manual_change = true;
+ last_active = iter;
combo.set_active_iter (iter);
in_manual_change = false;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]