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 384579 - Support more typedefs
Support more typedefs
Status: RESOLVED OBSOLETE
Product: gtk-doc
Classification: Platform
Component: general
unspecified
Other Linux
: Low enhancement
: ---
Assigned To: gtk-doc maintainers
gtk-doc maintainers
Depends on:
Blocks:
 
 
Reported: 2006-12-11 01:39 UTC by Sven Herzberg
Modified: 2018-05-22 13:01 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sven Herzberg 2006-12-11 01:39:07 UTC
Please add support for defining types like this:

typedef GtkHBox      MyMagicHBox;
typedef GtkHBoxClass MyMagicHBoxClass;

Since the introduction of g_type_class_add_private() this can be used very widely to hide implementation details without private pointers.
Comment 1 Damon Chaplin 2006-12-17 12:41:17 UTC
We do support simple typedefs like this:
   typedef gint   gboolean;

Is the problem that we don't output things like signals and object properties?

Looking at the code, it looks like we check every symbol to see if it has
associated hierarchy/signals/properties etc. (in gtkdoc-mkdb.in line 573).
So I'm not sure why it isn't working. It may just need a minor fix somewhere.
Comment 2 Yeti 2007-01-16 15:02:38 UTC
(In reply to comment #0)
> Please add support for defining types like this:
> 
> typedef GtkHBox      MyMagicHBox;
> typedef GtkHBoxClass MyMagicHBoxClass;

It would be helpful if you said what kind of support you are missing...

But let me guess...  The typedef for "MyMagicHBox" appears in the XML DocBook source, it gets the same id "MyMagicBox" as the section, and xsltproc complains (this is the only problem I encountered when I tried it).  And you don't want to change the section id you want to change the typedef instead.

This can be perhaps detected somehow, or all typedef ids can be mangled to *-typedef.  But I'm not sure it worths doing.

typedef struct _MyMagicHBox MyMagicHBox;
typedef struct _MyMagicHBoxClass MyMagicHBoxClass;

struct _MyMagicBox {
    GtkHBox parent;
};

struct _MyMagicBoxClass {
    GtkHBoxClass parent;
};

does exactly the same as your example, it already works with gtk-doc, and I can't see any private pointers there (I'm not sure what you mean, but there are no pointers at all, so I suppose there are no private pointers either).
Comment 3 Sven Herzberg 2007-04-18 13:54:25 UTC
My point is that the approach with the struct is quite a lot stuff to write. I want people to be easily able to write their own canvas items for my canvas (which works perfectly with the one-line typedef given on top). They shouldn't have to bother with this struct aliasing.
Comment 4 Yeti 2007-04-18 14:45:04 UTC
(In reply to comment #3)
> My point is that the approach with the struct is quite a lot stuff to write.

If writing the six simple lines is something people cannot bother with, I wonder how they can bother with implementation of a new class in C at all.  One has to follow quite a few conventions to let gtk-doc understand the code.  Using struct nesting to express subclassing is one of them and it is the way Gtk+ code has been always written.

> I
> want people to be easily able to write their own canvas items for my canvas
> (which works perfectly with the one-line typedef given on top). They shouldn't
> have to bother with this struct aliasing.

Mangling ids of typedefs (gint, gchar, ...) to make them different from section ids would create much more total ugliness than several struct aliasing somewhere.   
So I would say the question is not what you want but what you suggest?
Comment 5 Sven Herzberg 2007-04-18 18:03:32 UTC
Six lines less are sixe lines less with potential typos.
Comment 6 Yeti 2007-04-18 18:32:57 UTC
Please answer my question.
Comment 7 Damon Chaplin 2007-04-19 15:01:33 UTC
If it was trivial to support I'd add it, but otherwise I don't really think it
is worth worrying about.
Comment 8 GNOME Infrastructure Team 2018-05-22 13:01:02 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/gtk-doc/issues/4.