[gnome-boxes] Simple implementation of file selection



commit 5592ddbee6d0f1b624625d251b6790bc160a5dc9
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Nov 16 00:20:01 2011 +0200

    Simple implementation of file selection

 src/wizard-source.vala |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index f5dae9a..f6172d4 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -59,7 +59,7 @@ private class Boxes.WizardSource: GLib.Object {
         var separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);
         menubox.pack_start (separator, false, false);
 
-        hbox = add_entry (menubox, () => { page = SourcePage.FILE; });
+        hbox = add_entry (menubox, launch_file_selection_dialog);
         label = new Gtk.Label (_("Select a file"));
         label.xalign = 0.0f;
         hbox.pack_start (label, true, true);
@@ -114,4 +114,19 @@ private class Boxes.WizardSource: GLib.Object {
 
         return hbox;
     }
+
+    private void launch_file_selection_dialog () {
+        var dialog = new Gtk.FileChooserDialog (_("Select a device or ISO file"),
+                                                null,
+                                                Gtk.FileChooserAction.OPEN,
+                                                Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
+                                                Gtk.Stock.OPEN, Gtk.ResponseType.ACCEPT);
+        dialog.show_hidden = false;
+        if (dialog.run () == Gtk.ResponseType.ACCEPT) {
+            uri = dialog.get_uri ();
+            page = SourcePage.URL;
+        }
+
+        dialog.hide ();
+    }
 }



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