View previous topic :: View next topic |
Author |
Message |
Dubhead
Joined: 08 Sep 2008 Posts: 4 Location: Tokyo, Japan
|
Posted: Tue Sep 09, 2008 9:15 pm Post subject: What to pass to gobject Signals.stopEmissionByName? |
|
|
Hi,
I'm trying to disable TextBuffer's default handler for "insert-text" events,
along the lines of http://library.gnome.org/devel/gtk-faq/stable/x842.html
and I can't find out what to pass to stopEmissionByName().
This code compiles...
Code: |
TextBuffer buf_ = ...;
Signals.stopEmissionByName(&buf_, "insert-text");
|
but gives runtime errors
Code: |
(editor:6421): GLib-GObject-WARNING **: instance of invalid non-instantiatable type `(null)'
(editor:6421): GLib-GObject-CRITICAL **: g_signal_stop_emission_by_name: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed
|
I have tried a few casts of buf_, but they all failed with similar runtime errors.
Any help appreciated. |
|
Back to top |
|
|
Mike Wey
Joined: 07 May 2007 Posts: 428
|
Posted: Wed Sep 10, 2008 12:17 pm Post subject: |
|
|
passing the Gtk struct should work.
Code: | TextBuffer buf_ = ...;
Signals.stopEmissionByName(buf_.getTextBufferStruct(), "insert-text"); |
|
|
Back to top |
|
|
Dubhead
Joined: 08 Sep 2008 Posts: 4 Location: Tokyo, Japan
|
Posted: Wed Sep 10, 2008 8:41 pm Post subject: |
|
|
Mike Wey wrote: | passing the Gtk struct should work. |
It worked, thank you! |
|
Back to top |
|
|
eldar
Joined: 14 Jun 2008 Posts: 101 Location: Ufa, Russia
|
Posted: Thu Sep 11, 2008 12:39 pm Post subject: |
|
|
Maybe I am wrong - but I think public API of OOP binding doesn't have to contain structures as parameters(as any low-level gtk-stuff). So in this case it should use directly class reference:
stopEmissionByName(TextBuffer, char[])
As well as wrap signal's names.. |
|
Back to top |
|
|
Mike Wey
Joined: 07 May 2007 Posts: 428
|
Posted: Fri Sep 12, 2008 1:27 pm Post subject: |
|
|
That is the goal. but most of the Signal functions are documented as accepting a pointer instead of a base class like GObject, one reason for this i can think of is, that for an instance to be able to use the signals it doesn't have to be derived from GObject.
a function like: stopEmissionByName(ObjectG, char[]); should be able to accept a lot of the GtkD classes with Signals, but it might not accept all of them. |
|
Back to top |
|
|
|