[gnome-contacts] Add support for hiding contacts
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Add support for hiding contacts
- Date: Mon, 19 Dec 2011 14:31:34 +0000 (UTC)
commit caac089f11b0066bbe9dab249bfc6ece832ead4b
Author: Erick PÃrez Castellanos <erick red gmail com>
Date: Mon Dec 19 15:30:37 2011 +0100
Add support for hiding contacts
This is useful to emulate undoable delete
src/contacts-contact.vala | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index cf1be9f..1354db0 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -256,12 +256,17 @@ public class Contacts.Contact : GLib.Object {
private bool _is_hidden;
private bool _is_hidden_uptodate;
+ private bool _is_hidden_to_delete;
private bool _get_is_hidden () {
// Don't show the user itself
if (individual.is_user)
return true;
+ // Contact has been deleted (but this is not actually posted, for undo support)
+ if (_is_hidden_to_delete)
+ return true;
+
var personas = individual.personas;
var i = personas.iterator();
// Look for single-persona individuals
@@ -300,6 +305,18 @@ public class Contacts.Contact : GLib.Object {
}
}
+ public void hide () {
+ _is_hidden_to_delete = true;
+
+ queue_changed (false);
+ }
+
+ public void show () {
+ _is_hidden_to_delete = false;
+
+ queue_changed (false);
+ }
+
public static Contact from_individual (Individual i) {
return i.get_data ("contact");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]