summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <sandmann@redhat.com>2009-04-15 07:54:33 -0400
committerSøren Sandmann Pedersen <sandmann@redhat.com>2009-04-15 07:54:33 -0400
commit0e6d7edcb3853d51e71461c8665790a2916a0ceb (patch)
treecf5c5f0b4290a286e41f6f4412702647c6b93e2a
parent7ce6701229dae6a0e2ea73235ed415ec72be6579 (diff)
Use nul_dbus_set_object_data()
-rw-r--r--siv.c42
-rw-r--r--window.c1
2 files changed, 24 insertions, 19 deletions
diff --git a/siv.c b/siv.c
index 849ef91..745efbb 100644
--- a/siv.c
+++ b/siv.c
@@ -490,26 +490,31 @@ app_new (int argc, char **argv)
return app;
}
-static nul_dbus_object_t *
-make_object (gpointer data)
+static nul_dbus_service_t *
+make_service (void)
{
- return nul_dbus_object (
- "/app",
- data,
-
- nul_dbus_interface (
- "dk.au.daimi.sandmann.siv",
+ return nul_dbus_session_service (
+ "dk.au.daimi.sandmann.siv",
+
+ nul_dbus_object (
+ "/app",
+ NULL,
- nul_dbus_method (
- "open",
- (nul_dbus_function_t)on_open, /* on_open,*/
- nul_dbus_parameter_in ("startup_id", nul_dbus_type_string()),
- nul_dbus_parameter_in ("filename", nul_dbus_type_string()),
- nul_dbus_parameter_out ("result", nul_dbus_type_int32()),
+ nul_dbus_interface (
+ "dk.au.daimi.sandmann.siv",
+
+ nul_dbus_method (
+ "open",
+ (nul_dbus_function_t)on_open, /* on_open,*/
+ nul_dbus_parameter_in ("startup_id", nul_dbus_type_string()),
+ nul_dbus_parameter_in ("filename", nul_dbus_type_string()),
+ nul_dbus_parameter_out ("result", nul_dbus_type_int32()),
+ NULL),
+
NULL),
NULL),
-
+
NULL);
}
@@ -548,7 +553,7 @@ main (int argc,
if (!getenv ("G_SLICE"))
putenv ("G_SLICE=always_malloc");
- service = nul_dbus_session_service ("dk.au.daimi.sandmann.siv", NULL);
+ service = make_service ();
if (nul_dbus_service_start (service) /* FIXME: or if it failed due to
lack of dbus daemon */)
{
@@ -568,8 +573,9 @@ main (int argc,
}
app = app_new (argc, argv);
+
+ nul_dbus_service_set_object_data (service, "/app", app);
- nul_dbus_service_add_object (service, make_object (app));
nul_signal_set_handler (SIGINT, on_sigint, app, NULL);
gtk_main ();
@@ -585,8 +591,6 @@ main (int argc,
files = process_options (argc, argv);
- nul_dbus_service_add_object (service, make_object (NULL));
-
for (i = 0; files[i] != NULL; ++i)
{
nul_dbus_invoke (service, "/app/dk.au.daimi.sandmann.siv.open",
diff --git a/window.c b/window.c
index cff9fa3..52d868f 100644
--- a/window.c
+++ b/window.c
@@ -4,6 +4,7 @@
#include <gdk/gdkx.h>
#include <libnul.h>
#include <errno.h>
+#include <stdlib.h>
#include "siv.h"
#define MIN_ZOOM -80