[gnome-boxes] Drop now redundant PropertiesSidebar



commit 03a22eac5936a437c35e4a1376c7a371cb2050cf
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Nov 21 18:53:30 2014 +0000

    Drop now redundant PropertiesSidebar
    
    Drop the sidebar from properties. It looks weird now in the separate
    (smaller) window and all the functionality it provides has already been
    replaced by previous patches to this.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733367

 data/gnome-boxes.gresource.xml |    1 -
 data/ui/properties-sidebar.ui  |  206 ----------------------------------------
 data/ui/properties-window.ui   |   28 +-----
 data/ui/sidebar.ui             |    7 --
 src/Makefile.am                |    1 -
 src/machine.vala               |   23 -----
 src/properties-sidebar.vala    |   48 ---------
 src/properties-window.vala     |    3 -
 src/properties.vala            |   36 +-------
 src/sidebar.vala               |    4 -
 src/snapshots-property.vala    |    2 -
 11 files changed, 4 insertions(+), 355 deletions(-)
---
diff --git a/data/gnome-boxes.gresource.xml b/data/gnome-boxes.gresource.xml
index 69580f7..416d464 100644
--- a/data/gnome-boxes.gresource.xml
+++ b/data/gnome-boxes.gresource.xml
@@ -13,7 +13,6 @@
     <file preprocess="xml-stripblanks">ui/editable-entry.ui</file>
     <file preprocess="xml-stripblanks">ui/mini-graph.ui</file>
     <file preprocess="xml-stripblanks">ui/notification.ui</file>
-    <file preprocess="xml-stripblanks">ui/properties-sidebar.ui</file>
     <file preprocess="xml-stripblanks">ui/properties-toolbar.ui</file>
     <file preprocess="xml-stripblanks">ui/properties-window.ui</file>
     <file preprocess="xml-stripblanks">ui/searchbar.ui</file>
diff --git a/data/ui/properties-window.ui b/data/ui/properties-window.ui
index 42e27ed..f5d7b47 100644
--- a/data/ui/properties-window.ui
+++ b/data/ui/properties-window.ui
@@ -6,12 +6,7 @@
 
      Boxes.PropertiesWindow : Gtk.Window
         |
-        |
-        |-> hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
-        |    |
-        |    |-> sidebar = new Boxes.PropertiesSidebar ();
-        |    |
-        |    |-> properties = new Boxes.Properties ();
+        |-> properties = new Boxes.Properties ();
         |
         |-> topbar = new Boxes.PropertiesToolbar (); // as titlebar
   -->
@@ -25,27 +20,8 @@
     <signal name="delete-event" handler="on_delete_event"/>
 
     <child>
-      <object class="GtkBox" id="hbox">
+      <object class="BoxesProperties" id="properties">
         <property name="visible">True</property>
-        <property name="orientation">horizontal</property>
-        <property name="halign">fill</property>
-        <property name="valign">fill</property>
-        <property name="hexpand">True</property>
-        <property name="vexpand">True</property>
-        <property name="spacing">0</property>
-
-        <child>
-          <object class="BoxesPropertiesSidebar" id="sidebar">
-            <property name="visible">True</property>
-          </object>
-        </child>
-
-        <child>
-          <object class="BoxesProperties" id="properties">
-            <property name="visible">True</property>
-          </object>
-        </child>
-
       </object>
     </child>
 
diff --git a/data/ui/sidebar.ui b/data/ui/sidebar.ui
index febbacd..dd52958 100644
--- a/data/ui/sidebar.ui
+++ b/data/ui/sidebar.ui
@@ -10,12 +10,5 @@
     <property name="vexpand">True</property>
     <property name="hexpand">False</property>
     <property name="halign">start</property>
-
-    <!-- Properties -->
-    <child>
-      <object class="BoxesPropertiesSidebar" id="props_sidebar">
-        <property name="visible">True</property>
-      </object>
-    </child>
   </template>
 </interface>
