This is the mail archive of the guile-gtk@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gtk-clist-append does not work with shared substrings


Marius Vollmer <mvo@zagadka.ping.de> writes:

> "Greg J. Badros" <gjb@cs.washington.edu> writes:
> 
> > Whereas this works:
> > ;; (gtk-clist-append clist (list "foo" "bar"))
> > 
> > This does not:
> > 
> > ;; (gtk-clist-append clist (list (make-shared-substring "foo") "bar"))
> 
> Hmm, I get:
> 
>     guile> (use-modules (gtk gtk))
>     guile> (define clist (gtk-clist-new 2))
>     guile> (gtk-clist-append clist (list "foo" "bar"))
>     0
>     guile> (gtk-clist-append clist (list (make-shared-substring "foo") "bar"))
>     1
>     guile>
> 
> Maybe I'm using the wrong Guile version.  Shared substrings should be
> converted to normal strings via the `sgtk_string_conversion' function.
> It has this definition:
> 
>     SCM
>     sgtk_string_conversion (SCM str)
>     {
>       if (SCM_NIMP (str) && SCM_STRINGP (str))
>         SCM_COERCE_SUBSTR (str);
>       return str;
>     }

That's the same as mine.  I get the same *responses* as you, but the
CLIST is not populated with the correct strings.  Try this:

#!/usr/bin/guile -s 
!#
(use-modules (gtk gtk))
(define w (gtk-window-new 'dialog))
(define clist (gtk-clist-new-with-titles (list "first" "second")))
(define vbox (gtk-vbox-new #f 5))
(gtk-box-pack-start vbox clist)
(gtk-container-add w vbox)
(gtk-clist-append clist (list "foo" "bar"))
(gtk-clist-append clist (list (make-shared-substring "foo") "bar"))
(gtk-widget-show-all w)
(gtk-standalone-main w)

I get the second row, first column being empty, when I expect it should
have "foo" in it.

> There is likely something wrong with the way conversions are handled
> for composite types, like the list you are using.

I get both columns empty when I use make-shared-substring on both
elements of the list.

> > Also, I don't think there's any way to tell which version of guile-gtk
> > you're linked against.  `guile-gtk-version' is a nice primitive to add.
> 
> There is the (gtk config) module which contains config information.
> It even has a `gtkconf-version' entry but that reflects the version of
> Gtk+ that this guile-gtk is build for.  I think we should change that
> to be the guile-gtk version and add explicit support for the Gtk+
> version in use.  This should come from (gtk dynlink) as that module
> knows which library has been dynlinked (guile-gtk-1.2 or
> guile-gtk-1.3).  Ariel?

Right-- I may care about which GTk+, but I'm more likely to care about
which guile-gtk.  We need both, and only the former is available.

Greg

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]