FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

What to pass to gobject Signals.stopEmissionByName?

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
Dubhead



Joined: 08 Sep 2008
Posts: 4
Location: Tokyo, Japan

PostPosted: Tue Sep 09, 2008 9:15 pm    Post subject: What to pass to gobject Signals.stopEmissionByName? Reply with quote

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
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Wed Sep 10, 2008 12:17 pm    Post subject: Reply with quote

passing the Gtk struct should work.

Code:
TextBuffer buf_ = ...;
Signals.stopEmissionByName(buf_.getTextBufferStruct(), "insert-text");
Back to top
View user's profile Send private message
Dubhead



Joined: 08 Sep 2008
Posts: 4
Location: Tokyo, Japan

PostPosted: Wed Sep 10, 2008 8:41 pm    Post subject: Reply with quote

Mike Wey wrote:
passing the Gtk struct should work.

It worked, thank you!
Back to top
View user's profile Send private message
eldar



Joined: 14 Jun 2008
Posts: 101
Location: Ufa, Russia

PostPosted: Thu Sep 11, 2008 12:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Fri Sep 12, 2008 1:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group