diff --git a/src/Makefile.am b/src/Makefile.am
index f25d5b2..00827dd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -124,7 +124,6 @@ gnome_boxes_SOURCES =                               \
        os-database.vala                        \
        properties.vala                         \
        properties-window.vala                  \
-       properties-sidebar.vala                 \
        properties-toolbar.vala                 \
        remote-machine.vala                     \
        searchbar.vala                          \
diff --git a/src/machine.vala b/src/machine.vala
index ab330e1..9a7050c 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -426,8 +426,6 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
 
             orig_pixbuf = small_screenshot;
             pixbuf = draw_vm (small_screenshot, SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT);
-            if (window.current_item == this)
-                window.props_window.sidebar.screenshot.set_from_pixbuf (pixbuf);
             if (save)
                 save_pixbuf_as_screenshot (small_screenshot);
 
@@ -569,27 +567,6 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
             disconnect_display ();
 
             break;
-        case UIState.PROPERTIES:
-            Gdk.Pixbuf pixbuf = null;
-            if (previous_ui_state == UIState.WIZARD) {
-                var theme = Gtk.IconTheme.get_for_screen (window.get_screen ());
-                pixbuf = new Gdk.Pixbuf (Gdk.Colorspace.RGB, true, 8,
-                                         Machine.SCREENSHOT_WIDTH, Machine.SCREENSHOT_HEIGHT);
-                pixbuf.fill (0x00000000); // Transparent
-                try {
-                    var icon = theme.load_icon ("media-optical", Machine.SCREENSHOT_HEIGHT, 0);
-                    // Center icon in pixbuf
-                    icon.copy_area (0, 0, Machine.SCREENSHOT_HEIGHT, Machine.SCREENSHOT_HEIGHT, pixbuf,
-                                    (Machine.SCREENSHOT_WIDTH - Machine.SCREENSHOT_HEIGHT) / 2, 0);
-                } catch (GLib.Error err) {
-                    warning (err.message);
-                }
-            } else {
-                pixbuf = this.pixbuf;
-            }
-            window.props_window.sidebar.screenshot.set_from_pixbuf (pixbuf);
-
-            break;
         }
     }
 
