Category Archives: javascript

classes, interfaces and properties in Javascript/gjs

Thought I’d share some more Javascript snippets with you zany kids. Firstly, how to implement an interface (specifically a GInterface), for example an Mx.ItemFactory: const ButtonFactory = new Lang.Class({ Name: ‘ButtonFactory’, Extends: GObject.Object, Implements: [ Mx.ItemFactory ],   _init : … Continue reading

Posted in javascript | 6 Comments

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

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