EDataFactory

EDataFactory — An abstract base class for a backend-based server

Synopsis

#include <libebackend/libebackend.h>

struct              EDataFactory;
struct              EDataFactoryClass;
EBackend *          e_data_factory_ref_backend          (EDataFactory *data_factory,
                                                         const gchar *hash_key,
                                                         ESource *source);
EBackend *          e_data_factory_ref_initable_backend (EDataFactory *data_factory,
                                                         const gchar *hash_key,
                                                         ESource *source,
                                                         GCancellable *cancellable,
                                                         GError **error);
EBackendFactory *   e_data_factory_ref_backend_factory  (EDataFactory *data_factory,
                                                         const gchar *hash_key);
ESourceRegistry *   e_data_factory_get_registry         (EDataFactory *data_factory);
gchar *             e_data_factory_construct_path       (EDataFactory *data_factory);
void                e_data_factory_set_backend_callbacks
                                                        (EDataFactory *data_factory,
                                                         EBackend *backend);

Description

Details

struct EDataFactory

struct EDataFactory {
	EDBusServer parent;
	EDataFactoryPrivate *priv;
};

Contains only private data that should be read and manipulated using the functions below.

Since 3.4


struct EDataFactoryClass

struct EDataFactoryClass {
	EDBusServerClass parent_class;

	GType backend_factory_type;

	const gchar *factory_object_path;
	const gchar *data_object_path_prefix;

	/* Signals */
	void		(*backend_created) (EDataFactory *data_factory,
						 EBackend *backend);

	/* Virtual methods */
	GDBusInterfaceSkeleton *
			(*get_dbus_interface_skeleton)
						(EDBusServer *server);

	gchar *		(*data_open)		(EDataFactory *data_factory,
						 EBackend *backend,
						 GDBusConnection *connection,
						 GError **error);

	gpointer reserved[15];
};

e_data_factory_ref_backend ()

EBackend *          e_data_factory_ref_backend          (EDataFactory *data_factory,
                                                         const gchar *hash_key,
                                                         ESource *source);

Returns either a newly-created or existing EBackend for ESource. The returned EBackend is referenced for thread-safety and must be unreferenced with g_object_unref() when finished with it.

The data_factory retains a weak reference to backend so it can return the same instance while backend is in use. When the last strong reference to backend is dropped, data_factory will lose its weak reference and will have to create a new EBackend instance the next time the same hash_key and source are requested.

If no suitable EBackendFactory exists, the function returns NULL.

data_factory :

an EDataFactory

hash_key :

hash key for an EBackendFactory

source :

an ESource

error :

return location for a GError, or NULL

Returns :

an EBackend for source, or NULL

Since 3.6


e_data_factory_ref_initable_backend ()

EBackend *          e_data_factory_ref_initable_backend (EDataFactory *data_factory,
                                                         const gchar *hash_key,
                                                         ESource *source,
                                                         GCancellable *cancellable,
                                                         GError **error);

Similar to e_data_factory_ref_backend(), but allows for backends that implement the GInitable interface so they can fail gracefully if they are unable to initialize critical resources, such as a cache database.

Returns either a newly-created or existing EBackend for ESource. The returned EBackend is referenced for thread-safety and must be unreferenced with g_object_unref() when finished with it.

If the newly-created backend implements the GInitable interface, then g_initable_init() is also called on it using cancellable and error.

The data_factory retains a weak reference to backend so it can return the same instance while backend is in use. When the last strong reference to backend is dropped, data_factory will lose its weak reference and will have to create a new EBackend instance the next time the same hash_key and source are requested.

If no suitable EBackendFactory exists, or if the EBackend fails to initialize, the function sets error and returns NULL.

data_factory :

an EDataFactory

hash_key :

hash key for an EBackendFactory

source :

an ESource

cancellable :

optional GCancellable object, or NULL

error :

return location for a GError, or NULL

Returns :

an EBackend for source, or NULL

Since 3.8


e_data_factory_ref_backend_factory ()

EBackendFactory *   e_data_factory_ref_backend_factory  (EDataFactory *data_factory,
                                                         const gchar *hash_key);

Returns the EBackendFactory for hash_key, or NULL if no such factory is registered.

The returned EBackendFactory is referenced for thread-safety. Unreference the EBackendFactory with g_object_unref() when finished with it.

data_factory :

an EDataFactory

hash_key :

hash key for an EBackendFactory

Returns :

the EBackendFactory for hash_key, or NULL

Since 3.6


e_data_factory_get_registry ()

ESourceRegistry *   e_data_factory_get_registry         (EDataFactory *data_factory);

Returns the ESourceRegistry owned by data_factory.

data_factory :

an EDataFactory

Returns :

the ESourceRegistry

Since 3.14


e_data_factory_construct_path ()

gchar *             e_data_factory_construct_path       (EDataFactory *data_factory);

Returns a new and unique object path for a D-Bus interface based in the data object path prefix of the data_factory

data_factory :

an EDataFactory

Returns :

a newly allocated string, representing the object path for the D-Bus interface.

Since 3.14


e_data_factory_set_backend_callbacks ()

void                e_data_factory_set_backend_callbacks
                                                        (EDataFactory *data_factory,
                                                         EBackend *backend);