[gnome-boxes] wizard-source: Drop use of AppWindow singleton



commit 8d7698db0e8d673b0805f114e839845ad2124d8e
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri Jul 18 13:11:14 2014 +0200

    wizard-source: Drop use of AppWindow singleton
    
    Instead of using the AppWindow singleton, WizardSource now has its own
    reference to AppWindow that it receives through a parameter to setup_ui().
    
    This is needed to drop the use of AppWindow singleton and therefore to
    make multiple windows possible.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732098

 src/wizard-source.vala |   10 +++++++++-
 src/wizard.vala        |    2 ++
 2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index 1f21934..c30b041 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -128,6 +128,8 @@ private class Boxes.WizardSource: Gtk.Stack {
     [GtkChild]
     private Gtk.Label libvirt_sys_import_label;
 
+    private AppWindow window;
+
     private Gtk.Box media_vbox;
 
     public MediaManager media_manager;
@@ -179,6 +181,12 @@ private class Boxes.WizardSource: Gtk.Stack {
         transition_type = Gtk.StackTransitionType.SLIDE_LEFT_RIGHT; // FIXME: Why this won't work from .ui 
file?
     }
 
+    public void setup_ui (AppWindow window) {
+        assert (window != null);
+
+        this.window = window;
+    }
+
     public void cleanup () {
         install_media = null;
         libvirt_sys_import = false;
@@ -267,7 +275,7 @@ private class Boxes.WizardSource: Gtk.Stack {
     [GtkCallback]
     private void on_select_file_button_clicked () {
         var dialog = new Gtk.FileChooserDialog (_("Select a device or ISO file"),
-                                                App.window,
+                                                window,
                                                 Gtk.FileChooserAction.OPEN,
                                                 _("_Cancel"), Gtk.ResponseType.CANCEL,
                                                 _("_Open"), Gtk.ResponseType.ACCEPT);
diff --git a/src/wizard.vala b/src/wizard.vala
index 553356f..dbd785b 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -639,6 +639,8 @@ private class Boxes.Wizard: Gtk.Stack, Boxes.UI {
         create_button.clicked.connect (() => {
             page = WizardPage.LAST;
         });
+
+        wizard_source.setup_ui (window);
     }
 
     public void open_with_uri (string uri, bool skip_review_for_live = true) {


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