From: Zeeshan Ali (Khattak) Date: Wed, 3 Jun 2009 14:38:05 +0000 (+0300) Subject: ui: Implement adding of Folder URIs X-Git-Tag: RYGEL_0_4~394 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=493beb203515cc05f985d624b27dd4fe7f87fc8b;p=profile%2Fivi%2Frygel.git ui: Implement adding of Folder URIs Implement adding of Folder URIs to the treeview using a GtkFileChooserDialog. --- diff --git a/data/rygel-preferences.ui b/data/rygel-preferences.ui index a4c70b3..c5207a2 100644 --- a/data/rygel-preferences.ui +++ b/data/rygel-preferences.ui @@ -555,6 +555,76 @@ 10 10 + + True + True + 5 + Select folders + True + True + dialog + preferences-dialog + False + True + select-folder + False + + + True + vertical + 2 + + + + + + True + end + + + gtk-cancel + True + True + True + True + True + + + False + False + 0 + + + + + gtk-open + True + True + True + True + True + True + + + False + False + 1 + + + + + False + end + 0 + + + + + + button4 + button5 + + both diff --git a/src/ui/rygel-folder-pref-section.vala b/src/ui/rygel-folder-pref-section.vala index b4ad858..344f212 100644 --- a/src/ui/rygel-folder-pref-section.vala +++ b/src/ui/rygel-folder-pref-section.vala @@ -28,9 +28,11 @@ public class Rygel.FolderPrefSection : Rygel.PluginPrefSection { const string FOLDERS_KEY = "folders"; const string FOLDERS_TEXTVIEW = FOLDERS_KEY + "-treeview"; const string FOLDERS_LISTSTORE = FOLDERS_KEY + "-liststore"; + const string FOLDERS_DIALOG = FOLDERS_KEY + "-dialog"; private TreeView treeview; private ListStore liststore; + private FileChooserDialog dialog; public FolderPrefSection (Builder builder, Configuration config) { @@ -40,6 +42,8 @@ public class Rygel.FolderPrefSection : Rygel.PluginPrefSection { assert (this.treeview != null); this.liststore = (ListStore) builder.get_object (FOLDERS_LISTSTORE); assert (this.liststore != null); + this.dialog = (FileChooserDialog) builder.get_object (FOLDERS_DIALOG); + assert (this.dialog != null); treeview.insert_column_with_attributes (-1, "paths", @@ -86,6 +90,18 @@ public class Rygel.FolderPrefSection : Rygel.PluginPrefSection { [CCode (instance_pos = -1)] public void on_add_button_clicked (Button button) { + if (this.dialog.run () == ResponseType.OK) { + TreeIter iter; + + var uris = this.dialog.get_uris (); + + foreach (var uri in uris) { + this.liststore.append (out iter); + this.liststore.set (iter, 0, uri, -1); + } + } + + this.dialog.hide (); } [CCode (instance_pos = -1)]