Allow non-string types as a signal's detail
@ban
Submitted by Colomban Wendling Link to original bug (#653405)
Description
Currently, only strings can be used as the detail part of a signal. However, it would be convenient to be able to directly use integers (and even enumerations) without the need to manually call the to_string() method of these objects.
For example, I'd find very convenient to be able to write something like this:
class Foo { public enum EventType { ONE, TWO, TREE }
[Signal (detailed = true)] public delegate void some_signal ();
public void action_one () { /* ... */ some_signal[EventType.ONE] (); }
/* ... */ }
public void main () { foo = new Foo (); foo.some_signal[Foo.EventType.ONE].connect (() => print ("hello!\n")); }
This is currently doable, but needs to manually use to_string() on each detail argument, which is quite inconvenient and makes the thing way less readable.
The C mapping would either be a string representing the simple integer, or better, the enumeration name (if it is an enumeration):
g_signal_connect (self, "some-signal::FOO_EVENT_TYPE_ONE", /* ... */);
Version: 0.12.x