[Gambas-user] Dbus unique name seems incorrect

Bruce Steers bsteers4 at gmail.com
Thu Jan 20 23:27:58 CET 2022


My 2 bits worth Brian, not even sure if it's related but,   i had issues
with DBus.Unique when i added a SystemTray object.

The Systemtray initialized DBus before i tried to set the name so it was
too late.
i fixed it by setting the DBus name and unique flag in the classes _new()
or _init() methods.

So if your app has any DBus objects be aware of that.

All the best.

BruceS


On Wed, 19 Jan 2022 at 19:20, Brian G <brian at westwoodsvcs.com> wrote:

> Has anyone else experienced this?
>
> "Failure is the key to success;
>  each mistake teaches us something"  .. Morihei Ueshiba
> Brian G
>
> ----- On Jan 16, 2022, at 2:26 PM, Brian G brian at westwoodsvcs.com wrote:
>
> > Hi Benoît,
> >
> >  When working with the policykit1, some of the methods require a unique
> name. By
> >  the DBus standard a unique name must start with a colon. Normally the
> Hello
> >  method would return a unique id, but that crashes when I try to us it.
> >
> > When I try to pass the dbus name to the Kit I get an invalid name error.
> Upon
> > research the name must start with a : to be unique.
> >
> > When working with the PolicyKit1:
> >
> >  Dim Proxy As New DBusProxy(App, "/org/freedesktop/PolicyKit1/Authority",
> >  "org.freedesktop.PolicyKit1.Authority")
> >  Dim System_Bus_Name As String = DBus.name
> >  Dim subject As Variant = ["system-bus-name", ["name": System_Bus_Name]]
> >  Dim action_id As String = "org.freedesktop.policykit.exec"
> >  Dim Details As Variant = New Collection
> >  Dim flags As Integer = 1
> >  Dim cancellation_id As String = ""
> >  Dim sresult As Variant = Proxy.CheckAuthorization(subject, action_id,
> details,
> >  flags, cancellation_id)
> >            org.freedesktop.PolicyKit1.Error.Failed:Error getting
> subject: Error Parsing
> >            system-bus-name subject: 'org.gambas.Auth-537384' is not a
> unique name.
> >
> >  Would it be possible to change how the naming works?
> >
> > "Failure is the key to success;
> > each mistake teaches us something"  .. Morihei Ueshiba
> > Brian G
> >
> > ----- On Jan 16, 2022, at 1:05 PM, Benoît Minisini g4mba5 at gmail.com
> wrote:
> >
> >> Le 16/01/2022 à 03:26, Brian G a écrit :
> >>> In the db.dbus module
> >>>
> >>> the dbus.unique is false to start but seems to try and create a unique
> name
> >>>
> >>> When set to true it appears to create a non unique name.
> >>>
> >>> And as far as a unique name goes, it must start with a : for the system
> >>> to recognize it as unique...
> >>
> >> Where did you see that?
> >>
> >> Setting DBus.Unique changes just the name used for registering to the
> D-Bus.
> >>
> >> If not set, the name includes the application name and the process PID.
> >> If set, just the application name, so that two instances of the same
> >> application will use the same name.
> >>
> >> It's just a trick, and D-Bus is not concerned by it.
> >>
> >> Regards,
> >>
> >> --
> >> Benoît Minisini
> >>
> >> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> >
> > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220120/ef7340e7/attachment-0001.htm>


More information about the User mailing list