[gnome-boxes] mini-graph: Move UI setup to .ui file



commit 7a30337246092fd0789566032cc6f5ddec21bc41
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Sat Feb 1 17:31:26 2014 +0100

    mini-graph: Move UI setup to .ui file
    
    Not much advantage of this on its own but we need to do this to be able
    to create MiniGraph instances from other .ui files, which we'll do in a
    following patch.

 data/gnome-boxes.gresource.xml |    1 +
 data/ui/mini-graph.ui          |    9 +++++++++
 src/mini-graph.vala            |    3 +--
 src/properties.vala            |    3 ---
 4 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/data/gnome-boxes.gresource.xml b/data/gnome-boxes.gresource.xml
index a59d5db..bc4f35a 100644
--- a/data/gnome-boxes.gresource.xml
+++ b/data/gnome-boxes.gresource.xml
@@ -8,6 +8,7 @@
     <file>icons/boxes-gray.png</file>
     <file preprocess="xml-stripblanks">ui/display-page.ui</file>
     <file preprocess="xml-stripblanks">ui/display-toolbar.ui</file>
+    <file preprocess="xml-stripblanks">ui/mini-graph.ui</file>
     <file preprocess="xml-stripblanks">ui/searchbar.ui</file>
     <file preprocess="xml-stripblanks">ui/selectionbar.ui</file>
     <file preprocess="xml-stripblanks">ui/sidebar.ui</file>
diff --git a/data/ui/mini-graph.ui b/data/ui/mini-graph.ui
new file mode 100644
index 0000000..dc67660
--- /dev/null
+++ b/data/ui/mini-graph.ui
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.9 -->
+  <template class="BoxesMiniGraph" parent="GtkDrawingArea">
+    <property name="visible">True</property>
+    <property name="width-request">32</property>
+    <property name="hexpand">True</property>
+  </template>
+</interface>
diff --git a/src/mini-graph.vala b/src/mini-graph.vala
index b93be5e..a795ddd 100644
--- a/src/mini-graph.vala
+++ b/src/mini-graph.vala
@@ -1,5 +1,6 @@
 // This file is part of GNOME Boxes. License: LGPLv2+
 
+[GtkTemplate (ui = "/org/gnome/Boxes/ui/mini-graph.ui")]
 private class Boxes.MiniGraph: Gtk.DrawingArea {
     private double[] _points;
     public double[] points { get { return _points; }
@@ -22,14 +23,12 @@ private class Boxes.MiniGraph: Gtk.DrawingArea {
     public MiniGraph (double[] points = {}, int npoints = -1) {
         this.points = points;
         this.npoints = npoints;
-        this.set_size_request (32, -1);
     }
 
     public MiniGraph.with_ymax (double[] points, double ymax, int npoints = -1) {
         this.points = points;
         this.ymax = ymax;
         this.npoints = npoints;
-        this.set_size_request (32, -1);
     }
 
     private double max () {
diff --git a/src/properties.vala b/src/properties.vala
index bd254e0..c043c3f 100644
--- a/src/properties.vala
+++ b/src/properties.vala
@@ -254,21 +254,18 @@ private class Boxes.Properties: GLib.Object, Boxes.UI {
         label.get_style_context ().add_class ("boxes-graph-label");
         grid.attach (label, 0, 1, 1, 1);
         cpu = new MiniGraph.with_ymax ({}, 100.0, 20);
-        cpu.hexpand = true;
         grid.attach (cpu, 1, 1, 1, 1);
 
         label = new Gtk.Label (_("I/O:"));
         label.get_style_context ().add_class ("boxes-graph-label");
         grid.attach (label, 2, 1, 1, 1);
         io = new MiniGraph ({}, 20);
-        io.hexpand = true;
         grid.attach (io, 3, 1, 1, 1);
 
         label = new Gtk.Label (_("Net:"));
         label.get_style_context ().add_class ("boxes-graph-label");
         grid.attach (label, 4, 1, 1, 1);
         net = new MiniGraph ({}, 20);
-        net.hexpand = true;
         grid.attach (net, 5, 1, 1, 1);
 
         shutdown_button = new Button.with_label (_("Force Shutdown"));


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