core,tracker: Derive Thumbnail from IconInfo
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 7 Sep 2009 13:01:02 +0000 (16:01 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 7 Sep 2009 13:01:02 +0000 (16:01 +0300)
src/plugins/tracker/rygel-tracker-plugin.vala
src/rygel/rygel-icon-info.vala
src/rygel/rygel-root-device-factory.vala
src/rygel/rygel-thumbnail.vala

index 5142d23..7bf6214 100644 (file)
@@ -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);
     }
index 66a68d3..52607eb 100644 (file)
  * 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;
     }
 }
index b29da43..354e1e4 100644 (file)
@@ -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);
index 63f5e7d..d040fc9 100644 (file)
 
 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);