From: Zeeshan Ali (Khattak) Date: Thu, 17 Feb 2011 23:38:59 +0000 (+0200) Subject: ui: Don't expose special dir magic variables X-Git-Tag: RYGEL_0_9_9~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be482ca44bf7635f57ff1af4477c605614e9890c;p=profile%2Fivi%2Frygel.git ui: Don't expose special dir magic variables --- diff --git a/src/ui/rygel-media-pref-section.vala b/src/ui/rygel-media-pref-section.vala index b5da923..a3d1a9e 100644 --- a/src/ui/rygel-media-pref-section.vala +++ b/src/ui/rygel-media-pref-section.vala @@ -63,10 +63,11 @@ public class Rygel.MediaPrefSection : PreferencesSection { try { var uris = config.get_string_list (this.name, URIS_KEY); foreach (var uri in uris) { + var real_uri = this.get_real_uri (uri); TreeIter iter; this.liststore.append (out iter); - this.liststore.set (iter, 0, uri, -1); + this.liststore.set (iter, 0, real_uri, -1); } } catch (GLib.Error err) {} // Nevermind @@ -95,6 +96,7 @@ public class Rygel.MediaPrefSection : PreferencesSection { string uri; this.liststore.get (iter, 0, out uri, -1); + uri = this.uri_to_magic_variable (uri); uri_list.add (uri); } while (this.liststore.iter_next (ref iter)); } @@ -153,4 +155,31 @@ public class Rygel.MediaPrefSection : PreferencesSection { private void on_clear_button_clicked (Button button) { this.liststore.clear (); } + + private string get_real_uri (string uri) { + switch (uri) { + case "@MUSIC@": + return Environment.get_user_special_dir (UserDirectory.MUSIC); + case "@VIDEOS@": + return Environment.get_user_special_dir (UserDirectory.VIDEOS); + case "@PICTURES@": + return Environment.get_user_special_dir (UserDirectory.PICTURES); + default: + return uri; + } + } + + private string uri_to_magic_variable (string uri) { + if (uri == Environment.get_user_special_dir (UserDirectory.MUSIC)) { + return "@MUSIC@"; + } else if (uri == + Environment.get_user_special_dir (UserDirectory.VIDEOS)) { + return "@VIDEOS@"; + } else if (uri == + Environment.get_user_special_dir (UserDirectory.PICTURES)) { + return "@PICTURES@"; + } else { + return uri; + } + } }