[gnome-contacts/wip/sorted] Update view for separator changes
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts/wip/sorted] Update view for separator changes
- Date: Mon, 14 May 2012 15:21:17 +0000 (UTC)
commit 3afc08f557ebe20482de971032bc2387e3871091
Author: Alexander Larsson <alexl redhat com>
Date: Mon May 14 17:06:34 2012 +0200
Update view for separator changes
src/contacts-view.vala | 35 ++++++++++++++++++++++++++---------
1 files changed, 26 insertions(+), 9 deletions(-)
---
diff --git a/src/contacts-view.vala b/src/contacts-view.vala
index 383acad..7743c0f 100644
--- a/src/contacts-view.vala
+++ b/src/contacts-view.vala
@@ -74,7 +74,6 @@ public class Contacts.View : Contacts.Sorted {
});
this.set_filter_func (filter);
this.set_separator_funcs (need_separator,
- create_separator,
update_separator);
contacts_store.added.connect (contact_added_cb);
@@ -131,6 +130,8 @@ public class Contacts.View : Contacts.Sorted {
show_subset = subset;
update_all_filtered ();
refilter ();
+ resort ();
+ reseparate ();
}
public void set_custom_sort_prio (Contact c, int prio) {
@@ -241,17 +242,14 @@ public class Contacts.View : Contacts.Sorted {
if (before == null) {
return true;
}
+
var w_data = widget.get_data<ContactData> ("data");
var before_data = before.get_data<ContactData> ("data");
- return w_data.initial_letter != before_data.initial_letter;
-
- return false;
- }
+ if (is_other (w_data) && !is_other (before_data))
+ return true;
- private Widget create_separator () {
- var s = new Separator (Orientation.HORIZONTAL);
- return s;
+ return w_data.initial_letter != before_data.initial_letter;
}
private bool filter (Widget child) {
@@ -260,8 +258,27 @@ public class Contacts.View : Contacts.Sorted {
return data.filtered;
}
- private void update_separator (Widget separator,
+ private void update_separator (ref Widget? separator,
Widget child,
Widget? before_widget) {
+ var w_data = child.get_data<ContactData> ("data");
+ ContactData? before_data = null;
+ if (before_widget != null) {
+ before_data = before_widget.get_data<ContactData> ("data");
+ }
+
+ if (is_other (w_data) &&
+ (before_data == null || !is_other (before_data))) {
+ if (separator == null || !(separator is Label)) {
+ var l = new Label ("");
+ l.set_markup (Markup.printf_escaped ("<b>%s</b>", _("Other Contacts")));
+ l.set_halign (Align.START);
+ separator = l;
+ }
+ return;
+ }
+
+ if (separator == null || !(separator is Separator))
+ separator = new Separator (Orientation.HORIZONTAL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]