[baobab/wip/vala: 18/53] Implement file chooser dir selection



commit 896db051be28f65e585c26d90cddf496f9d33071
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Jan 7 18:40:29 2012 +0100

    Implement file chooser dir selection

 src/baobab-window.vala |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index ddc0730..3513cb5 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -73,7 +73,22 @@ namespace Baobab {
 		}
 
 		void on_scan_folder_activate () {
-			print ("sf\n");
+			var file_chooser = new Gtk.FileChooserDialog (_("Select Folder"), this,
+			                                              Gtk.FileChooserAction.SELECT_FOLDER,
+			                                              Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
+			                                              Gtk.Stock.OPEN, Gtk.ResponseType.ACCEPT);
+
+			file_chooser.set_modal (true);
+
+			file_chooser.response.connect ((response) => {
+				if (response == Gtk.ResponseType.ACCEPT) {
+					var dir = file_chooser.get_file ();
+					scan_directory (dir);
+				}
+				file_chooser.destroy ();
+			});
+
+			file_chooser.show ();
 		}
 
 		void on_scan_remote_activate () {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]