Top |
FolksDummyPersonaStoreFolksDummyPersonaStore — A persona store which allows FolksDummyPersonas to be programmatically created and manipulated, for the purposes of testing the core of libfolks itself. This should not be used in user-visible applications. |
GStrv | always-writeable-properties | Read |
FolksMaybeBool | can-add-personas | Read |
FolksMaybeBool | can-alias-personas | Read |
FolksMaybeBool | can-group-personas | Read |
FolksMaybeBool | can-remove-personas | Read |
gboolean | is-prepared | Read |
gboolean | is-quiescent | Read |
GType * | persona-type | Read / Write |
GeeMap * | personas | Read |
gchar * | type-id | Read |
There are two sides to this class’ interface: the methods and properties declared by FolksPersonaStore, which form the normal libfolks persona store API; and the mock methods and properties (such as "add-persona-from-details-mock") which are intended to be used by test driver code to simulate the behaviour of a real backing store. Calls to these mock methods effect state changes in the store which are visible in the normal libfolks API. The update_
, register_
and unregister_
prefixes and the mock
suffix are commonly used for backing store methods.
The main action performed with a dummy persona store is to change its set of personas, adding and removing them dynamically to test client-side behaviour. The client-side APIs (
and folks_persona_store_add_persona_from_details()
) should not be used for this. Instead, the mock APIs should be used: folks_persona_store_remove_persona()
folks_dummy_persona_store_freeze_personas_changed()
, folks_dummy_persona_store_register_personas()
, folks_dummy_persona_store_unregister_personas()
and folks_dummy_persona_store_thaw_personas_changed()
. These can be used to build up complex "personas-changed" signal emissions, which are only emitted after the final call to folks_dummy_persona_store_thaw_personas_changed()
.
The API in FolksDummy is unstable and may change wildly. It is designed mostly for use by libfolks unit tests.
#define FOLKS_DUMMY_TYPE_PERSONA_STORE (folks_dummy_persona_store_get_type ())
The type for FolksDummyPersonaStore.
void folks_dummy_persona_store_update_capabilities (FolksDummyPersonaStore *self
,FolksMaybeBool can_add_personas
,FolksMaybeBool can_alias_personas
,FolksMaybeBool can_remove_personas
);
Set capabilities of the persona store.
This sets the capabilities of the store, as if they were changed on a backing store somewhere. This is intended to be used for testing code which depends on the values of "can-add-personas", "can-alias-personas" and "can-remove-personas".
self |
the FolksDummyPersonaStore instance |
|
can_add_personas |
. whether the store can handle adding personas . |
[in] |
can_alias_personas |
. whether the store can handle and update user-specified persona aliases . |
[in] |
can_remove_personas |
. whether the store can handle removing personas . |
[in] |
Since: 0.9.7
void
folks_dummy_persona_store_freeze_personas_changed
(FolksDummyPersonaStore *self
);
Freeze persona changes in the store.
This freezes externally-visible changes to the set of personas in the store until folks_dummy_persona_store_thaw_personas_changed()
is called, at which point all pending changes are made visible in the "personas" property and by emitting "personas-changed".
Calls to folks_dummy_persona_store_freeze_personas_changed()
and folks_dummy_persona_store_thaw_personas_changed()
must be well-nested. Pending changes will only be committed after the final call to folks_dummy_persona_store_thaw_personas_changed()
.
See also: folks_dummy_persona_store_thaw_personas_changed()
Since: 0.9.7
void
folks_dummy_persona_store_thaw_personas_changed
(FolksDummyPersonaStore *self
);
Thaw persona changes in the store.
This thaws externally-visible changes to the set of personas in the store. If the number of calls to folks_dummy_persona_store_thaw_personas_changed()
matches the number of calls to folks_dummy_persona_store_freeze_personas_changed()
, all pending changes are committed and made externally-visible.
See also: folks_dummy_persona_store_freeze_personas_changed()
Since: 0.9.7
void folks_dummy_persona_store_register_personas (FolksDummyPersonaStore *self
,GeeSet *personas
);
Register new personas with the persona store.
This registers a set of personas as if they had just appeared in the backing store. If the persona store is not frozen (see folks_dummy_persona_store_freeze_personas_changed()
) the changes are made externally visible on the store immediately (e.g. in the "personas" property and through a "personas-changed" signal). If the store is frozen, the changes will be pending until the store is next unfrozen.
All elements in the personas
set be of type "persona-type".
Since: 0.9.7
void folks_dummy_persona_store_unregister_personas (FolksDummyPersonaStore *self
,GeeSet *personas
);
Unregister existing personas with the persona store.
This unregisters a set of personas as if they had just disappeared from the backing store. If the persona store is not frozen (see folks_dummy_persona_store_freeze_personas_changed()
) the changes are made externally visible on the store immediately (e.g. in the "personas" property and through a "personas-changed" signal). If the store is frozen, the changes will be pending until the store is next unfrozen.
Since: 0.9.7
void
folks_dummy_persona_store_reach_quiescence
(FolksDummyPersonaStore *self
);
Reach quiescence on the store.
If the
method has already been called on the store, this causes the store to signal that it has reached quiescence immediately. If the store has not yet been prepared, this will set a flag to ensure that quiescence is reached as soon as folks_persona_store_prepare()
is called.folks_persona_store_prepare()
This must be called before the store will reach quiescence.
Since: 0.9.7
void folks_dummy_persona_store_update_is_user_set_default (FolksDummyPersonaStore *self
,gboolean is_user_set_default
);
Update the "is-user-set-default" property.
Backend method for use by test code to simulate a backing-store-driven change in the "is-user-set-default" property.
self |
the FolksDummyPersonaStore instance |
|
is_user_set_default |
. new value for the property . |
[in] |
Since: 0.9.7
void folks_dummy_persona_store_update_trust_level (FolksDummyPersonaStore *self
,FolksPersonaStoreTrust trust_level
);
Update the "trust-level" property.
Backend method for use by test code to simulate a backing-store-driven change in the "trust-level" property.
Since: 0.9.7
FolksDummyPersonaStore * folks_dummy_persona_store_new (const gchar *id
,const gchar *display_name
,gchar **always_writeable_properties
,int always_writeable_properties_length1
);
Create a new persona store.
This store will have no personas to begin with; use folks_dummy_persona_store_register_personas()
to add some, then call folks_dummy_persona_store_reach_quiescence()
to signal the store reaching quiescence.
id |
. The new store's ID. . |
[in] |
display_name |
. The new store's display name. . |
[in] |
always_writeable_properties |
. The set of always writeable properties. . |
[in][array length=always_writeable_properties_length1] |
always_writeable_properties_length1 |
length of the |
Since: 0.9.7
FolksDummyPersonaStoreAddPersonaFromDetailsMock folks_dummy_persona_store_get_add_persona_from_details_mock (FolksDummyPersonaStore *self
,gpointer *result_target
);
Get and return the current value of the "add-persona-from-details-mock" property.
Mock function for
.folks_persona_store_add_persona_from_details()
This function is called whenever this store's
method is called. It allows the caller to determine whether adding the given persona should fail, by throwing an error from this mock function. If no error is thrown from this function, adding the given persona will succeed. This is useful for testing error handling of calls to folks_persona_store_add_persona_from_details()
.folks_persona_store_add_persona_from_details()
The value returned by this function gives a delay which is imposed for completion of the
call. Negative or zero delays result in completion in an idle callback, and positive delays result in completion after that many milliseconds.folks_persona_store_add_persona_from_details()
If this is null
, all calls to
will succeed.folks_persona_store_add_persona_from_details()
This mock function may be changed at any time; changes will take effect for the next call to
.folks_persona_store_add_persona_from_details()
Since: 0.9.7
void folks_dummy_persona_store_set_add_persona_from_details_mock (FolksDummyPersonaStore *self
,FolksDummyPersonaStoreAddPersonaFromDetailsMock value
,gpointer value_target
);
Set the value of the "add-persona-from-details-mock" property to value
.
Mock function for
.folks_persona_store_add_persona_from_details()
This function is called whenever this store's
method is called. It allows the caller to determine whether adding the given persona should fail, by throwing an error from this mock function. If no error is thrown from this function, adding the given persona will succeed. This is useful for testing error handling of calls to folks_persona_store_add_persona_from_details()
.folks_persona_store_add_persona_from_details()
The value returned by this function gives a delay which is imposed for completion of the
call. Negative or zero delays result in completion in an idle callback, and positive delays result in completion after that many milliseconds.folks_persona_store_add_persona_from_details()
If this is null
, all calls to
will succeed.folks_persona_store_add_persona_from_details()
This mock function may be changed at any time; changes will take effect for the next call to
.folks_persona_store_add_persona_from_details()
self |
the FolksDummyPersonaStore instance to modify |
|
value |
the new value of the "add-persona-from-details-mock" property |
Since: 0.9.7
FolksDummyPersonaStoreRemovePersonaMock folks_dummy_persona_store_get_remove_persona_mock (FolksDummyPersonaStore *self
,gpointer *result_target
);
Get and return the current value of the "remove-persona-mock" property.
Mock function for
.folks_persona_store_remove_persona()
This function is called whenever this store's
method is called. It allows the caller to determine whether removing the given persona should fail, by throwing an error from this mock function. If no error is thrown from this function, removing the given persona will succeed. This is useful for testing error handling of calls to folks_persona_store_remove_persona()
.folks_persona_store_remove_persona()
See "add-persona-from-details-mock".
This mock function may be changed at any time; changes will take effect for the next call to
.folks_persona_store_remove_persona()
Since: 0.9.7
void folks_dummy_persona_store_set_remove_persona_mock (FolksDummyPersonaStore *self
,FolksDummyPersonaStoreRemovePersonaMock value
,gpointer value_target
);
Set the value of the "remove-persona-mock" property to value
.
Mock function for
.folks_persona_store_remove_persona()
This function is called whenever this store's
method is called. It allows the caller to determine whether removing the given persona should fail, by throwing an error from this mock function. If no error is thrown from this function, removing the given persona will succeed. This is useful for testing error handling of calls to folks_persona_store_remove_persona()
.folks_persona_store_remove_persona()
See "add-persona-from-details-mock".
This mock function may be changed at any time; changes will take effect for the next call to
.folks_persona_store_remove_persona()
self |
the FolksDummyPersonaStore instance to modify |
|
value |
the new value of the "remove-persona-mock" property |
Since: 0.9.7
FolksDummyPersonaStorePrepareMock folks_dummy_persona_store_get_prepare_mock (FolksDummyPersonaStore *self
,gpointer *result_target
);
Get and return the current value of the "prepare-mock" property.
Mock function for
.folks_persona_store_prepare()
This function is called whenever this store's
method is called on an unprepared store. It allows the caller to determine whether preparing the store should fail, by throwing an error from this mock function. If no error is thrown from this function, preparing the store will succeed (and all future calls to folks_persona_store_prepare()
will return immediately without calling this mock function). This is useful for testing error handling of calls to folks_persona_store_prepare()
.folks_persona_store_prepare()
See "add-persona-from-details-mock".
This mock function may be changed at any time; changes will take effect for the next call to
.folks_persona_store_prepare()
Since: 0.9.7
void folks_dummy_persona_store_set_prepare_mock (FolksDummyPersonaStore *self
,FolksDummyPersonaStorePrepareMock value
,gpointer value_target
);
Set the value of the "prepare-mock" property to value
.
Mock function for
.folks_persona_store_prepare()
This function is called whenever this store's
method is called on an unprepared store. It allows the caller to determine whether preparing the store should fail, by throwing an error from this mock function. If no error is thrown from this function, preparing the store will succeed (and all future calls to folks_persona_store_prepare()
will return immediately without calling this mock function). This is useful for testing error handling of calls to folks_persona_store_prepare()
.folks_persona_store_prepare()
See "add-persona-from-details-mock".
This mock function may be changed at any time; changes will take effect for the next call to
.folks_persona_store_prepare()
self |
the FolksDummyPersonaStore instance to modify |
|
value |
the new value of the "prepare-mock" property |
Since: 0.9.7
GType
folks_dummy_persona_store_get_persona_type
(FolksDummyPersonaStore *self
);
Get and return the current value of the "persona-type" property.
Type of programmatically created personas.
This is the type used to create new personas when
is called. It must be a subtype of FolksDummyPersona.folks_persona_store_add_persona_from_details()
This may be modified at any time, with modifications taking effect for the next call to
or folks_persona_store_add_persona_from_details()
folks_dummy_persona_store_register_personas()
.
Since: 0.9.7
void folks_dummy_persona_store_set_persona_type (FolksDummyPersonaStore *self
,GType value
);
Set the value of the "persona-type" property to value
.
Type of programmatically created personas.
This is the type used to create new personas when
is called. It must be a subtype of FolksDummyPersona.folks_persona_store_add_persona_from_details()
This may be modified at any time, with modifications taking effect for the next call to
or folks_persona_store_add_persona_from_details()
folks_dummy_persona_store_register_personas()
.
self |
the FolksDummyPersonaStore instance to modify |
|
value |
the new value of the "persona-type" property |
Since: 0.9.7
gint (*FolksDummyPersonaStoreAddPersonaFromDetailsMock) (FolksDummyPersona *persona
,void *user_data
,GError **error
);
Type of a mock function for
.folks_persona_store_add_persona_from_details()
See "add-persona-from-details-mock".
FolksPersonaStoreError will be returned in error
to be thrown from folks_persona_store_add_persona_from_details()
persona |
. the persona being added to the store, as constructed from the details passed to . |
[in] |
error |
location to store the error occuring, or |
[error-domains FolksPersonaStoreError] |
user_data |
data to pass to the delegate function. |
[closure] |
delay to apply to the add persona operation (negative delays complete synchronously; zero delays complete in an idle callback; positive delays complete after that many milliseconds)
Since: 0.9.7
gint (*FolksDummyPersonaStoreRemovePersonaMock) (FolksDummyPersona *persona
,void *user_data
,GError **error
);
Type of a mock function for
.folks_persona_store_remove_persona()
See "remove-persona-mock".
FolksPersonaStoreError will be returned in error
to be thrown from folks_persona_store_remove_persona()
persona |
. the persona being removed from the store . |
[in] |
error |
location to store the error occuring, or |
[error-domains FolksPersonaStoreError] |
user_data |
data to pass to the delegate function. |
[closure] |
delay to apply to the remove persona operation (negative and zero delays complete in an idle callback; positive delays complete after that many milliseconds)
Since: 0.9.7
gint (*FolksDummyPersonaStorePrepareMock) (void *user_data
,GError **error
);
Type of a mock function for
.folks_persona_store_prepare()
See "prepare-mock".
FolksPersonaStoreError will be returned in error
to be thrown from folks_persona_store_prepare()
error |
location to store the error occuring, or |
[error-domains FolksPersonaStoreError] |
user_data |
data to pass to the delegate function. |
[closure] |
delay to apply to the prepare operation (negative and zero delays complete in an idle callback; positive delays complete after that many milliseconds)
Since: 0.9.7
struct FolksDummyPersonaStore;
A persona store which allows FolksDummyPersonas to be programmatically created and manipulated, for the purposes of testing the core of libfolks itself. This should not be used in user-visible applications.
There are two sides to this class’ interface: the methods and properties declared by FolksPersonaStore, which form the normal libfolks persona store API; and the mock methods and properties (such as "add-persona-from-details-mock") which are intended to be used by test driver code to simulate the behaviour of a real backing store. Calls to these mock methods effect state changes in the store which are visible in the normal libfolks API. The update_
, register_
and unregister_
prefixes and the mock
suffix are commonly used for backing store methods.
The main action performed with a dummy persona store is to change its set of personas, adding and removing them dynamically to test client-side behaviour. The client-side APIs (
and folks_persona_store_add_persona_from_details()
) should not be used for this. Instead, the mock APIs should be used: folks_persona_store_remove_persona()
folks_dummy_persona_store_freeze_personas_changed()
, folks_dummy_persona_store_register_personas()
, folks_dummy_persona_store_unregister_personas()
and folks_dummy_persona_store_thaw_personas_changed()
. These can be used to build up complex "personas-changed" signal emissions, which are only emitted after the final call to folks_dummy_persona_store_thaw_personas_changed()
.
The API in FolksDummy is unstable and may change wildly. It is designed mostly for use by libfolks unit tests.
Since: 0.9.7
struct FolksDummyPersonaStoreClass { FolksPersonaStoreClass parent_class; };
The class structure for FOLKS_DUMMY_TYPE_PERSONA_STORE
. All the fields in this structure are private and should never be accessed directly.
“always-writeable-properties”
property“always-writeable-properties” GStrv
always-writeable-properties.
Flags: Read
“can-add-personas”
property “can-add-personas” FolksMaybeBool
can-add-personas.
Flags: Read
Default value: FOLKS_MAYBE_BOOL_UNSET
“can-alias-personas”
property “can-alias-personas” FolksMaybeBool
can-alias-personas.
Flags: Read
Default value: FOLKS_MAYBE_BOOL_UNSET
“can-group-personas”
property “can-group-personas” FolksMaybeBool
can-group-personas.
Flags: Read
Default value: FOLKS_MAYBE_BOOL_UNSET
“can-remove-personas”
property “can-remove-personas” FolksMaybeBool
can-remove-personas.
Flags: Read
Default value: FOLKS_MAYBE_BOOL_UNSET
“persona-type”
property“persona-type” GType *
Type of programmatically created personas.
This is the type used to create new personas when
is called. It must be a subtype of FolksDummyPersona.folks_persona_store_add_persona_from_details()
This may be modified at any time, with modifications taking effect for the next call to
or folks_persona_store_add_persona_from_details()
folks_dummy_persona_store_register_personas()
.
Flags: Read / Write
Allowed values: void
Since: 0.9.7