Get bus name and use it on clock
authorEnrico Zini <enrico@enricozini.org>
Mon, 17 Aug 2009 15:04:04 +0000 (16:04 +0100)
committerEnrico Zini <enrico@enricozini.org>
Mon, 17 Aug 2009 15:04:04 +0000 (16:04 +0100)
src/Makefile.am
src/clock.vala
src/dbus-extra.vapi [new file with mode: 0644]
src/registry.vala

index 21eda5045a96207da9ed2b2d927e56376b4644d7..8bfe364886c72bc337554fc027b69f69d6c80206 100644 (file)
@@ -1,4 +1,4 @@
-VFLAGS=-g --pkg gee-1.0 --pkg dbus-glib-1 --pkg gtk+-2.0 --pkg posix --pkg libwnck-1.0 --vapidir=. --pkg linux-input
+VFLAGS=-g --pkg gee-1.0 --pkg dbus-glib-1 --pkg gtk+-2.0 --pkg posix --pkg libwnck-1.0 --vapidir=. --pkg linux-input --pkg dbus-extra
 
 #zavai: $(SOURCES)
 #      valac -o zavai $(VFLAGS) $^
@@ -45,7 +45,7 @@ zavai_VALASOURCES = \
        app_debug.vala \
        zavai.vala
 
-zavai_VAPIS = linux-input.vapi 
+zavai_VAPIS = linux-input.vapi dbus-extra.vapi
 
 zavai_SOURCES = \
        zavai.vala.stamp \
index 928bf69933ce759bfe86be807b093cb74b31f61c..ec4b6267a79787b2aaccf2ea678e09a4fc262a98 100644 (file)
@@ -105,8 +105,8 @@ public class Clock: zavai.Service
         if (alarms != null)
         {
             try {
-                otimed_alarm.ClearAlarm("");
-                otimed_alarm.SetAlarm("", alarms.data.deadline);
+                otimed_alarm.ClearAlarm(zavai.registry.bus_name);
+                otimed_alarm.SetAlarm(zavai.registry.bus_name, alarms.data.deadline);
             } catch (Error e) {
                 zavai.log.error("Cannot reschedule alarms: " + e.message);
             }
diff --git a/src/dbus-extra.vapi b/src/dbus-extra.vapi
new file mode 100644 (file)
index 0000000..5213899
--- /dev/null
@@ -0,0 +1,5 @@
+namespace DBus {
+       [CCode (cname = "dbus_bus_get_unique_name")]
+       public unowned string bus_get_unique_name (DBus.RawConnection conn);
+}
+
index 20051db25c69c9a71104b602af1be48517f2b228..83006cb7a7249ec5723cf9d6685dcb1694c2d08e 100644 (file)
@@ -147,6 +147,8 @@ public class Registry : Object, Resource
                registration_order = new ArrayList<Resource>();
                sbus = DBus.Bus.get(DBus.BusType.SYSTEM);
 
+        bus_name = DBus.bus_get_unique_name(sbus.get_connection());
+        zavai.log.info("My bus name: " + bus_name);
 /*
 stderr.printf("ZA1\n");
         dynamic DBus.Object tmp_dbus = sbus.get_object(