[rygel] core,tracker: Derive Thumbnail from IconInfo



commit 52add37d16f44476043aa0a264d1a81c3621662d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Sep 7 16:01:02 2009 +0300

    core,tracker: Derive Thumbnail from IconInfo

 src/plugins/tracker/rygel-tracker-plugin.vala |   11 ++++++-----
 src/rygel/rygel-icon-info.vala                |   21 ++++++++-------------
 src/rygel/rygel-root-device-factory.vala      |    2 +-
 src/rygel/rygel-thumbnail.vala                |   17 ++++-------------
 4 files changed, 19 insertions(+), 32 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-plugin.vala b/src/plugins/tracker/rygel-tracker-plugin.vala
index 5142d23..7bf6214 100644
--- a/src/plugins/tracker/rygel-tracker-plugin.vala
+++ b/src/plugins/tracker/rygel-tracker-plugin.vala
@@ -39,11 +39,12 @@ public class Rygel.TrackerPlugin : Rygel.Plugin {
 
         this.add_resource (resource_info);
 
-        var icon_info = new IconInfo ("image/png", // Mimetype
-                                      48,          // width
-                                      48,          // height
-                                      24,          // depth
-                                      ICON);       // Icon Path
+        var icon_info = new IconInfo ("image/png");
+
+        icon_info.path = ICON;
+        icon_info.width = 48;
+        icon_info.height = 48;
+        icon_info.depth = 24;
 
         this.add_icon (icon_info);
     }
diff --git a/src/rygel/rygel-icon-info.vala b/src/rygel/rygel-icon-info.vala
index 66a68d3..52607eb 100644
--- a/src/rygel/rygel-icon-info.vala
+++ b/src/rygel/rygel-icon-info.vala
@@ -25,21 +25,16 @@
  * Holds information about an icon.
  */
 public class Rygel.IconInfo {
-    public string mimetype;
-    public uint width;
-    public uint height;
-    public uint depth;
+    public string mime_type;
     public string path;
 
-    public IconInfo (string mimetype,
-                     uint   width,
-                     uint   height,
-                     uint   depth,
-                     string path) {
-        this.mimetype = mimetype;
-        this.width = width;
-        this.height = height;
-        this.depth = depth;
+    public long size = -1;       // Size in bytes
+    public int width = -1;       // Width in pixels
+    public int height = -1;      // Height in pixels
+    public int depth = -1; // depth of pixels in bytes
+
+    public IconInfo (string mime_type) {
+        this.mime_type = mime_type;
         this.path = path;
     }
 }
diff --git a/src/rygel/rygel-root-device-factory.vala b/src/rygel/rygel-root-device-factory.vala
index b29da43..354e1e4 100644
--- a/src/rygel/rygel-root-device-factory.vala
+++ b/src/rygel/rygel-root-device-factory.vala
@@ -245,7 +245,7 @@ public class Rygel.RootDeviceFactory {
         string height = icon_info.height.to_string ();
         string depth = icon_info.depth.to_string ();
 
-        icon_node->new_child (null, "mimetype", icon_info.mimetype);
+        icon_node->new_child (null, "mimetype", icon_info.mime_type);
         icon_node->new_child (null, "width", width);
         icon_node->new_child (null, "height", height);
         icon_node->new_child (null, "depth", depth);
diff --git a/src/rygel/rygel-thumbnail.vala b/src/rygel/rygel-thumbnail.vala
index 63f5e7d..d040fc9 100644
--- a/src/rygel/rygel-thumbnail.vala
+++ b/src/rygel/rygel-thumbnail.vala
@@ -22,26 +22,17 @@
 
 using GUPnP;
 
-private errordomain Rygel.ThumbnailError {
-    BAD_URI
-}
-
 /**
  * Represents a picture or video thumbnail.
  */
-public class Rygel.Thumbnail : GLib.Object {
+public class Rygel.Thumbnail : Rygel.IconInfo {
     public string uri;
-    public string mime_type;
     public string dlna_profile;
 
-    public long size = -1;       // Size in bytes
-    public int width = -1;       // Width in pixels
-    public int height = -1;      // Height in pixels
-    public int color_depth = -1; // depth of pixels in bytes
-
     public Thumbnail (string mime_type = "image/jpeg",
                       string dlna_profile = "JPEG_TN") {
-        this.mime_type = mime_type;
+        base (mime_type);
+
         this.dlna_profile = dlna_profile;
     }
 
@@ -54,7 +45,7 @@ public class Rygel.Thumbnail : GLib.Object {
 
         res.width = this.width;
         res.height = this.height;
-        res.color_depth = this.color_depth;
+        res.color_depth = this.depth;
 
         /* Protocol info */
         res.protocol_info = this.get_protocol_info (protocol);



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