Gtk connection methods

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Gtk connection methods

MrGwen
Hi Paolo,

again a small patch to improve Gtk binding :).
Just raises an exception if the connection doesn't work.

Gwen

diff --git a/packages/gtk/MoreFuncs.st b/packages/gtk/MoreFuncs.st
index a07ae29..9f17a8a 100644
--- a/packages/gtk/MoreFuncs.st
+++ b/packages/gtk/MoreFuncs.st
@@ -57,6 +57,24 @@ GLib class extend [
 ^L
 GObject extend [

+    connect: name to: handler selector: sel userData: userData [
+       <category: 'C call-outs'>
+
+       | result |
+       (result := self connectSignal: name to: handler selector: sel
userData: userData).
+       result == -1 ifTrue: [ self error: 'Invalid widget passed' ].
+       result == -2 ifTrue: [ self error: 'Invalid event name' ].
+       result == -3 ifTrue: [ self error: 'Invalid selector' ].
+       result == -4 ifTrue: [ self error: 'Too much arguments' ].
+       ^ result
+    ]
+
+    connect: name to: handler selector: sel [
+       <category: 'C call-outs'>
+
+       ^ self connect: name to: handler selector: self userData: nil
+    ]
+
     connectSignal: name to: handler selector: sel userData: userData [
        <category: 'C call-outs'>
        <cCall: 'gstGtkConnectSignal' returning: #int




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Gtk connection methods

Paolo Bonzini-2
On 01/09/2010 11:42 AM, Gwenael Casaccio wrote:
> Hi Paolo,
>
> again a small patch to improve Gtk binding :).

True.

> Just raises an exception if the connection doesn't work.

Please adjust all callers too. :-)

> +       result == -4 ifTrue: [ self error: 'Too much arguments' ].

"Too many"

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Gtk connection methods

MrGwen
On Sat, 2010-01-09 at 11:53 +0100, Paolo Bonzini wrote:

> On 01/09/2010 11:42 AM, Gwenael Casaccio wrote:
> > Hi Paolo,
> >
> > again a small patch to improve Gtk binding :).
>
> True.
>
> > Just raises an exception if the connection doesn't work.
>
> Please adjust all callers too. :-)

:)

>
> > +       result == -4 ifTrue: [ self error: 'Too much arguments' ].
>
> "Too many"
>
Oups

> Paolo
>

Also can we extend connect with blocks instead of message passing ?


>
> _______________________________________________
> help-smalltalk mailing list
> [hidden email]
> http://lists.gnu.org/mailman/listinfo/help-smalltalk




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Gtk connection methods

MrGwen
On Sat, 2010-01-09 at 11:58 +0100, Gwenael Casaccio wrote:

> On Sat, 2010-01-09 at 11:53 +0100, Paolo Bonzini wrote:
> > On 01/09/2010 11:42 AM, Gwenael Casaccio wrote:
> > > Hi Paolo,
> > >
> > > again a small patch to improve Gtk binding :).
> >
> > True.
> >
> > > Just raises an exception if the connection doesn't work.
> >
> > Please adjust all callers too. :-)
>
> :)
>

Or simply rename your connectSignal... as primConnectSignal and rename
my connect: as connectSignal: :D

> >
> > > +       result == -4 ifTrue: [ self error: 'Too much arguments' ].
> >
> > "Too many"
> >
> Oups
>
> > Paolo
> >
>
> Also can we extend connect with blocks instead of message passing ?
>
>
> >
> > _______________________________________________
> > help-smalltalk mailing list
> > [hidden email]
> > http://lists.gnu.org/mailman/listinfo/help-smalltalk
>
>




_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Gtk connection methods

Paolo Bonzini-2
On 01/09/2010 11:59 AM, Gwenael Casaccio wrote:
>>> >  >
>>> >  >  Please adjust all callers too.:-)
>> >
>> >  :)
>> >
> Or simply rename your connectSignal... as primConnectSignal and rename
> my connect: as connectSignal: :D

Sure.

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk