This is probably going to read very fragmented…I’ve been coding all day and can’t really think right now.


So. first off, after spending all day porting code from the GJS module…

DBus = imports.dbus;
GLib =;

function PlayerEngine() {

PlayerEngine.prototype = {
    _init: function() {
	DBus.session.proxifyObject (this, 'org.bansheeproject.Banshee','/org/bansheeproject/Banshee/PlayerEngine');

var PlayerEngineIface = {
    name: 'org.bansheeproject.Banshee.PlayerEngine',
    methods: [{name:'Play', inSignature: ''},
	      {name:'Open', inSignature: 's'}],

DBus.proxifyPrototype (PlayerEngine.prototype, PlayerEngineIface);

proxy = new PlayerEngine();
    Seed.print("proxy.PlayRemote returned");

mainloop = GLib.main_loop_new();

It’s pretty fun! Server side part is almost done also (and is really entirely trivial to use API wise…). Big thanks to everyone working on GJS, as a significant portion of the code between the GJS/Seed DBus bindings is shared (and the rest is modeled after the GJS bindings).

Sandboxes and REPLs

Seed also got a REPL with multiline input (like python)

> if (a == 3){
..  Seed.print("a is three!");

It makes it a lot easier to mess around with things, and is just one of those things that seems kind of necessary to have. I also added a “sandbox” module to Seed, which lets you create a (very lightweight) context with a new global object, and you can control what you expose to it, and evaluate code in that context, it’s pretty neat because the default global object has more or less nothing exposed, so you can safely evaluate more or less anything.


This is the obligatory life section of a blog post…I’m hope from RPI for a month, so right now I don’t have one. I do miss everyone though.

Random Updates

April 25, 2009

Random Seed update.

Quite a few bugs have been fixed since the last Seed release, including some build system improvements, some memory improvements, a few consistency things with how things are mapped, updated examples, some big optimizations to the GObject subclassing code, and a few bugfixes in the new imports sytem.

For some reason this morning I woke up and wrote some documentation something describing how things are mapped when importing namespaces in Seed, as this is one of the most common questions I get. I think, someone who has already programmed with Gtk in C, etc…should be able to install Seed, read this, and then start coding in Seed.

In light of all this, I’m hoping to make a 0.5.5 release in the next week (or maybe delaying a bit if a GObject-introspection release is coming soon). I made a mistake releasing 0.5 depending on introspection from GIT.


I’m trying to use twitter lately, and it’s kind of fun, follow me!

Random Life update

School is almost over for the year, a little hard to imagine I am halfway done with undergrad…this is looking to be a great summer though.

Primarily I’m going to be staying in Troy, which should be really exciting, and living in an apartment by myself will be a new experience.

I’ll be in Barcelona for UDS Karmic (from around May 24-30th), really looking forward to this.

Also hoping to be able to go to Gran Canaria for the desktop summit…but this is still a little up in the air. If I do end up going I have to find a roommate. I’d kind of like to speak about Seed, but missed the deadline for registering to talk (not knowing if I was going to be able to go) and I hope if I do end up going I can work something out.

I’m going to have a lot of time to work on various GNOME things this summer, so maybe some of my old shelved projects will get finished

Hello world!

April 20, 2009

Welcome to GNOME Blogs. If you are the owner of this brand new blog, you can start posting right now!

Seed documentation

April 17, 2009

I just found out I have a public_html folder on, so I took a little bit of time to update some of the Seed documentation and throw it online.

Right now it’s just a somewhat outdated tutorial, some disorganized gtk-doc, and some documentation on the Seed builtins, but I think it’s a good start.

Before the next Seed release, I really want to take some time to write a lot more documentation, as I think Seed could be a good opportunity to introduce a lot of people to developing on top of the GNOME platform. I’d also like to put a lot of the examples online, but I have to think of the best way to do this.

Seed 0.5 Released

April 16, 2009

Seed 0.5 release just hit (finally).

Tarballs are at

Lots of cool stuff here, and everyone should definitely upgrade as soon as possible. There’s a ChangeLog and all sorts of propoganda on the appropriate mailing lists for interested parties.

Some Seed updates

April 13, 2009

I haven’t blogged much recently, but I put a lot of work in to Seed this weekend and thought I would discuss some of the changes.

New imports system
First I should note that the design of this is pretty much lifted from gjs, and the two implementations should be compatible. I do however think, it’s a very cool system, even if a bit unorthodox.

People who have used Seed would recognize that the two primary methods of importing things are
For importing libraries and native modules and
for importing files.

This however was pretty ridden with problems, notably:

  • Importing GI namespaces had no sort of cache, so multiple files including eachother can’t all import the namespaces they need, one central file would have to import them all and the others rely on that
  • No search path for native modules
  • The including files, was merely evaluating the file in the context which was called, which could create a lot of scope issues, in particular when you have a lot of complex interdependencies in what files need from what.

So the new imports system works like this, and remedies most of these problems. There is a toplevel imports object, which itself has a “gi” property (the object) which handles importing libraries handled by introspection, and has a pretty simple set of semantics, notably the first attempt to access will return the module object for that library, and subsequent attempts will return the same object. You can set to a value to force GI to require that version of the library, so importing a library might now look like. = "0.8";
Clutter =;
Gtk =;

The exciting part is really the handling of native modules and files, there is an imports.searchPath property which is set to an array of directories used to search for files/modules. An attempt to access will now look for “name.*” in search path, and behave as follows:

  • If the found file is a native module, import it and return the module object
  • If the found file is a regular file, attempt to evaluate it as a JavaScript file in a new context, and return the global object for that context. Unless the file has already been imported, then return the global object from the last import
  • If the found file is a folder, return a special object which works like the “imports” object for that folder

So, importing files is now much nicer, i.e.
BrowserView = imports.browser.BrowserView
and then you could access the toplevel contents of the file “browser/BrowserView.js”, through the BrowserView object. This has a lot of advantages, notably any file that needs anything in BrowserView can do this, without having to worry about scope, or overlap with other files that might include it.

All in all I think this is a really big improvement to the maintainability of large programs, and makes it feel like there is much more of a real module system. In addition this should make it pretty possible to port GNOME Shell to Seed, and this is something I will be looking in to.

OS module
There are a lot of low level unix functions not provided by GLib, which might still be useful under Seed, and to that account I’ve taken to reimplementing a large subset of the python “os” module, attempting to preserve semantics where it makes sense, for familiarity purposes. This should be nice for increasing the scope of where Seed is useful, but it’s really boring work…which should hopefully be finished over the next week or so.

The canvas module has a pretty large subset of canvas implemented now, and properly handles saving/restoring state. I’m hoping to implement gradients and a few other missing things within the next few days.

I am still working on DBus bindings, this is slow work, and will be done eventually :P. A lot of work got done recently though, and hopefully should be ready to go in GIT soon.

New Release
After these changes, the goal is to put out a release within the next few days, as soon as someone can find time to update documentation, all the examples, etc…

On top of this there have been all the usual bugfixes, optimizations, and small features, so I definitely encourage anyone interested and using the last release to start investigating GIT. There will be a lot more reorganization of the builtin functions (on the Seed global object) over the next few days, with the goal of eliminating (or eliminating for most code) the requirement of this object, and I suppose this will break most code out there, but I think it’s definitely necessary changes for presenting a more “mature” interface in a sense.


March 18, 2009

I’ve been throwing around a little code inbetween personal projects lately that I use for debugging, and maybe it will be useful for a few other people also.

Essentially it’s a few functions and macros to pretty-print enums and structs based on introspection data, and then also a few convenience things to spawn REPLs to play with objects.

GEERIOS_PRINT_ENUM (GdkEventType, event->type)
GEERIOS_PRINT_STRUCT (GdkRectangle, rect)

repl = geerios_repl_new (ctx);

geerios_repl_add_object (repl, "button", button);

// later

geerois_repl_run (repl);

// Now you have a JavaScript REPL to play with the button object, connect signals, check properties, etc...

The code’s a mess, and probably just suited to being copy pasted around…but it’s been useful for me a few times, a nd I don’t have any intention to clean it up much in the near future. So here it is

Epiphany Seed Extensions

February 8, 2009

Epiphany Seed extensions landed today. It’s still a pretty rough/simple API, but also exciting! Thanks to chpe, and xan for doing a lot of the clean up work.

One of the neat things about this, is all the bindings around the Epiphany API, were generated automatically by GObject-introspection, which made all of this rather easy!

For those not familiar yet, Seed is a library to embed JavaScriptCore as a scripting language, and provide automatic bindings around any (almost) GObject library.

As a quick example, I thought I’d do a small write up on how to make an Epiphany Seed extension, notably something quick that pops up a dialog when you try and close more than one tab. Thanks to Tim for writing the extension.

First, a file describing the extension is required, this can go in

[Epiphany Extension]
Name=Don't Close Multiple Tabs
Description=Warns the user before closing a window containing multiple open tabs.
Authors=Tim Horton


This is all pretty straightforward I think, now when loading the extension, epiphany will look for “close-multiple-tabs.js” in the extensions directory (or a system extension directory).

The script should be a JavaScript file that returns an object containing several hook functions (attach window, detach tab, things like this). As the last thing evaluated is returned in JavaScript, the hello world extension could look like:

extension = {
   attach_window: function (window){
         Seed.print("Hello World!");

With window being an EphyWindow object, which has all the useful methods from the epiphany API to write extensions. So, if we were actually trying to write our extension, we might do something like this:

function delete_event(window, event) {
	var n = window.get_notebook();
	if(n.get_n_pages() <= 1)
		return false;

        // Properties can be set in constructors with JSON synax.
	var dialog = new Gtk.MessageDialog({text:"You are about to close a window with " + n.get_n_pages() + " open tabs.", message_type:Gtk.MessageType.WARNING });
	dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL).grab_focus();
	dialog.add_button(Gtk.STOCK_OK, Gtk.ResponseType.OK);

	var result =;

	if(result == Gtk.ResponseType.OK)
		return false;
		return true;

extension = {
    attach_window: function(window) {
		signal = window.signal.delete_event.connect(delete_event);

This extension and one more (unlimited undo of Tab close) are available at (for now)

Hopefully for the benefit of anyone else trying to make GNUS work with
emacs-snapshot, the useful and obscure (and strangely absent from
google) error message "Invalid size: gnus-carpals" means that your emacs
is too new for your GNUs.

I’ve switched to using GNUS to read my mail now, as I am not a big fan
of the GMAIL web interface, or thunderbird/evolution (though Thunderbird
3 seems promising!), this should be an…interesting experiment to say
the least, hopefully I do a better job of keeping up on my mail now.

I’ve also started organizing a TODO list of sorts with org-mode
( any Emacs users who like me have
significant difficulty organizing their lives, might want to look in to
this, it seems really nice so far. I’m also hoping to use it for taking
notes during classes, and the embedded LaTeX + Tagging should be nice there.

In addition to my various long term and continuing projects, I’ve picked up a few new things this week…

Epiphany. Seed extensions.
After the Seed 0.3 release there was a bit of interest in developing a Seed based extension system for Epiphany WebKit, for (I think) obvious reasons. I threw together a prototype loader and fixed a few other things, and Tim helped by helping port extensions (So far we have an Undo tab close extension, and a confirm closing of multiple tabs extension).

The early results are at:
git clone

The interface could still use a bit of work, and in the repository is a patch to gir-repository to build a gir for the Epiphany functions, however this not crashing requires a patch to introspection which I’m still working on upstreaming (also in the git tree if anyone is desperate to try it. gir.patch and gi.patch).

Will put some more work in to this later in the week.

Clutter 0.9 Fun. Tetris and Same.
Tim and I are working on a project making…gratuitous use of Clutter, and so stemming from a desire to both learn the new 0.9 API, and write some Seed examples for it, so we wrote a few small games as examples last night.

Same Gnome Clone – In Seed! from Tim Horton on Vimeo.

Tetris from Robert Carr on Vimeo.

The funny part about the Tetris game is it’s actually built in Seed around a libtetris written in Vala, the client itself is only about 120 lines of Seed script. The new Clutter implicit animation API made it easy to write.

Both of these are in Seed SVN in examples/, but either working on anyone else’s machine is dependent on a Clutter patch which I’ll post to Clutter bugzilla later today. In the meantime check out the videos. Clutter is fun

After seeing the “Do-ifying” GTK post, I decided to make a GTK module (which I am calling “Magic”) that exposes the GTKUImanager hierarchies for an application over DBus. This has been interesting to work on as I’ve been using eggdbus which has in general been a pretty good experience.

I got a basic outline working (list actions, activate action by group/name), but I want to work on the interface a bit more before I post anything.

Hopefully with some extra application tracking, this could allow you to use Do to interact with your current application (with actions like “Save as”, “New tab”, or maybe your five most recent documents names, all being available as Do actions depending on your context).

I’ve been warned that I may be creating AppleScript for GTK. Oops?