[gnome-contacts] Handling of selections (marking) in Contacts.View
- From: Erick PÃrez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Handling of selections (marking) in Contacts.View
- Date: Thu, 7 Feb 2013 13:09:56 +0000 (UTC)
commit 61a131f7fee6d35749270b6acdb8206675c9ce0e
Author: Erick PÃrez Castellanos <erick red gmail com>
Date: Tue Feb 5 11:30:05 2013 -0500
Handling of selections (marking) in Contacts.View
Added method to obtain marked contacts.
src/contacts-view.vala | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/contacts-view.vala b/src/contacts-view.vala
index b451729..211078d 100644
--- a/src/contacts-view.vala
+++ b/src/contacts-view.vala
@@ -47,11 +47,13 @@ public class Contacts.View : Egg.ListBox {
}
public signal void selection_changed (Contact? contact);
+ public signal void contacts_marked (int contacts_marked);
Store contacts_store;
Subset show_subset;
HashMap<Contact,ContactData> contacts;
HashSet<Contact> hidden_contacts;
+ int nr_contacts_marked;
string []? filter_values;
private TextDisplay text_display;
@@ -61,6 +63,7 @@ public class Contacts.View : Egg.ListBox {
set_selection_mode (SelectionMode.BROWSE);
contacts_store = store;
hidden_contacts = new HashSet<Contact>();
+ nr_contacts_marked = 0;
show_subset = Subset.ALL;
this.text_display = text_display;
@@ -236,6 +239,15 @@ public class Contacts.View : Egg.ListBox {
update_data (data);
+ data.selector_button.toggled.connect (() => {
+ if (data.selector_button.active)
+ this.nr_contacts_marked++;
+ else
+ this.nr_contacts_marked--;
+
+ contacts_marked (this.nr_contacts_marked);
+ });
+
data.grid.set_data<ContactData> ("data", data);
data.grid.show_all ();
data.selector_button.hide ();
@@ -336,5 +348,15 @@ public class Contacts.View : Egg.ListBox {
data.selector_button.set_active (false);
}
selectors_visible = false;
+ nr_contacts_marked = 0;
+ }
+
+ public LinkedList<Contact> get_marked_contacts () {
+ var cs = new LinkedList<Contact> ();
+ foreach (var data in contacts.values) {
+ if (data.selector_button.active)
+ cs.add (data.contact);
+ }
+ return cs;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]