[PATCH 4/5] activation: use a D-Bus interface for activation

Scott James Remnant scott at netsplit.com
Sun Jan 2 14:46:56 PST 2011


Use an interface in the org.freedesktop.DBus domain for both the
activation signal from D-Bus and the failed signal from the
activation manager.
---
 bus/activation.c   |    8 ++++----
 bus/activation.h   |    2 +-
 bus/driver.c       |    4 ++--
 dbus/dbus-shared.h |    6 ++++++
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/bus/activation.c b/bus/activation.c
index edd8e33..74058f6 100644
--- a/bus/activation.c
+++ b/bus/activation.c
@@ -1925,7 +1925,7 @@ bus_activation_activate_service (BusActivation  *activation,
          the caller of a remote method. */
 
       message = dbus_message_new_signal (DBUS_PATH_DBUS,
-                                         "org.freedesktop.systemd1.Activator",
+                                         DBUS_INTERFACE_ACTIVATION,
                                          "ActivationRequest");
       if (!message)
         {
@@ -2197,15 +2197,15 @@ bus_activation_list_services (BusActivation *activation,
 }
 
 dbus_bool_t
-dbus_activation_systemd_failure (BusActivation *activation,
-                                 DBusMessage   *message)
+dbus_activation_failure (BusActivation *activation,
+                         DBusMessage   *message)
 {
   DBusError error;
   const char *code, *str, *request = NULL;
 
   dbus_error_init(&error);
 
-  /* This is called whenever the systemd activator sent us a
+  /* This is called whenever the activation manager sent us a
      response. We'll invalidate all pending activations that match the
      request. */
 
diff --git a/bus/activation.h b/bus/activation.h
index 97f25b1..90f9f69 100644
--- a/bus/activation.h
+++ b/bus/activation.h
@@ -57,7 +57,7 @@ dbus_bool_t    bus_activation_service_created  (BusActivation     *activation,
 dbus_bool_t    bus_activation_list_services    (BusActivation     *registry,
 						char            ***listp,
 						int               *array_len);
-dbus_bool_t    dbus_activation_systemd_failure (BusActivation     *activation,
+dbus_bool_t    dbus_activation_failure         (BusActivation     *activation,
                                                 DBusMessage       *message);
 
 dbus_bool_t    bus_activation_send_pending_auto_activation_messages (BusActivation     *activation,
diff --git a/bus/driver.c b/bus/driver.c
index cc8d1f2..c820d6e 100644
--- a/bus/driver.c
+++ b/bus/driver.c
@@ -1930,12 +1930,12 @@ bus_driver_handle_message (DBusConnection *connection,
 
   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
 
-  if (dbus_message_is_signal (message, "org.freedesktop.systemd1.Activator", "ActivationFailure"))
+  if (dbus_message_is_signal (message, DBUS_INTERFACE_ACTIVATION, "ActivationFailure"))
     {
       BusContext *context;
 
       context = bus_connection_get_context (connection);
-      return dbus_activation_systemd_failure(bus_context_get_activation(context), message);
+      return dbus_activation_failure(bus_context_get_activation(context), message);
     }
 
   if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_CALL)
diff --git a/dbus/dbus-shared.h b/dbus/dbus-shared.h
index 6a57670..a83978c 100644
--- a/dbus/dbus-shared.h
+++ b/dbus/dbus-shared.h
@@ -93,6 +93,12 @@ typedef enum
 /** The interface supported by most dbus peers */
 #define DBUS_INTERFACE_PEER           "org.freedesktop.DBus.Peer"
 
+/** This is a special interface for activation managers, D-Bus
+ * sends one signal in this interface and the activation manager
+ * sends another.
+ */
+#define DBUS_INTERFACE_ACTIVATION     "org.freedesktop.DBus.Activation"
+
 /** This is a special interface whose methods can only be invoked
  * by the local implementation (messages from remote apps aren't
  * allowed to specify this interface).
-- 
1.7.1



More information about the dbus mailing list