From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan Nieuwenhuizen Newsgroups: gmane.lisp.guile.gtk,gmane.lisp.guile.user Subject: [PATCH]: gobject: also loop args after #:gsignal. Fixes multiple signals per class. Date: Thu, 04 Apr 2013 11:04:37 +0200 Organization: AvatarAcademy.nl Message-ID: <878v4yu0nu.fsf@nlvehvbe01nb29b.ddns.nl-htc01.nxp.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1365066303 22329 80.91.229.3 (4 Apr 2013 09:05:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Apr 2013 09:05:03 +0000 (UTC) Cc: guile-user To: guile-gtk-general Original-X-From: guile-gtk-general-bounces+glgg-guile-gtk-general=m.gmane.org@gnu.org Thu Apr 04 11:05:24 2013 Return-path: Envelope-to: glgg-guile-gtk-general@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UNg6k-0008Mu-Hv for glgg-guile-gtk-general@m.gmane.org; Thu, 04 Apr 2013 11:05:22 +0200 Original-Received: from localhost ([::1]:38081 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNg6L-0007YG-Nh for glgg-guile-gtk-general@m.gmane.org; Thu, 04 Apr 2013 05:04:57 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNg69-0007OB-F5 for guile-gtk-general@gnu.org; Thu, 04 Apr 2013 05:04:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNg64-0007QX-6p for guile-gtk-general@gnu.org; Thu, 04 Apr 2013 05:04:45 -0400 Original-Received: from smtp-vbr6.xs4all.nl ([194.109.24.26]:4579) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNg63-0007QM-Uf; Thu, 04 Apr 2013 05:04:40 -0400 Original-Received: from nlvehvbe01nb29b.ddns.nl-htc01.nxp.com.peder.onsbrabantnet.nl (static.ip-80-255-245-177.signet.nl [80.255.245.177]) (authenticated bits=0) by smtp-vbr6.xs4all.nl (8.13.8/8.13.8) with ESMTP id r3494cDN030152 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 4 Apr 2013 11:04:39 +0200 (CEST) (envelope-from janneke@gnu.org) X-Url: http://AvatarAcademy.nl User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) X-Virus-Scanned: by XS4ALL Virus Scanner X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 194.109.24.26 X-BeenThere: guile-gtk-general@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General discussions about guile-gtk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-gtk-general-bounces+glgg-guile-gtk-general=m.gmane.org@gnu.org Original-Sender: guile-gtk-general-bounces+glgg-guile-gtk-general=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.gtk:1052 gmane.lisp.guile.user:10227 Archived-At: --=-=-= Content-Type: text/plain Hi, I suggest these patches. Until then, I'm using inheritance and define one signal per class. Greetings, Jan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-gobject-also-loop-args-after-gsignal.-Fixes-multiple.patch >From e06d6364c5776183a98a4e69d34d237736388327 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 4 Apr 2013 10:56:57 +0200 Subject: [PATCH 1/2] gobject: also loop args after #:gsignal. Fixes multiple signals per class. That is, running tic-tac-toe with this patch below now works. diff --git a/gtk/examples/tic-tac-toe.scm b/gtk/examples/tic-tac-toe.scm index 93e323b..8c67896 100644 --- a/gtk/examples/tic-tac-toe.scm +++ b/gtk/examples/tic-tac-toe.scm @@ -34,6 +34,9 @@ exec guile-gnome-2 -s $0 "$@" buttons winning-combinations + ;; adding foo-bar-baz signal breaks tic-tac-toe with + ;; ERROR: Throw to key `gruntime-error' with args `("gsignal-query" "Unknown signal ~A on class ~A" (tic-tac-toe #< >) ())'. + :gsignal '(foo-bar-baz #f) :gsignal '(tic-tac-toe #f)) (define (ttt-clear ttt) @@ -119,6 +122,7 @@ exec guile-gnome-2 -s $0 "$@" (show-all w) (g-timeout-add 100 (lambda () #t)) (connect ttt 'tic-tac-toe (lambda (ttt) (display "Yay!\n"))) + (connect ttt 'foo-bar-baz (lambda (ttt) (display "Nay!\n"))) (connect w 'delete-event (lambda (ttt e) (gtk-main-quit) #f))) (gtk-main) --- glib/gnome/gobject/gobject.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glib/gnome/gobject/gobject.scm b/glib/gnome/gobject/gobject.scm index 3e5f07d..ad6abed 100644 --- a/glib/gnome/gobject/gobject.scm +++ b/glib/gnome/gobject/gobject.scm @@ -131,7 +131,7 @@ (define (install-signals!) ;; We parse a #:gsignal initialization argument to install signals. (let loop ((args initargs)) - (if (not (null? args)) + (when (not (null? args)) (if (eq? (car args) #:gsignal) (let ((signal (cadr args))) (if (not (and (list? signal) (>= (length signal) 2))) @@ -142,8 +142,8 @@ (generic (gtype-class-create-signal class name return-type param-types))) ;; Some magic to define the generic (module-define! (current-module) - (generic-function-name generic) generic))) - (loop (cddr args)))))) + (generic-function-name generic) generic)))) + (loop (cddr args))))) (define (first pred list) (cond ((null? list) #f) -- 1.7.10.4 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0002-gobject-whitespace-adjustment.patch >From ec9328acaf2b3c8ae9df03a891465a53fbae0c9f Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 4 Apr 2013 10:58:43 +0200 Subject: [PATCH 2/2] gobject: whitespace adjustment. --- glib/gnome/gobject/gobject.scm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/glib/gnome/gobject/gobject.scm b/glib/gnome/gobject/gobject.scm index ad6abed..a235bbf 100644 --- a/glib/gnome/gobject/gobject.scm +++ b/glib/gnome/gobject/gobject.scm @@ -132,18 +132,18 @@ ;; We parse a #:gsignal initialization argument to install signals. (let loop ((args initargs)) (when (not (null? args)) - (if (eq? (car args) #:gsignal) - (let ((signal (cadr args))) - (if (not (and (list? signal) (>= (length signal) 2))) - (gruntime-error "Invalid signal specification: ~A" signal)) - (let* ((name (car signal)) - (return-type (cadr signal)) - (param-types (cddr signal)) - (generic (gtype-class-create-signal class name return-type param-types))) - ;; Some magic to define the generic - (module-define! (current-module) - (generic-function-name generic) generic)))) - (loop (cddr args))))) + (if (eq? (car args) #:gsignal) + (let ((signal (cadr args))) + (if (not (and (list? signal) (>= (length signal) 2))) + (gruntime-error "Invalid signal specification: ~A" signal)) + (let* ((name (car signal)) + (return-type (cadr signal)) + (param-types (cddr signal)) + (generic (gtype-class-create-signal class name return-type param-types))) + ;; Some magic to define the generic + (module-define! (current-module) + (generic-function-name generic) generic)))) + (loop (cddr args))))) (define (first pred list) (cond ((null? list) #f) -- 1.7.10.4 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.nl= =20=20 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ guile-gtk-general mailing list guile-gtk-general@gnu.org https://lists.gnu.org/mailman/listinfo/guile-gtk-general --=-=-=--