summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am8
-rw-r--r--src/telepathy-logger-dbus.h5
-rw-r--r--src/telepathy-logger.c34
3 files changed, 36 insertions, 11 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 384fc8e..b485ffa 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,17 +23,13 @@ BUILT_SOURCES = \
dbus-service-client.h
bin_PROGRAMS = \
- telepathy-logger-dbus \
telepathy-logger \
test-api
-telepathy_logger_dbus_SOURCES = \
- dbus-service.c \
- telepathy-logger-dbus.c
-
test_api_SOURCES = test_api.c
-telepathy_logger_SOURCES = telepathy-logger.c
+telepathy_logger_SOURCES = telepathy-logger.c \
+ dbus-service.c
nodist_telepathy_logger_SOURCES = $(BUILT_SOURCES)
diff --git a/src/telepathy-logger-dbus.h b/src/telepathy-logger-dbus.h
deleted file mode 100644
index 1ce1e37..0000000
--- a/src/telepathy-logger-dbus.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef __TELEPATHY_LOGGER_DBUS_H__
-
-void telepathy_logger_dbus_init (void);
-
-#endif // __TELEPATHY_LOGGER_DBUS_H__
diff --git a/src/telepathy-logger.c b/src/telepathy-logger.c
index 536bc74..52eb574 100644
--- a/src/telepathy-logger.c
+++ b/src/telepathy-logger.c
@@ -19,7 +19,10 @@
* Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
*/
+#include "dbus-service.h"
+
#include <glib.h>
+#include <telepathy-glib/dbus.h>
#include <telepathy-logger/channel-factory.h>
#include <telepathy-logger/channel-text.h>
@@ -27,6 +30,35 @@
static GMainLoop *loop = NULL;
+
+static void
+telepathy_logger_dbus_init (void)
+{
+ TplDBusService *dbus_srv;
+ DBusGConnection *bus;
+ TpDBusDaemon *tp_bus;
+ GError *error = NULL;
+
+ bus = tp_get_bus();
+ tp_bus = tp_dbus_daemon_new(bus);
+
+ if ( tp_dbus_daemon_request_name (tp_bus, TPL_DBUS_SRV_WELL_KNOWN_BUS_NAME,
+ TRUE, &error) ) {
+ g_print("%s DBus well known name registered\n",
+ TPL_DBUS_SRV_WELL_KNOWN_BUS_NAME);
+ } else {
+ g_print("Well Known name request error: %s\n", error->message);
+ g_clear_error(&error);
+ g_error_free(error);
+ }
+
+ dbus_srv = tpl_dbus_service_new ();
+ dbus_g_connection_register_g_object (bus,
+ TPL_DBUS_SRV_OBJECT_PATH,
+ G_OBJECT(dbus_srv));
+}
+
+
int
main(int argc,
char *argv[])
@@ -52,6 +84,8 @@ main(int argc,
return 1;
}
+ telepathy_logger_dbus_init ();
+
loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);