diff --git a/src/properties-window.vala b/src/properties-window.vala
index ce2c68e..1f06e83 100644
--- a/src/properties-window.vala
+++ b/src/properties-window.vala
@@ -7,8 +7,6 @@ private class Boxes.PropertiesWindow: Gtk.Window, Boxes.UI {
     public UIState ui_state { get; protected set; }
 
     [GtkChild]
-    public PropertiesSidebar sidebar;
-    [GtkChild]
     public Properties properties;
     [GtkChild]
     public PropertiesToolbar topbar;
@@ -18,7 +16,6 @@ private class Boxes.PropertiesWindow: Gtk.Window, Boxes.UI {
     public PropertiesWindow (AppWindow app_window) {
         this.app_window = app_window;
 
-        sidebar.setup_ui (app_window);
         properties.setup_ui (app_window, this);
         topbar.setup_ui (app_window);
 
diff --git a/src/properties.vala b/src/properties.vala
index e65bb7a..0d79589 100644
--- a/src/properties.vala
+++ b/src/properties.vala
@@ -17,7 +17,6 @@ private class Boxes.Properties: Gtk.Notebook, Boxes.UI {
     public UIState ui_state { get; protected set; }
 
     private AppWindow window;
-    private PropertiesSidebar sidebar;
 
     private ulong stats_id;
     private bool restore_fullscreen;
@@ -117,24 +116,13 @@ private class Boxes.Properties: Gtk.Notebook, Boxes.UI {
         notify["ui-state"].connect (ui_state_changed);
     }
 
-    private void list_append (Gtk.ListStore listmodel, string label, bool visible) {
-        Gtk.TreeIter iter;
-
-        listmodel.append (out iter);
-        listmodel.set (iter, 0, label);
-        listmodel.set (iter, 1, visible);
-    }
-
     private void populate () {
-        sidebar.listmodel.clear ();
         foreach (var page in get_children ())
             remove (page);
 
         var machine = window.current_item as Machine;
         var libvirt_machine = window.current_item as LibvirtMachine;
 
-        sidebar.shutdown_button.sensitive = libvirt_machine != null && libvirt_machine.is_running ();
-
         if (machine == null)
             return;
 
@@ -147,29 +135,18 @@ private class Boxes.Properties: Gtk.Notebook, Boxes.UI {
             page.refresh_properties.connect (() => {
                 var current_page = page;
                 this.populate ();
-                var path = new Gtk.TreePath.from_indices (current_page);
-                sidebar.selection.select_path (path);
                 page = current_page;
             });
-
-            list_append (sidebar.listmodel, page.name, !page.empty);
         }
 
-        PropertiesPage current_page;
-
         if (libvirt_machine != null)
-            current_page = (previous_ui_state == UIState.WIZARD) ? PropertiesPage.SYSTEM : 
PropertiesPage.GENERAL;
+            page = (previous_ui_state == UIState.WIZARD) ? PropertiesPage.SYSTEM : PropertiesPage.GENERAL;
         else
-            current_page = PropertiesPage.GENERAL;
-
-        var path = new Gtk.TreePath.from_indices (current_page);
-        sidebar.selection.select_path (path);
-        visible_child_name = page_names[current_page];
+            page = PropertiesPage.GENERAL;
     }
 
     public void setup_ui (AppWindow window, PropertiesWindow dialog) {
         this.window = window;
-        this.sidebar = dialog.sidebar;
 
         show_all ();
     }
@@ -184,15 +161,6 @@ private class Boxes.Properties: Gtk.Notebook, Boxes.UI {
             restore_fullscreen = (previous_ui_state == UIState.DISPLAY && window.fullscreened);
             window.fullscreened = false;
 
-            if (window.current_item is LibvirtMachine) {
-                var libvirt_machine = window.current_item as LibvirtMachine;
-                stats_id = libvirt_machine.stats_updated.connect (() => {
-                    sidebar.cpu_graph.points = libvirt_machine.cpu_stats;
-                    sidebar.net_graph.points = libvirt_machine.net_stats;
-                    sidebar.io_graph.points = libvirt_machine.io_stats;
-                });
-            }
-
             populate ();
         } else if (previous_ui_state == UIState.PROPERTIES) {
             var reboot_required = false;
diff --git a/src/sidebar.vala b/src/sidebar.vala
index 12e164c..6529749 100644
--- a/src/sidebar.vala
+++ b/src/sidebar.vala
@@ -12,9 +12,6 @@ private class Boxes.Sidebar: Gtk.Revealer, Boxes.UI {
     public UIState previous_ui_state { get; protected set; }
     public UIState ui_state { get; protected set; }
 
-    [GtkChild]
-    public PropertiesSidebar props_sidebar;
-
     private AppWindow window;
 
     construct {
@@ -23,7 +20,6 @@ private class Boxes.Sidebar: Gtk.Revealer, Boxes.UI {
 
     public void setup_ui (AppWindow window) {
         this.window = window;
-        props_sidebar.setup_ui (window);
     }
 
     private void ui_state_changed () {
diff --git a/src/snapshots-property.vala b/src/snapshots-property.vala
index 38aed80..b78d330 100644
--- a/src/snapshots-property.vala
+++ b/src/snapshots-property.vala
@@ -11,11 +11,9 @@ private class Boxes.SnapshotsProperty : Boxes.Property {
         set {
             if (value == null) {
                 snapshot_stack.visible_child = snapshot_box;
-                machine.window.props_window.sidebar.sensitive = true;
             } else {
                 activity_label.label = value;
                 snapshot_stack.visible_child = activity_box;
-                machine.window.props_window.sidebar.sensitive = false;
             }
         }
     }


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