+ static int osso_callback (string iface, string method, GLib.Array arguments, void* data, out Osso.Rpc rpc) {
+ var app = (CinaestProgram) data;
+ if (method == "OpenMovie") {
+ if (arguments.length < 1) {
+ rpc.type = DBus.RawType.STRING;
+ ((OssoFix.Rpc) rpc).s = "OpenMovie missing movie parameter";
+ return Osso.Status.ERROR;
+ }
+ // Vala doesn't support GLib.Array<Osso.Rpc>, so we have to cast:
+ Osso.Rpc* arg = *(Osso.Rpc**) arguments;
+ if (arg[0].type != DBus.RawType.STRING) {
+ rpc.type = DBus.RawType.STRING;
+ ((OssoFix.Rpc) rpc).s = "OpenMovie first parameter must be string";
+ return Osso.Status.ERROR;
+ }
+ string title = arg[0].s;
+ int year = 0;
+ if (arguments.length >= 2) {
+ if (arg[1].type != DBus.RawType.INT32) {
+ rpc.type = DBus.RawType.STRING;
+ ((OssoFix.Rpc) rpc).s = "OpenMovie second parameter must be int";
+ return Osso.Status.ERROR;
+ }
+ year = arg[1].i;
+ }
+ if (reference == null) {
+ rpc.type = DBus.RawType.STRING;
+ ((OssoFix.Rpc) rpc).s = "No reference source installed";
+ return Osso.Status.ERROR;
+ }
+ print ("OpenMovie (\"%s\"", title);
+ if (year > 0)
+ print (", %d", year);
+ print (")\n");
+
+ var list_window = new MovieListWindow (reference, title, year);
+ var widget = app.secondary_stack.pop_1 ();
+ while (widget != null) {
+ widget.destroy ();
+ widget = app.secondary_stack.pop_1 ();
+ }
+ app.secondary_stack.push_1 (list_window);
+ }
+ rpc.type = DBus.RawType.INVALID;
+ return Osso.Status.OK;
+ }
+