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 720159 - move type definitions for GSimpleAction to header files
move type definitions for GSimpleAction to header files
Status: RESOLVED DUPLICATE of bug 669541
Product: glib
Classification: Platform
Component: gio
2.38.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-12-10 00:08 UTC by Charles Lindsay
Modified: 2013-12-11 03:44 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Charles Lindsay 2013-12-10 00:08:59 UTC
I'm trying to subclass GSimpleAction in Vala, and getting an error at gcc-time.  If test.vala contains:

public class Test : SimpleAction {}
public void main() {
    Test t = new Test();
    (void)t;
}

Here's the result of trying to compile it:

$ valac --save-temps --pkg gio-2.0 test.vala 
/home/chaz/Desktop/test.c:23:16: error: field ‘parent_instance’ has incomplete type
  GSimpleAction parent_instance;
                ^
/home/chaz/Desktop/test.c:28:2: error: unknown type name ‘GSimpleActionClass’
  GSimpleActionClass parent_class;
  ^
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)

The resulting .c file appears to be correct; the problem is that the proper definitions aren't in gsimpleaction.h (or giotypes.h, not sure which) to enable something to subclass GSimpleAction in the usual way.

I'd argue that it's worthy of being able to subclass: I want "the obvious simple implementation of the GAction interface", but with a bit of added behavior in the code I'm working on.  It'd be a pain to have to re-implement most of GAction myself, just to make a few tweaks.
Comment 1 Matthias Clasen 2013-12-11 00:52:58 UTC
I don't think GSimpleAction is meant to be subclassed
Comment 2 Evan Nemerson 2013-12-11 02:02:55 UTC
Yeah, that's what desrt said on IRC, too.  We should probably add a final keyword or some kind of annotation to vala (bug #669541), but I think this bug can be closed… taking care of #669541 should resolve this as well from Vala's POV since hopefully we'll be able to detect these cases automatically.
Comment 3 Allison Karlitskaya (desrt) 2013-12-11 03:44:34 UTC

*** This bug has been marked as a duplicate of bug 669541 ***