Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support creation of a zbus::Connection from a gio::DBusConnection #592

Open
zeenix opened this issue Feb 13, 2024 · 6 comments
Open

Support creation of a zbus::Connection from a gio::DBusConnection #592

zeenix opened this issue Feb 13, 2024 · 6 comments
Labels
enhancement New feature or request zbus Issues/PRs related to zbus crate

Comments

@zeenix
Copy link
Contributor

zeenix commented Feb 13, 2024

Support creation of a zbus::Connection from a gio::DBusConnection, which will mean we can finally remove this thorn. However, this will require a bit more. At least, we'll also need to figure out what to do with names registered by the underlying connection. This may or may not work out but it's worth a try.

Requires #590.

@zeenix zeenix added enhancement New feature or request zbus Issues/PRs related to zbus crate labels Feb 13, 2024
@zeenix zeenix mentioned this issue Feb 13, 2024
3 tasks
zeenix added a commit to zeenix/zbus that referenced this issue Feb 14, 2024
This method is has a default implementation that just uses the
lower-level sibling method, `sendmsg`. Implementers can either override
this method or the lower-level method, depending on the underlying
socket they're using.

Hopefully this will enable us to:

* In-memory Connection pair dbus2#591.
* Support creation of a zbus::Connection from a gio::DBusConnection dbus2#592.
@zeenix
Copy link
Contributor Author

zeenix commented Feb 15, 2024

Last night I got #590 almost complete and thought more about this. I realized that gio::DBusConnection doesn't give you a direct way to receive messages but rather has its own internal ObjectServer, similar to ours. So this will also require us to add mechanism for external ObjectServer impls. We don't necessarily need more public API for that though (at least for this alone), except for a builder/connection constructor that takes a gio::DBusConnection instance.

Also while there are send_message* for sending, we can't use them for method calls, since there is no way to receive their replies.

Due to this, I'm not sure #590 can help much here. We'll probably need some wrapper instead that zbus::Connection can use.

@REALERvolker1
Copy link

I think this would be a great idea -- I would really like to see this, but I think it would be good to make it available under a feature flag (gtk libraries take literally forever to build). I am making a gtk app right now and it would really help to be able to use only one dbus implementation.

@zeenix
Copy link
Contributor Author

zeenix commented Feb 26, 2024

but I think it would be good to make it available under a feature flag (gtk libraries take literally forever to build)

Of course, that's implied here. 😊 We're not going to depend on gtk though, just gio.

@zeenix
Copy link
Contributor Author

zeenix commented Feb 26, 2024

I am making a gtk app right now and it would really help to be able to use only one dbus implementation.

That is already possible. You don't have to use gio's connection for any of your D-Bus needs at all.

The only "issue" is that gio::Application (and gtk::Application in turn) takes the application name on the bus so you can't use that with zbus then.

But that's not really a problem, since it's a good D-Bus practice to append version numbers to your names anyway. So there doesn't need to be a conflict and in fact there's only a conflict if you don't follow recommended good practices.

@REALERvolker1
Copy link

Glad to hear this is still planned. I have been trying out gio::DBusProxy a bit and zbus is way easier to work with -- more "rusty".

@zeenix
Copy link
Contributor Author

zeenix commented Feb 26, 2024

Glad to hear this is still planned.

I wouldn't call this a plan. I created this issue with the assumption that #590 will enable this but I was wrong. Now I'm not sure how we can implement this. I'll probably not be the one doing it anyway.

As I explained above, this isn't really an issue, especially if people would version their service names, like they should.

zeenix added a commit to zeenix/zbus that referenced this issue Feb 27, 2024
This method is has a default implementation that just uses the
lower-level sibling method, `recvmsg`. Implementers can either override
this method or the lower-level method, depending on the underlying
socket they're using.

Hopefully this will enable us to:

* In-memory Connection pair dbus2#591.
* Support creation of a zbus::Connection from a gio::DBusConnection dbus2#592.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request zbus Issues/PRs related to zbus crate
Projects
None yet
Development

No branches or pull requests

2 participants