chiark / gitweb /
manager: fix printing of child process names
[elogind.git] / dbus.h
diff --git a/dbus.h b/dbus.h
index aaae89de11df74b9522fd3e81a500444a0b30a24..5b41877e8c3a9a1c9ac6a62c775fee8c8efcd598 100644 (file)
--- a/dbus.h
+++ b/dbus.h
@@ -33,7 +33,7 @@ typedef struct BusProperty {
         const char *property;            /* name of the property */
         BusPropertyCallback append;      /* Function that is called to serialize this property */
         const char *signature;
-        void *data;                      /* The data of this property */
+        const void *data;                /* The data of this property */
 } BusProperty;
 
 #define BUS_PROPERTIES_INTERFACE                                        \
@@ -56,8 +56,10 @@ typedef struct BusProperty {
         "  </method>"                                                   \
         " </interface>"
 
-int bus_init(Manager *m);
-void bus_done(Manager *m);
+int bus_init_system(Manager *m);
+int bus_init_api(Manager *m);
+void bus_done_system(Manager *m);
+void bus_done_api(Manager *m);
 
 unsigned bus_dispatch(Manager *m);
 
@@ -84,4 +86,21 @@ void bus_unit_send_removed_signal(Unit *u);
 void bus_job_send_change_signal(Job *j);
 void bus_job_send_removed_signal(Job *j);
 
+#define DEFINE_BUS_PROPERTY_APPEND_ENUM(function,name,type)            \
+        static int function(Manager *m, DBusMessageIter *i, const char *property, void *data) { \
+                const char *value;                                      \
+                type *field = data;                                     \
+                                                                        \
+                assert(m);                                              \
+                assert(i);                                              \
+                assert(property);                                       \
+                                                                        \
+                value = name##_to_string(*field);                       \
+                                                                        \
+                if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &value)) \
+                        return -ENOMEM;                                 \
+                                                                        \
+                return 0;                                               \
+        }
+
 #endif