Category Archives: example code

Gtk.ListStores and Clutter.ListModels in Javascript/gjs

It’s surprisingly hard to find this, and the generated documentation is actually misleaingly wrong1, so here’s how to create ListStores and ListModels in Javascript with gjs. let store = new Gtk.ListStore(); store.set_column_types([GObject.TYPE_STRING, GObject.TYPE_INT]); store.insert_with_valuesv(-1, [ 0, 1 ], [ "test", … Continue reading

Posted in clutter, example code, gtk, javascript | 1 Comment

LD_PRELOAD GObject lifetime debugging tool

For years and years I’ve dreamt of a tool that would show me what GObjects are currently alive, and let me have a look at information about them. Today, while trying to debug a particularly horrid reference leak (program wedged … Continue reading

Posted in c, collabora, example code, programming, telepathy, work | 11 Comments

making my C more like Python

Asynchronous programming in C can be such a pain. You’re always creating little structs in order to pass around user_data. So often I find myself wishing it were like Python, and I could just create an anonymous tuple. Then I … Continue reading

Posted in c, example code, programming | 9 Comments

higher level channel requesting in telepathy-glib

Thanks to the awesome work of Guillaume, telepathy-glib 0.11.12 now includes high-level API for requesting communications channels via Mission Control (the Channel Dispatcher). API is provided both for channels you wish to handle, or channels you want someone else to … Continue reading

Posted in example code, programming, telepathy | Comments Off

g_variant_equal() and dictionaries

For anyone using g_variant_equal() with a type containing a dictionary, you should the aware that, somewhat unexpectedly in my opinion, g_variant_equal() only returns true if (and only if) the keys in the dictionary are in the same order (GVariant implements … Continue reading

Posted in example code, gvariant, hacking, programming, work | 2 Comments

introspecting tp-glib and converting DBus-GLib GValues to GVariants

Telepathy is a modular framework. At the very heart of Telepathy there is a specification that describes how the various connection managers, clients and other components interact with each other. The specification is written in terms of a set of … Continue reading

Posted in c, example code, gobject-introspection, hacking, programming, telepathy, work | Comments Off

telepathy-glib GObject-Introspection and TpBaseClient

In Telepathy libraries such as telepathy-glib, telepathy-python and telepathy-qt4 there are two kinds of API. There's what we call low-level API, which is a direct wrapping of the D-Bus API exposed by Telepathy components and automatically generated from the Telepathy … Continue reading

Posted in example code, gobject-introspection, hacking, javascript, telepathy, work | Comments Off

a Telepathy blinkenlights "plugin"

A request that people occasionally make is that they would like a “blinkenlights” plugin for Empathy, similar to the one for Pidgin. The nice thing about using Telepathy, is that for any case where we simply want to observe the … Continue reading

Posted in example code, telepathy, work | 1 Comment

a threaded processing queue in PyGTK

I'm currently writing a PyGTK client that needs to make network requests using a library that doesn't integrate with the GLib mainloop (python-suds), so I found myself wanting to be able to make network requests without blocking the mainloop, and … Continue reading

Posted in example code, hacking, maemo, python, threading | Comments Off