Vala is great!
Ever since Jorn and Matthew mentioned the idea of Vala bindings for GUPnP, I have been eager to learn Vala and so this weekend I finally got around to introduce myself to it. It's really cool. To express my admiration, I have already created a "Vala programming language fan club" group on facebook. :) A few minutes after I mentioned to Emmanuele on IRC about my intention of binding GUPnP for Vala, Ali Sabil had already done the basic work and we already have bindings that work for such basic example application at least:
If you are really anxious to try it out, you can get it here but please keep in mind that it needs a bit (at least) of polishing/love before it could be taken seriously.
using GLib;
using GUPnP;
public class Browser: ControlPoint {
public MainLoop main_loop { get; private set; }
private void on_device_proxy_available(ControlPoint cp,
DeviceProxy proxy) {
stdout.printf("device %s found\n", proxy.get_friendly_name());
}
private bool on_timeout () {
this.main_loop.quit();
return false;
}
public Browser() {
this.client = new Context(null, null, 0);
this.target = "ssdp:all";
this.resource_factory = ResourceFactory.get_default();
this.main_loop = new MainLoop(null, false);
}
static int main(string[] args) {
Browser browser;
Thread.init();
browser = new Browser();
browser.device_proxy_available += browser.on_device_proxy_available;
browser.set_active(true);
var time = new GLib.TimeoutSource(5000);
time.set_callback(browser.on_timeout, null);
time.attach(browser.main_loop.get_context());
browser.main_loop.run();
return 0;
}
}
If you are really anxious to try it out, you can get it here but please keep in mind that it needs a bit (at least) of polishing/love before it could be taken seriously.
Comments