[gnome-contacts] Minor cleanups
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Minor cleanups
- Date: Wed, 18 Jan 2012 15:28:15 +0000 (UTC)
commit c66f0fd9bb8a3d552185ae7f63cfbae47f9c0145
Author: Alexander Larsson <alexl redhat com>
Date: Wed Jan 18 16:20:31 2012 +0100
Minor cleanups
src/contacts-view.vala | 23 ++++++++++++++++-------
1 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/src/contacts-view.vala b/src/contacts-view.vala
index 8f9c9f0..d0bde30 100644
--- a/src/contacts-view.vala
+++ b/src/contacts-view.vala
@@ -100,12 +100,21 @@ public class Contacts.View : GLib.Object {
return 0;
}
+ private bool is_other (ContactData data) {
+ if (show_subset == Subset.ALL_SEPARATED &&
+ data.contact != null &&
+ !data.contact.is_primary)
+ return true;
+ return false;
+ }
+
+ /* The hardcoded prio if set, otherwise 0 for the
+ primary/combined group, or -2 for the separated other group */
private int get_sort_prio (ContactData *data) {
if (data->sort_prio != 0)
return data->sort_prio;
- if (show_subset == Subset.ALL_SEPARATED &&
- !data->contact.is_primary)
+ if (is_other (data))
return -2;
return 0;
}
@@ -263,7 +272,7 @@ public class Contacts.View : GLib.Object {
list_store.append (out data.iter);
list_store.set (data.iter, 0, data.contact, 1, data);
- if (data.sort_prio > 0) {
+ if (data.sort_prio > 0) {
if (custom_visible_count++ == 0)
add_custom_headers ();
}
@@ -277,7 +286,7 @@ public class Contacts.View : GLib.Object {
}
private void remove_from_model (ContactData data) {
- if( data.sort_prio > 0) {
+ if (data.sort_prio > 0) {
if (custom_visible_count-- == 1)
remove_custom_headers ();
}
@@ -297,11 +306,11 @@ public class Contacts.View : GLib.Object {
bool was_visible = data.visible;
data.visible = apply_filter (data.contact);
- if (!was_visible && data.visible)
- add_to_model (data);
-
if (was_visible && !data.visible)
remove_from_model (data);
+
+ if (!was_visible && data.visible)
+ add_to_model (data);
}
private void refilter () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]