[patch][python] Make ExportedGObject __init__ accept GObject
properties
John (J5) Palmieri
johnp at redhat.com
Mon May 7 19:34:04 PDT 2007
Feel free to commit.
On Mon, 2007-05-07 at 15:59 +0100, Simon McVittie wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> ExportedGObject didn't previously accept keyword arguments specifying
> construct-time GObject properties. It does now.
>
> So that you can set GObject properties with names like "object_path" too, it
> accepts an optional dict keyword argument "gobject_properties", as well
> as treating unrecognised keyword arguments as GObject properties.
>
> - From e22eebbb3911e8035a71cbc64e0fd43e512186f1 Mon Sep 17 00:00:00 2001
> From: Simon McVittie <simon.mcvittie at collabora.co.uk>
> Date: Mon, 7 May 2007 15:53:59 +0100
> Subject: [PATCH] dbus/gobject_service.py: Make ExportedGObject __init__ accept GObject properties
>
>
> diff --git a/dbus/gobject_service.py b/dbus/gobject_service.py
> index 9b94f93..17749ca 100644
> - --- a/dbus/gobject_service.py
> +++ b/dbus/gobject_service.py
> @@ -39,8 +39,29 @@ class ExportedGObject(gobject.GObject, dbus.service.Object):
> """
> __metaclass__ = ExportedGObjectType
>
> - - def __init__(self, conn=None, object_path=None, bus_name=None):
> - - gobject.GObject.__init__(self)
> + def __init__(self, conn=None, object_path=None, **kwargs):
> + """Initialize an exported GObject.
> +
> + :Parameters:
> + `conn` : dbus.connection.Connection
> + The D-Bus connection or bus
> + `object_path` : str
> + The object path at which to register this object.
> + :Keywords:
> + `bus_name` : dbus.service.BusName
> + A bus name to be held on behalf of this object, or None.
> + `gobject_properties` : dict
> + GObject properties to be set on the constructed object.
> +
> + Any unrecognised keyword arguments will also be interpreted
> + as GObject properties.
> + """
> + bus_name = kwargs.pop('bus_name', None)
> + gobject_properties = kwargs.pop('gobject_properties', None)
> +
> + if gobject_properties is not None:
> + kwargs.update(gobject_properties)
> + gobject.GObject.__init__(self, **kwargs)
> dbus.service.Object.__init__(self, conn=conn,
> object_path=object_path,
> bus_name=bus_name)
> - --
> 1.5.1.3
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net
>
> iD8DBQFGPz64WSc8zVUw7HYRAksnAKCi1HK+1UqzHX9P+NpZ5jjWr9s8hwCg6eUM
> u8p/1V9G1ae59NkEhLaFrO8=
> =4gUh
> -----END PGP SIGNATURE-----
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
More information about the dbus
mailing list