[folks] core: add Folks.PersonaStore.user-set-default property
- From: Raul Gutierrez Segales <raulgs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] core: add Folks.PersonaStore.user-set-default property
- Date: Fri, 16 Sep 2011 20:16:12 +0000 (UTC)
commit d797e8e101252ddd674ffdffab61d9409219a48f
Author: Raul Gutierrez Segales <rgs collabora co uk>
Date: Thu Sep 15 15:33:58 2011 +0100
core: add Folks.PersonaStore.user-set-default property
With this property we can tell if a Store (i.e.: an e-d-s address
book) has been marked by the user as his default store (either from
Evo or from GOA, etc).
Helps: https://bugzilla.gnome.org/show_bug.cgi?id=657141
NEWS | 1 +
folks/individual-aggregator.vala | 28 ++++++++++++++++++++++++++++
folks/persona-store.vala | 9 +++++++++
3 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 3c1d4ec..3a55cf8 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,7 @@ API changes:
* Add Folks.IndividualAggregatorError.NO_PRIMARY_STORE
* In IndividualAggregator.ensure_individual_property_writeable we now throw
NO_PRIMARY_STORE instead of NO_WRITEABLE_STORE
+* Add Folks.PersonaStore.user_set_default
Overview of changes from libfolks 0.6.2 to libfolks 0.6.2.1
===========================================================
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index 39eaa3e..1f5ceeb 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -644,6 +644,7 @@ public class Folks.IndividualAggregator : Object
{
var store_id = this._get_store_full_id (store.type_id, store.id);
+ this._maybe_configure_as_primary (store);
this._set_primary_store (store);
this._stores.set (store_id, store);
@@ -652,6 +653,8 @@ public class Folks.IndividualAggregator : Object
this._is_primary_store_changed_cb);
store.notify["is-quiescent"].connect (
this._persona_store_is_quiescent_changed_cb);
+ store.notify["is-user-set-default"].connect (
+ this._persona_store_is_user_set_default_changed_cb);
/* Increase the number of non-quiescent persona stores we're waiting for.
* If we've already reached a quiescent state, this is ignored. If we
@@ -687,6 +690,8 @@ public class Folks.IndividualAggregator : Object
this._persona_store_is_quiescent_changed_cb);
store.notify["is-primary-store"].disconnect (
this._is_primary_store_changed_cb);
+ store.notify["is-user-set-default"].disconnect (
+ this._persona_store_is_user_set_default_changed_cb);
/* If we were still waiting on this persona store to reach a quiescent
* state, stop waiting. */
@@ -1332,6 +1337,29 @@ public class Folks.IndividualAggregator : Object
}
}
+ private void _persona_store_is_user_set_default_changed_cb (Object obj,
+ ParamSpec pspec)
+ {
+ var store = (PersonaStore) obj;
+ if (this._maybe_configure_as_primary (store))
+ this._set_primary_store (store);
+ }
+
+ private bool _maybe_configure_as_primary (PersonaStore store)
+ {
+ var configured = false;
+
+ if (!this._user_configured_primary_store &&
+ store.is_user_set_default)
+ {
+ this._configured_primary_store_type_id = store.type_id;
+ this._configured_primary_store_id = store.id;
+ configured = true;
+ }
+
+ return configured;
+ }
+
private void _individual_removed_cb (Individual i, Individual? replacement)
{
if (this.user == i)
diff --git a/folks/persona-store.vala b/folks/persona-store.vala
index e7ad231..0e269ce 100644
--- a/folks/persona-store.vala
+++ b/folks/persona-store.vala
@@ -645,4 +645,13 @@ public abstract class Folks.PersonaStore : Object
* @since UNRELEASED
*/
public bool is_primary_store { get; internal set; default = false; }
+
+ /**
+ * Whether this { link PersonaStore} has been marked as the default
+ * store (in its backend) by the user. I.e.: a PersonaStore for the e-d-s
+ * backend would set this to true if it represents the default address book.
+ *
+ * @since UNRELEASED
+ */
+ public bool is_user_set_default { get; internal set; default = false; }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]