After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 695715 - Use DBus calls instead of Avahi API
Use DBus calls instead of Avahi API
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Printing
3.7.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-03-12 16:27 UTC by Marek Kašík
Modified: 2013-03-13 15:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
use DBus calls instead of Avahi API (36.62 KB, patch)
2013-03-12 16:27 UTC, Marek Kašík
committed Details | Review

Description Marek Kašík 2013-03-12 16:27:37 UTC
Created attachment 238708 [details] [review]
use DBus calls instead of Avahi API

Current Gtk+ requires avahi-gobject for compilation with support for Avahi-advertised printers. This can lead to circular dependency as noted in https://bugzilla.gnome.org/show_bug.cgi?id=695127.

Attached patch turns these avahi-gobject API calls to DBus calls and removes the dependency on avahi-gobject.

The patch has to be applied after the patches from https://bugzilla.gnome.org/show_bug.cgi?id=695713 and https://bugzilla.gnome.org/show_bug.cgi?id=695714.
Comment 1 Matthias Clasen 2013-03-13 02:52:05 UTC
Review of attachment 238708 [details] [review]:

looks good to me
Comment 2 Marek Kašík 2013-03-13 14:36:47 UTC
Comment on attachment 238708 [details] [review]
use DBus calls instead of Avahi API

Thank you for the review. I've pushed the patch to gtk-3-8 and master.
Comment 3 Christian Persch 2013-03-13 14:49:59 UTC
+      g_variant_get (output, "(ii&s&s&s&si&sq@aayu)",
[....]
+      for (i = 0; i < g_variant_n_children (txt); i++)
+        {
+          child = g_variant_get_child_value (txt, i);
+
+          tmp = g_new0 (gchar, g_variant_n_children (child) + 1);
+          for (j = 0; j < g_variant_n_children (child); j++)
+            {
+              tmp[j] = g_variant_get_byte (g_variant_get_child_value (child, j));
+            }
+

That doesn't look very clean... GVariant has built-in support for bytestrings and arrays thereof, so you can just use "^a&ay" in the format string instead of "@aay", and get a strv out directly.
Comment 4 Marek Kašík 2013-03-13 15:36:24 UTC
(In reply to comment #3)
> That doesn't look very clean... GVariant has built-in support for bytestrings
> and arrays thereof, so you can just use "^a&ay" in the format string instead of
> "@aay", and get a strv out directly.


Hi Christian,

I think that it is not elegant too but the "^a&ay" doesn't work in this case. I tried it again now and I still can not get a usable result from that. It returns me just empty strings.
I'll try to look at it later and I will fill a bug for this if I will find any.

Regards

Marek