[rygel/rygel-0-12] Revert "core: Check availability of DBus interface"



commit f8ca97cb6ff38c0d992603d90741c16dc024d562
Author: Jens Georg <mail jensge org>
Date:   Sat Oct 8 19:19:05 2011 +0200

    Revert "core: Check availability of DBus interface"
    
    This reverts commit 87ec0afffc96cc4d10d5407a896d28deebd26f00.

 src/rygel/rygel-dbus-thumbnailer.vala |   39 +++++---------------------------
 src/rygel/rygel-thumbnailer.vala      |    8 ++----
 2 files changed, 9 insertions(+), 38 deletions(-)
---
diff --git a/src/rygel/rygel-dbus-thumbnailer.vala b/src/rygel/rygel-dbus-thumbnailer.vala
index 6ee2d4a..e5258af 100644
--- a/src/rygel/rygel-dbus-thumbnailer.vala
+++ b/src/rygel/rygel-dbus-thumbnailer.vala
@@ -41,8 +41,6 @@ internal class Rygel.DbusThumbnailer : GLib.Object {
     private bool is_running  = false;
     private string file_path;
 
-    public bool available { get; private set; }
-
     const string THUMBNAILER_IFACE = "org.freedesktop.thumbnails.Thumbnailer1";
     const string THUMBNAILER_SERVICE =
                                     "/org/freedesktop/thumbnails/Thumbnailer1";
@@ -55,35 +53,12 @@ internal class Rygel.DbusThumbnailer : GLib.Object {
 
 
     public DbusThumbnailer () throws GLib.IOError {
-        this.available = false;
-        Bus.watch_name (BusType.SESSION,
-                        THUMBNAILER_IFACE,
-                        BusNameWatcherFlags.AUTO_START,
-                        this.on_name_available,
-                        this.on_name_unavailable);
-
-    }
-
-    public void on_name_available (DBusConnection connection,
-                                   string         name,
-                                   string         owner) {
-        try {
-            this.tumbler = connection.get_proxy_sync (THUMBNAILER_IFACE,
-                                                      THUMBNAILER_SERVICE);
-
-            tumbler.Finished.connect (on_finished);
-            tumbler.Error.connect (on_error);
-            this.available = true;
-            debug ("DBus thumbnailer service available");
-        } catch (Error error) {
-            this.available = false;
-        }
-    }
+        this.tumbler = GLib.Bus.get_proxy_sync (BusType.SESSION,
+                                                THUMBNAILER_IFACE,
+                                                THUMBNAILER_SERVICE);
 
-    public void on_name_unavailable (DBusConnection connection,
-                                     string         name) {
-        this.available = false;
-        debug ("DBus thumbnailer service not available");
+        tumbler.Finished.connect (on_finished);
+        tumbler.Error.connect (on_error);
     }
 
     public async void create_thumbnail_task (string file_path,
@@ -104,9 +79,7 @@ internal class Rygel.DbusThumbnailer : GLib.Object {
 
         try {
             yield this.tumbler.Queue (uris, mimes, flavor, "default", 0);
-        } catch (Error error) {
-            this.available = false;
-        }
+        } catch (Error error) { }
     }
 
     public bool in_progress () {
diff --git a/src/rygel/rygel-thumbnailer.vala b/src/rygel/rygel-thumbnailer.vala
index 40d1e56..3f3fb5d 100644
--- a/src/rygel/rygel-thumbnailer.vala
+++ b/src/rygel/rygel-thumbnailer.vala
@@ -77,8 +77,8 @@ internal class Rygel.Thumbnailer : GLib.Object {
 
         try {
             this.thumbler = new DbusThumbnailer ();
-       } catch (GLib.Error error) {
-       }
+       } catch (GLib.IOError error) {}
+
     }
 
     public static Thumbnailer? get_default () {
@@ -104,9 +104,7 @@ internal class Rygel.Thumbnailer : GLib.Object {
         var file = File.new_for_path (full_path);
 
         // send a request to create thumbnail if it does not exist
-        if (this.thumbler != null &&
-            this.thumbler.available &&
-            !file.query_exists ()) {
+        if ((this.thumbler != null) && (!file.query_exists ())) {
             this.thumbler.create_thumbnail_task (uri, mime_type, "normal");
         }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]