[gnome-contacts] Don't show contact itself in link dialog
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Don't show contact itself in link dialog
- Date: Tue, 6 Sep 2011 11:49:45 +0000 (UTC)
commit 0c0c99e3678688670e421ca588417bf3473fd097
Author: Alexander Larsson <alexl redhat com>
Date: Tue Sep 6 13:06:56 2011 +0200
Don't show contact itself in link dialog
src/contacts-link-dialog.vala | 1 +
src/contacts-view.vala | 11 +++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/contacts-link-dialog.vala b/src/contacts-link-dialog.vala
index fb4e55d..87740d4 100644
--- a/src/contacts-link-dialog.vala
+++ b/src/contacts-link-dialog.vala
@@ -86,6 +86,7 @@ public class Contacts.LinkDialog : Dialog {
add_buttons (Stock.CLOSE, null);
view = new View (contact.store);
+ view.hide_contact (contact);
list = new ViewWidget (view);
var grid = new Grid ();
diff --git a/src/contacts-view.vala b/src/contacts-view.vala
index 0d17beb..bd42208 100644
--- a/src/contacts-view.vala
+++ b/src/contacts-view.vala
@@ -18,6 +18,7 @@
using Gtk;
using Folks;
+using Gee;
public class Contacts.View : GLib.Object {
private class ContactData {
@@ -29,10 +30,12 @@ public class Contacts.View : GLib.Object {
Store contacts_store;
ListStore list_store;
+ HashSet<Contact> hidden_contacts;
string []? filter_values;
public View (Store store) {
contacts_store = store;
+ hidden_contacts = new HashSet<Contact>();
list_store = new ListStore (2, typeof (Contact), typeof (ContactData *));
@@ -57,6 +60,9 @@ public class Contacts.View : GLib.Object {
if (contact.is_hidden ())
return false;
+ if (contact in hidden_contacts)
+ return false;
+
if (filter_values == null || filter_values.length == 0)
return true;
@@ -156,6 +162,11 @@ public class Contacts.View : GLib.Object {
}
}
+ public void hide_contact (Contact contact) {
+ hidden_contacts.add (contact);
+ refilter ();
+ }
+
public void set_filter_values (string []? values) {
filter_values = values;
refilter ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]