Keyword substitution goes to ExternalContainer
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 11 May 2009 15:55:44 +0000 (18:55 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Mon, 11 May 2009 15:55:44 +0000 (18:55 +0300)
src/plugins/external/rygel-external-container.vala
src/plugins/external/rygel-external-item.vala

index 4ce9ccc..f08149f 100644 (file)
@@ -121,6 +121,17 @@ public class Rygel.ExternalContainer : MediaContainer {
         return simple_res.data;
     }
 
+    public string substitute_keywords (string title) {
+        var new_title = title.replace ("@REALNAME@",
+                                       Environment.get_real_name ());
+        new_title = new_title.replace ("@USERNAME@",
+                                       Environment.get_user_name ());
+        new_title = new_title.replace ("@HOSTNAME@",
+                                       Environment.get_host_name ());
+
+        return new_title;
+    }
+
     // Private methods
     private MediaObject? find_object_sync (string id) {
         MediaObject obj = null;
index 71eed84..055270d 100644 (file)
@@ -50,12 +50,7 @@ public class Rygel.ExternalItem : MediaItem {
 
         Value value;
         props.Get (OBJECT_IFACE, "display-name", out value);
-        this.title = value.get_string ().replace ("@REALNAME@",
-                                                  Environment.get_real_name ());
-        this.title = this.title.replace ("@USERNAME@",
-                                         Environment.get_user_name ());
-        this.title = this.title.replace ("@HOSTNAME@",
-                                         Environment.get_host_name ());
+        this.title = parent.substitute_keywords (value.get_string ());
 
         props.Get (ITEM_IFACE, "type", out value);
         string type = value.get_string ();