Example code for launching a reader app
authorThomas Perl <thp@thpinfo.com>
Thu, 1 Oct 2009 10:49:36 +0000 (12:49 +0200)
committerThomas Perl <thp@thpinfo.com>
Thu, 1 Oct 2009 10:49:36 +0000 (12:49 +0200)
feedhandler.vala

index 3ad4810..f36c392 100644 (file)
@@ -22,7 +22,18 @@ public class FeedHandler : GLib.Object {
         dlg.title = "feedhandler received a URL";
         dlg.vbox.add(new Gtk.Label(url));
         dlg.show_all();
         dlg.title = "feedhandler received a URL";
         dlg.vbox.add(new Gtk.Label(url));
         dlg.show_all();
-        dlg.run();
+        if (dlg.run() == Gtk.ResponseType.YES) {
+            /* Example code for launching a RSS application */
+            try {
+                GLib.Process.spawn_async(null,
+                    {"gpodder",
+                    "--fremantle",
+                    "-s",
+                    url}, null, GLib.SpawnFlags.SEARCH_PATH, null, null);
+            } catch (GLib.SpawnError e) {
+                stderr.printf("Can't launch: %s\n", e.message);
+            }
+        }
         dlg.destroy();
         message("URL received: %s", url);
         loop.quit();
         dlg.destroy();
         message("URL received: %s", url);
         loop.quit();