[folks] core: Listen on primary-store settings changes
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] core: Listen on primary-store settings changes
- Date: Fri, 12 Sep 2014 15:23:52 +0000 (UTC)
commit ebba8fce0e856329db6ec1d6ee07e6f97508dcb0
Author: Erick PĂ©rez Castellanos <erick red gmail com>
Date: Wed Sep 10 10:22:08 2014 -0400
core: Listen on primary-store settings changes
https://bugzilla.gnome.org/show_bug.cgi?id=731470
folks/individual-aggregator.vala | 35 ++++++++++++++++++++++++++++-------
1 files changed, 28 insertions(+), 7 deletions(-)
---
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index 21fb9b8..a696a71 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -131,6 +131,8 @@ public class Folks.IndividualAggregator : Object
private unowned PersonaStore? _primary_store = null;
private SmallSet<Backend> _backends;
+ private Settings? _primary_store_setting = null;
+
/* This is conceptually a MultiMap<string, Individual> but it's sufficiently
* heavily-used that avoiding GObject overhead in favour of inlinable
* GenericArray access is a significant performance win.
@@ -496,13 +498,12 @@ public class Folks.IndividualAggregator : Object
this._configured_primary_store_id = "";
}
- var settings = new Settings (IndividualAggregator._FOLKS_GSETTINGS_SCHEMA);
- var val = settings.get_string (IndividualAggregator._PRIMARY_STORE_CONFIG_KEY);
- if (val != null && val != "")
- {
- debug ("Setting primary store IDs from GSettings.");
- this._configure_primary_store ((!) val);
- }
+ _primary_store_setting = new Settings (
+ IndividualAggregator._FOLKS_GSETTINGS_SCHEMA);
+ _primary_store_setting.changed[IndividualAggregator._PRIMARY_STORE_CONFIG_KEY].connect (
+ this._primary_store_setting_changed_cb);
+ this._primary_store_setting_changed_cb (_primary_store_setting,
+ IndividualAggregator._PRIMARY_STORE_CONFIG_KEY);
}
debug ("Primary store IDs are '%s' and '%s'.",
@@ -540,6 +541,26 @@ public class Folks.IndividualAggregator : Object
}
}
+ private void _primary_store_setting_changed_cb (Settings settings,
+ string key)
+ {
+ var val = settings.get_string (key);
+ if (val != null && val != "")
+ {
+ debug ("Setting primary store IDs from GSettings.");
+ this._configure_primary_store ((!) val);
+
+ var store_full_id = this._get_store_full_id (
+ this._configured_primary_store_type_id,
+ this._configured_primary_store_id);
+ if (store_full_id in this._stores)
+ {
+ var selected_store = this._stores.get (store_full_id);
+ this._set_primary_store (selected_store);
+ }
+ }
+ }
+
private void _configure_primary_store (string store_config_ids)
{
debug ("_configure_primary_store to '%s'", store_config_ids);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]