Add support for FeedingIt
authorThomas Perl <thp@thpinfo.com>
Sun, 24 Jan 2010 20:54:04 +0000 (21:54 +0100)
committerThomas Perl <thp@thpinfo.com>
Sun, 24 Jan 2010 20:54:04 +0000 (21:54 +0100)
debian/changelog
feedhandler.vala

index 2e2bd08..e3096f5 100644 (file)
@@ -1,3 +1,10 @@
+feedhandler (2.2) UNRELEASED; urgency=low
+
+  * Fix Bugtracker field (typo; was: "Bugracker")
+  * Add support for FeedingIt
+
+ -- Thomas Perl <thp@thpinfo.com>  Sun, 24 Jan 2010 21:53:45 +0100
+
 feedhandler (2.1) unstable; urgency=low
 
   * Second release - better gPodder detection.
index 06dd9fa..162009f 100644 (file)
@@ -8,10 +8,14 @@ using GLib;
 using Osso;
 using Pango;
 
+public static const string FEEDINGIT_SERVICE =
+    "/usr/share/dbus-1/services/feedingit.service";
+
 public enum Reader {
     RSS = 1,
     GOOGLE,
     GPODDER,
+    FEEDINGIT,
 }
 
 public class DesktopFile : GLib.KeyFile {
@@ -104,6 +108,9 @@ public class FeedHandler : GLib.Object {
         if (FileUtils.test("/usr/bin/gpodder", FileTest.EXISTS)) {
             dlg.add_button("gPodder", Reader.GPODDER);
         }
+        if (FileUtils.test(FEEDINGIT_SERVICE, FileTest.EXISTS)) {
+            dlg.add_button("FeedingIt", Reader.FEEDINGIT);
+        }
         dlg.add_button("Cancel", Gtk.ResponseType.CLOSE);
         dlg.title = "Select application for handling this feed";
         var label = new Gtk.Label(url);
@@ -131,6 +138,9 @@ public class FeedHandler : GLib.Object {
                     stderr.printf("Can't launch: %s\n", e.message);
                 }
                 break;
+            case Reader.FEEDINGIT:
+                add_to_feedingit(url);
+                break;
         }
 
         message("URL received: %s", url);
@@ -152,6 +162,15 @@ public class FeedHandler : GLib.Object {
         obj.mime_open(url);
     }
 
+    private void add_to_feedingit(string url)
+    {
+        dynamic DBus.Object obj = conn.get_object(
+            "org.maemo.feedingit",
+            "/org/maemo/feedingit",
+            "org.maemo.feedingit");
+        obj.AddFeed(url);
+    }
+
     private void open_browser(string url)
     {
         context.rpc_run_with_defaults("osso_browser",