DBus, sandboxes, REPLs, Life
May 10, 2009
This is probably going to read very fragmented…I’ve been coding all day and can’t really think right now.
DBus
So. first off, after spending all day porting code from the GJS module…
#!/usr/local/bin/seed DBus = imports.dbus; GLib = imports.gi.GLib; function PlayerEngine() { this._init(); } 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(); proxy.OpenRemote(Seed.argv[2]); proxy.PlayRemote(function(){ Seed.print("proxy.PlayRemote returned"); Seed.quit(); }); mainloop = GLib.main_loop_new(); GLib.main_loop_run(mainloop);
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.
Life
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.
May 10, 2009 at 1:56 pm
[…] Robert Carr added a D-Bus module to Seed, he wrote about it in DBus, sandboxes, REPLs, Life. […]
May 11, 2009 at 8:55 am
By the way, what’s “#!/usr/local/bin/seed”. Looks like some form of ECMAscript or maybe even Vala.
May 11, 2009 at 7:08 pm
http://live.gnome.org/Seed
It’s ECMA/JavaScript from WebKit’s JavaScriptCore.