api addition for activation
James Willcox
jwillcox@cs.indiana.edu
11 May 2003 23:28:15 -0500
--=-hIjLxWYVtWNNrs+CMIe4
Content-Type: multipart/mixed; boundary="=-YaT3B3qdIBYu7mBM/ogJ"
--=-YaT3B3qdIBYu7mBM/ogJ
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Hi,
Here's a small addition adding dbus_bus_activate_service(). It also
adds a servicedir tag to session.conf.in. Ok to commit?
Thanks,
James
--=-YaT3B3qdIBYu7mBM/ogJ
Content-Disposition: attachment; filename=dbus_jwillcox_activate_service_v1.diff
Content-Type: text/x-patch; name=dbus_jwillcox_activate_service_v1.diff; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Index: ChangeLog
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/freedesktop/dbus/ChangeLog,v
retrieving revision 1.353
diff -u -r1.353 ChangeLog
--- ChangeLog 9 May 2003 04:15:56 -0000 1.353
+++ ChangeLog 10 May 2003 00:49:26 -0000
@@ -1,3 +1,11 @@
+2003-05-09 James Willcox <jwillcox@gnome.org>
+
+ * bus/session.conf.in: add <servicedir>
+ * dbus/dbus-bus.c: (dbus_bus_activate_service):
+ * dbus/dbus-bus.h:
+
+ Add some convenience API which lets you activate a service.
+
2003-05-08 Havoc Pennington <hp@pobox.com>
=20
* dbus/dbus-spawn.c: s/_exit/exit/ because it was keeping gcov
Index: bus/session.conf.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/freedesktop/dbus/bus/session.conf.in,v
retrieving revision 1.4
diff -u -r1.4 session.conf.in
--- bus/session.conf.in 14 Apr 2003 02:29:21 -0000 1.4
+++ bus/session.conf.in 10 May 2003 00:49:26 -0000
@@ -10,6 +10,8 @@
=20
<listen>unix:tmpdir=3D@DBUS_SESSION_SOCKET_DIR@</listen>
=20
+ <servicedir>@prefix@/lib/dbus-1.0/services</servicedir>
+
<policy context=3D"default">
<!-- Allow everything -->
<allow send=3D"*"/>
Index: dbus/dbus-bus.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/freedesktop/dbus/dbus/dbus-bus.c,v
retrieving revision 1.20
diff -u -r1.20 dbus-bus.c
--- dbus/dbus-bus.c 24 Apr 2003 19:18:22 -0000 1.20
+++ dbus/dbus-bus.c 10 May 2003 00:49:26 -0000
@@ -674,4 +674,48 @@
return (exists !=3D FALSE);
}
=20
+/**
+ * Activates a given service
+ *
+ * @param connection the connection
+ * @param service_name the service name
+ * @param error location to store any errors
+ * @returns #TRUE if the activation succeeded, #FALSE if not
+ */
+dbus_bool_t
+dbus_bus_activate_service (DBusConnection *connection,
+ const char *service_name,
+ DBusError *error)
+{
+ DBusMessage *msg;
+ DBusMessage *reply;
+ dbus_bool_t ret =3D TRUE;
+
+ msg =3D dbus_message_new (DBUS_MESSAGE_ACTIVATE_SERVICE,
+ DBUS_SERVICE_DBUS);
+
+ dbus_message_append_args (msg, DBUS_TYPE_STRING, service_name,
+ DBUS_TYPE_UINT32, 0, 0);
+
+ reply =3D dbus_connection_send_with_reply_and_block (connection, msg,
+ -1, error);
+ dbus_message_unref (msg);
+
+ if (reply =3D=3D NULL)
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ return FALSE;
+ }
+
+ if (dbus_set_error_from_message (error, reply))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ ret =3D FALSE;
+ }
+ =20
+ dbus_message_unref (reply);
+ return ret;
+}
+
+
/** @} */
Index: dbus/dbus-bus.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/freedesktop/dbus/dbus/dbus-bus.h,v
retrieving revision 1.6
diff -u -r1.6 dbus-bus.h
--- dbus/dbus-bus.h 3 Apr 2003 05:22:48 -0000 1.6
+++ dbus/dbus-bus.h 10 May 2003 00:49:26 -0000
@@ -53,6 +53,10 @@
const char *service_name,
DBusError *error);
=20
+dbus_bool_t dbus_bus_activate_service (DBusConnection *connection,
+ const char *service_name,
+ DBusError *error);
+
DBUS_END_DECLS;
=20
#endif /* DBUS_BUS_H */
--=-YaT3B3qdIBYu7mBM/ogJ--
--=-hIjLxWYVtWNNrs+CMIe4
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQA+vyLeHcA+jblZuh8RAlneAKCpg4T43/GgnddIERBoi2fRTW9O0wCfc/re
fYJetK8S3OkeUC4FUL3RKtc=
=7TgD
-----END PGP SIGNATURE-----
--=-hIjLxWYVtWNNrs+CMIe4--