Re: Need approval to submit a patch



Hi,

On Tue, May 17, 2011 at 3:04 AM, marcin saepia net <marcin saepia net> wrote:
> Hi,
>
> I've never participated in such big open-source project as GTK is,
> so I decided to ask before I will spend hours preparing the patch.

Just file a bug in bugzilla - that's how the process normally works.

> I extensively use GIO D-Bus bindings in my project.

Cool.

> To be honest,
> there're some things that could be done in more convenient way. One of
> those frequently-used tasks is emitting PropertiesChanged signal.
> There's no high-level function for that so I wrote one, and I thought
> that maybe could it be merged into GIO core?

First of all the main reason there isn't a function for this is that
with the new gdbus-codegen(1) tool, this is automatically handled.
That was always the plan and it's why pre-gdbus-codegen(1) is so
low-level.

> Usage is as simple as:
>
> g_dbus_connection_emit_properties_changed_signal(connection,
>  "/object",
>  "my.Interface",
>  "ChangedVariable1", g_variant_new("s", "new-value"),
>  "ChangedVariable2", g_variant_new("u", 1234),
>  G_DBUS_PROPERTIES_CHANGED_DELIMITER,
>  "InvalidatedVariable1",
>  "InvalidatedVariable2",
>  G_DBUS_PROPERTIES_CHANGED_DELIMITER);
>
> This is rather common task in the various applications, so in my
> opinion it shouldn't be reinvented every time. It is about 100 lines
> of code to convert such call to proper PropertiesChanged signal.

Is this really shorter than?

  GVariantBuilder cb;
  GVariantBuilder ib;
  g_variant_builder_init (&cb, G_VARIANT_TYPE_VARDICT);
  g_variant_builder_add (&cb, "{sv", "PropName", g_variant_new_string
("new val"));
  g_variant_builder_add (&cb, "{sv", "PropName2", g_variant_new_string
("other new val"));
  g_variant_builder_init (&ib, G_VARIANT_TYPE ("as"));
  g_variant_builder_add (&ib, "PropName3");
  g_dbus_connection_emit_signal (connection, NULL,
                                 "/org/myorg/MyObject",
                                 "org.freedesktop.DBus.Properties",
                                 "PropertiesChanged",
                                 g_variant_new ("(sa{sv}as)",

"org.myorg.MyInterface", &cb, &i),
                                 NULL);

> Would GIO team would be interested in patch that provides such
> high-level functionality?

For starters, I don't really like varargs functions because they are
not available to language bindings (GVariant is an exception and we
can assume each language will bind it separately). And I just don't
think it's that much shorter than the code I pasted above... and with
gdbus-codegen(1) it's kinda a non-issue because it happens
automatically. Maybe we could have
g_dbus_connection_emit_properties_changed_signal() method that takes
two GVariant* (GVariantBuilder is probably not bindable) instances,
then you can insert g_variant_builder_end() calls at that place? That
should be bindable...

Either way, please do file a bug against GLib (component gdbus) and we
can keep discussing there.

    David


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]