summaryrefslogtreecommitdiff
path: root/libebackend/e-source-registry-server.c
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2014-03-17 02:40:13 +0100
committerFabiano FidĂȘncio <fidencio@redhat.com>2014-04-10 04:14:36 +0200
commitd915f5c6fb19b0c6c388a4c0c85199bd6b5818c8 (patch)
tree4e49a0855d98a45f1d085cddf6537b9e28f234dd /libebackend/e-source-registry-server.c
parenta3b98ac6ee7030f1ad737d313ae18550fdf31bb3 (diff)
downloadevolution-data-server-d915f5c6fb19b0c6c388a4c0c85199bd6b5818c8.tar.gz
Bug #727431 - Merge common factories' code into a superclass
Diffstat (limited to 'libebackend/e-source-registry-server.c')
-rw-r--r--libebackend/e-source-registry-server.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/libebackend/e-source-registry-server.c b/libebackend/e-source-registry-server.c
index 7525b8b33..6ab0c9d52 100644
--- a/libebackend/e-source-registry-server.c
+++ b/libebackend/e-source-registry-server.c
@@ -85,8 +85,6 @@ struct _ESourceRegistryServerPrivate {
GMutex auth_lock;
GHashTable *running_auths;
GHashTable *waiting_auths;
-
- guint authentication_count;
};
struct _AuthRequest {
@@ -684,7 +682,6 @@ source_registry_server_authenticate_cb (EDBusSourceManager *dbus_interface,
GDBusConnection *connection;
EAuthenticationSession *session;
ESourceAuthenticator *authenticator;
- const gchar *base_object_path;
const gchar *sender;
gchar *auth_object_path;
GError *error = NULL;
@@ -693,13 +690,11 @@ source_registry_server_authenticate_cb (EDBusSourceManager *dbus_interface,
* effectively starts a new authentication session with the
* method caller. */
- base_object_path = E_SOURCE_REGISTRY_SERVER_OBJECT_PATH;
connection = g_dbus_method_invocation_get_connection (invocation);
sender = g_dbus_method_invocation_get_sender (invocation);
- auth_object_path = g_strdup_printf (
- "%s/auth_%u", base_object_path,
- server->priv->authentication_count++);
+ auth_object_path = e_data_factory_construct_path (
+ E_DATA_FACTORY (server));
authenticator = e_authentication_mediator_new (
connection, auth_object_path, sender, &error);
@@ -1102,24 +1097,12 @@ source_registry_server_bus_acquired (EDBusServer *server,
GDBusConnection *connection)
{
ESourceRegistryServerPrivate *priv;
- GError *error = NULL;
priv = E_SOURCE_REGISTRY_SERVER_GET_PRIVATE (server);
g_dbus_object_manager_server_set_connection (
priv->object_manager, connection);
- g_dbus_interface_skeleton_export (
- G_DBUS_INTERFACE_SKELETON (priv->source_manager),
- connection, E_SOURCE_REGISTRY_SERVER_OBJECT_PATH, &error);
-
- /* Terminate the server if we can't export the interface. */
- if (error != NULL) {
- g_warning ("%s: %s", G_STRFUNC, error->message);
- e_dbus_server_quit (server, E_DBUS_SERVER_EXIT_NORMAL);
- g_error_free (error);
- }
-
/* Chain up to parent's bus_acquired() method. */
E_DBUS_SERVER_CLASS (e_source_registry_server_parent_class)->
bus_acquired (server, connection);
@@ -1140,9 +1123,6 @@ source_registry_server_quit_server (EDBusServer *server,
g_dbus_object_manager_server_set_connection (
priv->object_manager, NULL);
- g_dbus_interface_skeleton_unexport (
- G_DBUS_INTERFACE_SKELETON (priv->source_manager));
-
/* Chain up to parent's quit_server() method. */
E_DBUS_SERVER_CLASS (e_source_registry_server_parent_class)->
quit_server (server, code);
@@ -1250,6 +1230,16 @@ source_registry_server_any_true (GSignalInvocationHint *ihint,
return TRUE;
}
+static GDBusInterfaceSkeleton *
+source_registry_server_get_dbus_interface_skeleton (EDBusServer *server)
+{
+ ESourceRegistryServerPrivate *priv;
+
+ priv = E_SOURCE_REGISTRY_SERVER_GET_PRIVATE (server);
+
+ return G_DBUS_INTERFACE_SKELETON (priv->source_manager);
+}
+
static void
e_source_registry_server_class_init (ESourceRegistryServerClass *class)
{
@@ -1276,10 +1266,12 @@ e_source_registry_server_class_init (ESourceRegistryServerClass *class)
dbus_server_class->module_directory = modules_directory;
dbus_server_class->bus_acquired = source_registry_server_bus_acquired;
dbus_server_class->quit_server = source_registry_server_quit_server;
-
data_factory_class = E_DATA_FACTORY_CLASS (class);
backend_factory_type = E_TYPE_COLLECTION_BACKEND_FACTORY;
data_factory_class->backend_factory_type = backend_factory_type;
+ data_factory_class->factory_object_path = E_SOURCE_REGISTRY_SERVER_OBJECT_PATH;
+ data_factory_class->data_object_path_prefix = E_SOURCE_REGISTRY_SERVER_OBJECT_PATH;
+ data_factory_class->get_dbus_interface_skeleton = source_registry_server_get_dbus_interface_skeleton;
class->source_added = source_registry_server_source_added;
class->source_removed = source_registry_server_source_removed;