summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2008-11-13 17:00:46 +0000
committerRichard Hughes <richard@hughsie.com>2008-11-13 17:00:46 +0000
commit03ef073b4e7c26bb71ae80ee088d05a9152cbae9 (patch)
treef43de33f42326bbe355318ab340ed5fb949d5832
parenta48ce21f83c16d964450763f26592cf6e570650e (diff)
trivial: expose object on the bus
-rw-r--r--src/Makefile.am2
-rw-r--r--src/dkp-main.c (renamed from src/main.c)37
2 files changed, 23 insertions, 16 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 56028fc..eceada3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -67,7 +67,7 @@ devkit_power_daemon_SOURCES = \
dkp-qos.h dkp-qos.c \
dkp-history.h dkp-history.c \
sysfs-utils.h sysfs-utils.c \
- main.c \
+ dkp-main.c \
$(BUILT_SOURCES)
devkit_power_daemon_CPPFLAGS = \
diff --git a/src/main.c b/src/dkp-main.c
index 16b925a..5f47f5c 100644
--- a/src/main.c
+++ b/src/dkp-main.c
@@ -42,7 +42,10 @@
#include <devkit-gobject/devkit-gobject.h>
#include "egg-debug.h"
+
#include "dkp-daemon.h"
+#include "dkp-qos.h"
+#include "dkp-qos-glue.h"
#define NAME_TO_CLAIM "org.freedesktop.DeviceKit.Power"
static GMainLoop *loop = NULL;
@@ -54,15 +57,12 @@ static gboolean
main_acquire_name_on_proxy (DBusGProxy *bus_proxy)
{
GError *error;
- guint result;
- gboolean res;
- gboolean ret;
-
- ret = FALSE;
+ guint result;
+ gboolean res;
+ gboolean ret = FALSE;
- if (bus_proxy == NULL) {
+ if (bus_proxy == NULL)
goto out;
- }
error = NULL;
res = dbus_g_proxy_call (bus_proxy,
@@ -94,8 +94,7 @@ main_acquire_name_on_proxy (DBusGProxy *bus_proxy)
}
ret = TRUE;
-
- out:
+out:
return ret;
}
@@ -121,11 +120,13 @@ int
main (int argc, char **argv)
{
GError *error;
- DkpDaemon *power_daemon;
+ DkpDaemon *daemon;
+ DkpQos *qos;
GOptionContext *context;
DBusGProxy *bus_proxy;
DBusGConnection *bus;
gboolean verbose = FALSE;
+ DBusGConnection *connection;
int ret = 1;
const GOptionEntry entries[] = {
@@ -167,18 +168,24 @@ main (int argc, char **argv)
egg_debug ("Starting devkit-power-daemon version %s", VERSION);
- power_daemon = dkp_daemon_new ();
-
- if (power_daemon == NULL)
+ qos = dkp_qos_new ();
+ daemon = dkp_daemon_new ();
+ if (daemon == NULL)
goto out;
+ /* register on the bus */
+ connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
+ dbus_g_object_type_install_info (DKP_TYPE_QOS, &dbus_glib_dkp_qos_object_info);
+ dbus_g_connection_register_g_object (connection, "/org/freedesktop/DeviceKit/Power/QoS", G_OBJECT (qos));
+
loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);
- g_object_unref (power_daemon);
+ g_object_unref (qos);
+ g_object_unref (daemon);
g_main_loop_unref (loop);
ret = 0;
-
out:
return ret;
}
+