Skip to content

Instantly share code, notes, and snippets.

@donadigo
Forked from matzipan/cheatsheet.md
Last active June 5, 2018 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donadigo/9a003c88343515ceadf81b3fd3ced3e9 to your computer and use it in GitHub Desktop.
Save donadigo/9a003c88343515ceadf81b3fd3ced3e9 to your computer and use it in GitHub Desktop.
Vala, GLib and GTK+ cheatsheet

Enable debug messages

Set the following environment variable G_MESSAGES_DEBUG=all. This will allow you to see messages you print with debug in Vala.

Markup escaping

If you try and set_text on a Gtk.Label a string which might contain markup characters (<>&), you need to escape them first, using GLib.Markup.escape_text.

Path constructing

Instead of using standard string constructing method path_string1 + path_string2 you can use GLib.Path.build_filename method in order to construct a valid path to a file, for example: GLib.Path.build_filename (GLib.Environment.get_home_dir (), "folder1", "folder2").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment