Hi again,

        I reply to myself too :)

I realized while I was in a cafe without internet :) that I forgot to attach a
[simplified] glade file. I took this 'opportunity' to edit both mg-wgtk-3 and
mg-wgtk-4 so that there is one global to change to perform in these 2 files ...

So I decided to attach the all example set again, and the glade file, to 
facilitate
the work of who ever would like to try and debug ... 

        ->      'you' may forget the previous email, use the attachments of this
                one and the text below

Sorry about this,
Cheers,
David

;; --

Le Mon, 29 Aug 2011 14:05:18 -0300,
David Pirotte <da...@altosw.be> a écrit :

> Hi Andy,
> Ludovic,
> 
> > > I fixed it!
> > 
> > Thank you very much! The examples I sent earlier now all work, but I still 
> > have a
> > problem ...
> 
> I finally could reproduce the problem and wrote an example you can run 'in 
> the cafe
> without internet' :) [hopefully] 
> 
>       in addition to the comments here below, please note that these examples
>       further differs from previous 'versions' I sent in the passed in the 
> sense
>       that they now also use (gnome glade)
> 
> If you drop the attached somewhere in your %load-path, then you can try the
> following 2 tests, one which [here] produces a segfault and the other which
> works fine. The only 'important' difference between these 2 tests is 
> expressed by
> diff mg-wgtk-0 mg-wgtk-1:
> 
>       mg-wgtk-0 defines and export an additional slot which is named 
> glade-file
>       [which is then used by mg-wgtk-3 ...]
> 
> This should or crash guile or produce an error [the behavior of guile itself 
> is not
> systematic [here], but it always 'fails':
> 
>       mg-wgtk-3       uses    mg-wgtk-0
>                                               mg-wgtk-2
> 
>       guile-gnome-2
>       (use-modules (mg-wgtk-3))
>       (letstry)
>       ->      Top level dialog: #<<gtk-window> a2bbbc0>
>               Printing dialog: Segmentation fault
> 
> 
> This will work fine:
> 
>       mg-wgtk-4       uses    mg-wgtk-1
>                                               mg-wgtk-2
>       guile-gnome-2
>       (use-modules (mg-wgtk-4))
>       (letstry)
>       ->      Top level dialog: #<<gtk-window> 8b86c30>
>               Printing dialog: #<<gtk-dialog> 8b89110>
> 
> 
> Many thanks,
> David
> 
> 
(define-module (mg-wgtk-0)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome glade)
  :use-module (gnome gtk)

  :export (<tl-widget>
	   glade-file
	   dialog
	   
	   make-tl-widget
	   ))


(define-class <tl-widget> ()
  (glade-file :accessor glade-file :init-keyword :glade-file :init-value #f)
  (dialog :accessor dialog :init-keyword :dialog :init-value #f))

(define (make-tl-widget glade-f)
  (let* ((xmlc (glade-xml-new glade-f #f "kise"))
	 (tl-widget (make <tl-widget>
		      :glade-file glade-f
		      ;; :xml-code xmlc
		      :dialog (get-widget xmlc "kise"))))
    tl-widget))

(define-module (mg-wgtk-1)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome glade)
  :use-module (gnome gtk)

  :export (<tl-widget>
	   dialog
	   
	   make-tl-widget
	   ))


(define-class <tl-widget> ()
  (dialog :accessor dialog :init-keyword :dialog :init-value #f))

(define (make-tl-widget glade-f)
  (let* ((xmlc (glade-xml-new glade-f #f "kise"))
	 (tl-widget (make <tl-widget>
		      :dialog (get-widget xmlc "kise"))))
    tl-widget))

(define-module (mg-wgtk-2)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome glade)
  :use-module (gnome gtk)

  :export (<p-widget>
	    dialog

	    make-p-widget
	    ))


(define-class <p-widget> ()
  ;; (xml-code :accessor xml-code :init-keyword :xml-code :init-value #f)
  (dialog :accessor dialog :init-keyword :dialog :init-value #f))

(define (make-p-widget parent glade-f)
  (let* ((xmlc (glade-xml-new glade-f #f "kp/dialog"))
	 (p-widget (make <p-widget>
		     ;; :xml-code xmlc
		     :dialog (get-widget xmlc "kp/dialog"))))
    p-widget))

(define-module (mg-wgtk-3)
  :use-module (ice-9 format)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome gtk)

  :use-module (mg-wgtk-0)
  :use-module (mg-wgtk-2)

  :duplicates (merge-generics 
	       replace
	       warn-override-core
	       warn
	       last)

  :export (letstry
	   ))

;; you'll have to edit this before to run, according
;; to where you will have saved  'kise.exa.glade'
(define *glade-file* "/usr/alto/projects/kise/glade/kise.exa.glade")


(define (letstry)
  (let* ((tl (make-tl-widget *glade-file*))
	 (p (make-p-widget (dialog tl) (glade-file tl))))
    (format #t "Top level dialog: ~S~%" (dialog tl))
    (format #t "Printing dialog: ~S~%" (dialog p))))


#!

(use-modules (macros push))
(push! "/usr/local/share/guile/alto/2.0/tests"
       %load-path)

(use-modules (mg-wgtk-3))
(letstry)


;;;
;;; 2. using glade in mg-gtk-2 as well
;;;

(use-modules (mg-wgtk-3))
,m (mg-wgtk-3)

(define tl (make-tl-widget *glade-file*))
(define p (make-p-widget (dialog tl)
			 (glade-file tl)))
(dialog tl)
(dialog p)


!#
(define-module (mg-wgtk-4)
  :use-module (ice-9 format)
  :use-module (oop goops)
  :use-module (gnome gobject)
  :use-module (gnome gtk)

  :use-module (mg-wgtk-1)
  :use-module (mg-wgtk-2)

  :duplicates (merge-generics 
	       replace
	       warn-override-core
	       warn
	       last)

  :export (letstry
	   ))

;; you'll have to edit this before to run, according
;; to where you will have saved  'kise.exa.glade'
(define *glade-file* "/usr/alto/projects/kise/glade/kise.exa.glade")


(define (letstry)
  (let* ((tl (make-tl-widget *glade-file*))
	 (p (make-p-widget (dialog tl)
			   *glade-file*)))
    (format #t "Top level dialog: ~S~%" (dialog tl))
    (format #t "Printing dialog: ~S~%" (dialog p))))


#!

(use-modules (macros push))
(push! "/usr/local/share/guile/alto/2.0/tests"
       %load-path)

(use-modules (mg-wgtk-4))
(letstry)


;;;
;;;
;;;

(use-modules (mg-wgtk-4))
,m (mg-wgtk-4)

(define tl (make-tl-widget *glade-file*))
(define p (make-p-widget (dialog tl)
			 *glade-file*))

(dialog tl)
(dialog p)


!#

Attachment: kise.exa.glade
Description: application/glade

Reply via email to