Commit c893ae90 authored by Jeremy Whiting's avatar Jeremy Whiting

tracker: Add enable|disable_persona_store implementation to tracker backend.

core: Remove trailing whitespace in folks/backend.vala
parent a832876c
......@@ -11,6 +11,7 @@ Bugs fixed:
• Bug 685084 — Add a folks backend for ofono phonebook
• Bug 686056 — Add api to create and remove address books
• Bug 685250 — make <test>.gdb deadlocks
• Bug 686674 — Tracker backend doesn't implement new Backend functions
API changes:
• Add Backend.enable_persona_store and disable_persona_store.
......
......@@ -51,6 +51,50 @@ public class Folks.Backends.Tr.Backend : Folks.Backend
get { return this._persona_stores_ro; }
}
/**
* {@inheritDoc}
*/
public override void enable_persona_store (Folks.PersonaStore store)
{
if (this._persona_stores.has_key (store.id) == false)
{
this._add_store ((Trf.PersonaStore) store);
}
}
/**
* {@inheritDoc}
*/
public override void disable_persona_store (Folks.PersonaStore store)
{
if (this._persona_stores.has_key (store.id))
{
this._store_removed_cb (store);
}
}
/**
* {@inheritDoc}
*/
public override void set_persona_stores (Set<string>? storeids)
{
if (storeids != null)
{
if (storeids.size == 0)
{
this.disable_persona_store (this._persona_stores.get (BACKEND_NAME));
}
else
{
this._add_default_persona_store ();
}
}
else
{
this._add_default_persona_store ();
}
}
/**
* {@inheritDoc}
*/
......@@ -159,11 +203,28 @@ public class Folks.Backends.Tr.Backend : Folks.Backend
*/
private void _add_default_persona_store ()
{
var store = new Trf.PersonaStore ();
if (this._persona_stores.has_key (BACKEND_NAME) == false)
{
var store = new Trf.PersonaStore ();
this._add_store (store);
}
}
/**
* Utility function to add a persona store.
*
* @param store the store to add.
* @param notify whether or not to emit notification signals.
*/
private void _add_store (PersonaStore store, bool notify = true)
{
this._persona_stores.set (store.id, store);
store.removed.connect (this._store_removed_cb);
this.notify_property ("persona-stores");
this.persona_store_added (store);
if (notify)
{
this.notify_property ("persona-stores");
}
}
private void _store_removed_cb (Folks.PersonaStore store)
......
......@@ -106,8 +106,8 @@ public abstract class Folks.Backend : Object
* Enable a {@link PersonaStore}.
*
* If the given persona store is not already in this backend
* {@link Backend.persona_stores}, it will be added to the backend and
* {@link Backend.persona_stores} property notification will be emitted,
* {@link Backend.persona_stores}, it will be added to the backend and
* {@link Backend.persona_stores} property notification will be emitted,
* along with {@link Backend.persona_store_added}.
*
* @param store the {@link PersonaStore} to enable.
......@@ -120,11 +120,11 @@ public abstract class Folks.Backend : Object
* Set the {@link PersonaStore}s to use in this backend.
*
* This will cause {@link Backend.persona_store_removed} signals to be emitted
* for all removed stores, followed by {@link Backend.persona_store_added}
* for all removed stores, followed by {@link Backend.persona_store_added}
* signals for all added stores. As these signals are emitted, the sets of
* individuals in any associated {@link IndividualAggregator}s will be
* updated, and {@link IndividualAggregator.individuals_changed} may be
* emitted multiple times as appropriate. A property change notification for
* individuals in any associated {@link IndividualAggregator}s will be
* updated, and {@link IndividualAggregator.individuals_changed} may be
* emitted multiple times as appropriate. A property change notification for
* {@link Backend.persona_stores} will be emitted last.
* Note: pass null storeids to use all available persona stores.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment