return uid;
}
+/**
+ * g_dbus_start_service_by_name:
+ *
+ * Since: 2.4x
+ */
+GBusStartServiceReplyFlags
+g_dbus_start_service_by_name (GDBusConnection *connection,
+ const gchar *name,
+ guint32 flags,
+ GError **error)
+{
+ GVariant *result;
+ guint32 ret;
+
+ g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), -1);
+ g_return_val_if_fail (name == NULL || g_dbus_is_name (name), -1);
+ g_return_val_if_fail (error == NULL || *error == NULL, -1);
+
+ result = NULL;
+ ret = G_BUS_START_SERVICE_REPLY_ERROR;
+
+ if (connection->kdbus_worker)
+ result = _g_kdbus_StartServiceByName (connection->kdbus_worker, connection, name, flags, error);
+ else
+ result = g_dbus_connection_call_sync (connection, "org.freedesktop.DBus", "/",
+ "org.freedesktop.DBus", "StartServiceByName",
+ g_variant_new ("(su)", name, flags), G_VARIANT_TYPE ("(u)"),
+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, error);
+ if (result != NULL)
+ {
+ g_variant_get (result, "(u)", &ret);
+ g_variant_unref (result);
+ }
+
+ return (GBusStartServiceReplyFlags) ret;
+}
+
/* ---------------------------------------------------------------------------------------------------- */
/**
guint32 g_dbus_get_connection_uid (GDBusConnection *connection,
const gchar *name,
GError **error);
+GLIB_AVAILABLE_IN_2_40
+GBusStartServiceReplyFlags g_dbus_start_service_by_name (GDBusConnection *connection,
+ const gchar *name,
+ guint32 flags,
+ GError **error);
/* ---------------------------------------------------------------------------------------------------- */
* GBusReleaseNameReplyFlags:
* @G_BUS_RELEASE_NAME_FLAGS_ERROR: Error flag.
* @G_BUS_RELEASE_NAME_FLAGS_RELEASED: The caller has released his claim on the given name.
- * @G_BUS_RELEASE_NAME_FLAGS_NON_EXISTENT: The given name does not exist on this bus
- * @G_BUS_RELEASE_NAME_FLAGS_NOT_OWNER: The caller not waiting in the queue to own this name
+ * @G_BUS_RELEASE_NAME_FLAGS_NON_EXISTENT: The given name does not exist on this bus.
+ * @G_BUS_RELEASE_NAME_FLAGS_NOT_OWNER: The caller not waiting in the queue to own this name.
*
* Flags used in g_dbus_release_name().
*
} GBusReleaseNameReplyFlags;
/**
+ * GBusStartServiceReplyFlags:
+ * @G_BUS_START_SERVICE_REPLY_ERROR: Error flag.
+ * @G_BUS_START_SERVICE_REPLY_SUCCESS: The service was successfully started.
+ * @G_BUS_START_SERVICE_REPLY_ALREADY_RUNNING: A connection already owns the given name.
+ *
+ * Flags used in g_dbus_start_service_by_name().
+ *
+ * Since: 2.4x
+ */
+typedef enum
+{
+ G_BUS_START_SERVICE_REPLY_ERROR = 0,
+ G_BUS_START_SERVICE_REPLY_SUCCESS = 1,
+ G_BUS_START_SERVICE_REPLY_ALREADY_RUNNING = 2
+} GBusStartServiceReplyFlags;
+
+/**
* GBusNameWatcherFlags:
* @G_BUS_NAME_WATCHER_FLAGS_NONE: No flags set.
* @G_BUS_NAME_WATCHER_FLAGS_AUTO_START: If no-one owns the name when
/**
+ * _g_kdbus_StartServiceByName:
+ *
+ */
+GVariant *
+_g_kdbus_StartServiceByName (GKDBusWorker *worker,
+ GDBusConnection *connection,
+ const gchar *name,
+ guint32 flags,
+ GError **error)
+{
+ GVariant *result;
+ guint32 status;
+
+ if (!g_dbus_is_name (name))
+ {
+ g_set_error (error,
+ G_DBUS_ERROR,
+ G_DBUS_ERROR_INVALID_ARGS,
+ "Given bus name \"%s\" is not valid", name);
+ return NULL;
+ }
+
+ if (!g_kdbus_NameHasOwner_internal (worker, name, error))
+ {
+ GVariant *ret;
+
+ ret = g_dbus_connection_call_sync (connection, name, "/",
+ "org.freedesktop.DBus.Peer", "Ping",
+ NULL, G_VARIANT_TYPE ("(u)"),
+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, error);
+ if (ret != NULL)
+ {
+ status = G_BUS_START_SERVICE_REPLY_SUCCESS;
+ g_variant_unref (ret);
+ }
+ else
+ return NULL;
+ }
+ else
+ status = G_BUS_START_SERVICE_REPLY_ALREADY_RUNNING;
+
+ result = g_variant_new ("(u)", status);
+
+ return result;
+}
+
+
+/**
* g_kdbus_bloom_add_data:
* Based on bus-bloom.c from systemd
* http://cgit.freedesktop.org/systemd/systemd/tree/src/libsystemd/sd-bus/bus-bloom.c
const gchar *name,
GError **error);
+GVariant * _g_kdbus_StartServiceByName (GKDBusWorker *worker,
+ GDBusConnection *connection,
+ const gchar *name,
+ guint32 flags,
+ GError **error);
+
void _g_kdbus_AddMatch (GKDBusWorker *worker,
const gchar *match_rule,
guint64 cookie);