Commit 81a1d481 authored by Jeremy Whiting's avatar Jeremy Whiting

core: Add disable_persona_store and enable_persona_store API to backend

eds: Implement new API in eds backend
parent e1e5c817
......@@ -61,6 +61,33 @@ public class Folks.Backends.Eds.Backend : Folks.Backend
get { return this._persona_stores_ro; }
}
/**
* {@inheritDoc}
*/
public override void disable_persona_store (PersonaStore store)
{
if (this._persona_stores.has_key (store.id))
{
this._remove_address_book (store);
}
}
/**
* {@inheritDoc}
*/
public override void enable_persona_store (PersonaStore store)
{
if (!this._persona_stores.has_key (store.id))
{
store.removed.connect (this._store_removed_cb);
this._persona_stores.set (store.id, store);
this.notify_property ("persona-stores");
this.persona_store_added (store);
}
}
/**
* {@inheritDoc}
*/
......@@ -238,12 +265,7 @@ public class Folks.Backends.Eds.Backend : Folks.Backend
var store =
new Edsf.PersonaStore.with_source_registry (this._ab_sources, s);
store.removed.connect (this._store_removed_cb);
this._persona_stores.set (store.id, store);
this.notify_property ("persona-stores");
this.persona_store_added (store);
this.enable_persona_store (store);
}
private void _remove_address_book (Folks.PersonaStore store)
......
......@@ -90,6 +90,32 @@ public abstract class Folks.Backend : Object
*/
public abstract Map<string, PersonaStore> persona_stores { get; }
/**
* Disable a {@link PersonaStore}.
*
* If the given persona store is in this backend {@link Backend.persona_stores},
* it will be removed, and we will disconnect from its signals.
*
* @param store the {@link PersonaStore} to disable.
*
* @since UNRELEASED
*/
public abstract void disable_persona_store (PersonaStore store);
/**
* 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,
* along with {@link Backend.persona_store_added}.
*
* @param store the {@link PersonaStore} to enable.
*
* @since UNRELEASED
*/
public abstract void enable_persona_store (PersonaStore store);
/**
* Emitted when a {@link PersonaStore} is added to the backend.
*
......
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