[rygel] ui: Don't expose special dir magic variables
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] ui: Don't expose special dir magic variables
- Date: Thu, 17 Feb 2011 23:49:52 +0000 (UTC)
commit be482ca44bf7635f57ff1af4477c605614e9890c
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Fri Feb 18 01:38:59 2011 +0200
ui: Don't expose special dir magic variables
src/ui/rygel-media-pref-section.vala | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)
---
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;
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]