spk121 / guile-gi

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

Can't find g_markup_escape_text and g_markup_printf_escaped #91

Closed daym closed 3 years ago

daym commented 3 years ago

Hi,

I can't seem to find g_markup_escape_text and g_markup_printf_escaped (both in GLib-2.0.gir) in guile-gi.

It's necessary to use GtkTreeView's tooltip-column, because the tooltip text one uses in the tree store column is supposed to be pango markup.

Where is it?

LordYuuma commented 3 years ago

markup-escape-text should be exported by GLib 2.0. g_markup_printf_escaped is likely ignored due to it being a varargs function.

daym commented 3 years ago

How do I import the former? I tried

(use-typelibs (("GLib" "2.0")))

where i get

unknown location: ...: bad use of '...' syntactic keyword in subform ... of ...

and

  (require "GObject" "2.0")
  (require "GLib" "2.0")
  ;(require "GdkPixbuf" "2.0")
  (require "Gio" "2.0")
  (require "Gtk" "3.0")
  (load-by-name "Gio" "Application")
  (load-by-name "Gio" "ApplicationFlags")

  (for-each
   (cute load-by-name "Gtk" <>)
   '("TreeStore" "TreeModel" "TreeIter")))

which doesn't make it appear.

LordYuuma commented 3 years ago

You have a layer of brackets too many in your use-typelibs call, probably? Not sure if I went wrong with my syntax somewhere.

Try (load-by-name "GLib" "markup_escape_text").

daym commented 3 years ago

Thanks! I tried removing the extra parentheses, to make it (use-typelibs ("GLib" "2.0")): I get exactly the same error message (maybe I'm missing use-typelibs macro?).

The latter does work, thanks.

LordYuuma commented 3 years ago

use-typelibs should be exported by (gi), so you should have it. If you have a MWE (please also try macroexpanding it), open a separate issue for use-typelibs. I'll close this issue as the g_markup part seems to be resolved.

daym commented 3 years ago

Yes, that works just fine with (load-by-name "GLib" "markup_escape_text"). Thanks!

If you are curious, check out https://gitlab.com/daym/guix-gui/-/blob/002e931232c818f9100b5ea622a52bd6b20b9a0e/guixgui/manifests.scm at the top for where and how I use it.

LordYuuma commented 3 years ago

A GUI for GNU Guix? You are a hero.

daym commented 3 years ago

Thanks!

Yeah, it has always bothered me that Guix doesn't have it. I mean distributions in 2005 had that :P

Then I remembered that I'm a programmer and that I can change that ;)

Even with my tiny preliminary gui I feel much better already: I can see the contents of a profile, and I can search for available packages.

Soon I'll be able to add and remove packages to the profile etc.