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 662693 - New ValueName substitution in glib-mkenums
New ValueName substitution in glib-mkenums
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gobject
2.31.x
Other All
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-10-25 17:15 UTC by Aleksander Morgado
Modified: 2018-05-24 13:28 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Aleksander Morgado 2011-10-25 17:15:05 UTC
It would be great if glib-mkenums had a "ValueName" susbtitution, so that from the following example:

typedef enum {
  PREFIX_THE_FIRST_VALUE = 1,
  PREFIX_ANOTHER_VALUE   = 2,
} PrefixTheXEnum;

We could get "TheFirstValue" and "AnotherValue".

It would be very handy to setup glib-mkenums to generate error type information with error domain registration in GDBus, something like:

GQuark
@enum_name@_quark (void)
{
    static volatile gsize quark_volatile = 0;
    static const GDBusErrorEntry @enum_name@_entries[] = {
        { @VALUENAME@, "org.project.Foo.Bar.Error.@ValueName@"},
    };

    g_dbus_error_register_error_domain ("@enum_name@_quark",
                                        &quark_volatile,
                                        @enum_name@_entries,
                                        G_N_ELEMENTS (@enum_name@_entries));
    return (GQuark) quark_volatile;
}

Note: this wouldn't be enough to get it useful for GDBusErrorEntry generations, as usually errors in DBus are given with the error domain, like "org.project.Foo.Bar.Error.Domain.@ValueName@", and the Domain part usually also comes from the enum name... that's another issue to handle.
Comment 1 David Zeuthen (not reading bugmail) 2011-10-25 17:29:39 UTC
Another, and probably better, option would be to make gdbus-codegen(1) generate error the domain ... maybe you'd specify errors in the introspection XML, maybe some other file, maybe on the command-line, I don't know.

With this, we'd also have a chance to make sure the generated call-glue (e.g. foo_bar_call_xyz() and foo_bar_call_xyz_sync() wrappers) call the foo_bar_error_quark() method so the error domain is properly registered before transcoding the D-Bus error to a GError (cf. bug 662396)
Comment 2 GNOME Infrastructure Team 2018-05-24 13:28:56 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/471.