[gnome-boxes] sidebar: Drop use of AppWindow singleton



commit 164b067afdf3cd2aaaebccff673f953a6f3e1510
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri Jul 18 09:44:07 2014 +0200

    sidebar: Drop use of AppWindow singleton
    
    Instead of using the AppWindow singleton, Sidebar 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/app-window.vala |    1 +
 src/sidebar.vala    |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/app-window.vala b/src/app-window.vala
index 62317db..479ceb6 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -111,6 +111,7 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
         view.setup_ui (this);
         selectionbar.setup_ui (this);
         searchbar.setup_ui (this);
+        sidebar.setup_ui (this);
         notificationbar.searchbar = searchbar;
     }
 
diff --git a/src/sidebar.vala b/src/sidebar.vala
index a7831a0..0fdac45 100644
--- a/src/sidebar.vala
+++ b/src/sidebar.vala
@@ -45,11 +45,17 @@ private class Boxes.Sidebar: Gtk.Revealer, Boxes.UI {
     [GtkChild]
     public MiniGraph net_graph;
 
+    private AppWindow window;
+
     construct {
         notify["ui-state"].connect (ui_state_changed);
         setup_sidebar ();
     }
 
+    public void setup_ui (AppWindow window) {
+        this.window = window;
+    }
+
     public void set_wizard_page (WizardPage wizard_page) {
         foreach (var label in wizard_vbox.get_children ())
             label.get_style_context ().remove_class ("boxes-wizard-current-page-label");
@@ -98,12 +104,12 @@ private class Boxes.Sidebar: Gtk.Revealer, Boxes.UI {
         Gtk.TreeIter filter_iter, iter;
         props_model_filter.get_iter (out filter_iter, path);
         props_model_filter.convert_iter_to_child_iter (out iter, filter_iter);
-        App.window.properties.page = (PropertiesPage) props_listmodel.get_path (iter).get_indices ()[0];
+        window.properties.page = (PropertiesPage) props_listmodel.get_path (iter).get_indices ()[0];
     }
 
     [GtkCallback]
     private void on_shutdown_button_clicked () {
-        var machine = App.window.current_item as LibvirtMachine;
+        var machine = window.current_item as LibvirtMachine;
         if (machine != null)
             machine.force_shutdown ();
     }


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