spk121 / guile-gi

Bindings for GObject Introspection and libgirepository for Guile
GNU General Public License v3.0
58 stars 7 forks source link

initialization of a variable meant to be GtkTreeModel #127

Open andy-tai opened 2 years ago

andy-tai commented 2 years ago

mail list thread: https://lists.gnu.org/archive/html/guile-user/2022-06/msg00024.html

how to initialize a variable meant to be a GtkTreeModel, a Gtk "interface"?

(selection is a valid GtkTreeSelection obtained elsewhere earlier) This does not work (the second line would result in error):

(let ((iter (make <GtkTreeIter>))
  (model (make <GtkTreeModel>)))
  (define selected (tree-selection:get-selected! selection model iter))

This does not work either, error out on the second line:

(let ((iter (make <GtkTreeIter>))
  (model (make <GtkListStore>)))
  (define selected (tree-selection:get-selected! selection model iter))

as GtkListStore implements GtkTreeModel but GOOPS says GtkListStore is not the expected type for the second argument