[gnome-boxes/wip/ui-files: 6/7] tmp



commit 516b996960e671e719b3dbb762f2a217308066a3
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Jan 2 19:31:44 2014 +0000

    tmp

 data/gnome-boxes.gresource.xml |    1 +
 data/ui/wizard-scrolled.ui     |   20 ++++++++++++++++++++
 src/wizard-source.vala         |   17 ++++++++++-------
 3 files changed, 31 insertions(+), 7 deletions(-)
---
diff --git a/data/gnome-boxes.gresource.xml b/data/gnome-boxes.gresource.xml
index 9d07baa..ce518e6 100644
--- a/data/gnome-boxes.gresource.xml
+++ b/data/gnome-boxes.gresource.xml
@@ -6,5 +6,6 @@
     <file>icons/boxes-dark.png</file>
     <file>icons/boxes-gray.png</file>
     <file preprocess="xml-stripblanks">ui/unattended-setup-box.ui</file>
+    <file preprocess="xml-stripblanks">ui/wizard-scrolled.ui</file>
   </gresource>
 </gresources>
diff --git a/data/ui/wizard-scrolled.ui b/data/ui/wizard-scrolled.ui
new file mode 100644
index 0000000..a9e48f4
--- /dev/null
+++ b/data/ui/wizard-scrolled.ui
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.9 -->
+  <template class="BoxesWizardScrolled" parent="GtkScrolledWindow">
+    <property name="visible">True</property>
+    <property name="hscrollbar-policy">never</property>
+    <property name="vscrollbar-policy">automatic</property>
+    <property name="no-show-all">True</property>
+    <style>
+      <class name="boxes-menu-scrolled"/>
+    </style>
+    <child>
+      <object class="GtkBox" id="vbox">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">0</property>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index ea7add2..5eecf34 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -11,12 +11,18 @@ public delegate bool ClickedFunc ();
 
 /* Subclass of ScrolledWindow that shows at allocates enough
    space to not scroll for at most N children. */
+[GtkTemplate (ui = "/org/gnome/Boxes/ui/wizard-scrolled.ui")]
 private class Boxes.WizardScrolled : Gtk.ScrolledWindow {
+    [GtkChild]
+    public Gtk.Box vbox;
+
     private int num_visible;
     public WizardScrolled (int num_visible) {
         this.num_visible = num_visible;
-        this.get_style_context ().add_class ("boxes-menu-scrolled");
-        this.set_policy (Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
+
+        notify["num-visible"].connect (() => {
+            queue_resize ();
+        });
         get_vscrollbar ().show.connect (() => {
             this.get_style_context ().add_class ("boxes-menu-scrolled");
             this.reset_style ();
@@ -83,7 +89,7 @@ private class Boxes.WizardSource: GLib.Object {
 
     private Gtk.Box main_vbox;
     private Gtk.Box media_vbox;
-    private Gtk.ScrolledWindow media_scrolled;
+    private Boxes.WizardScrolled media_scrolled;
     private Gtk.Notebook notebook;
     private Gtk.Label url_label;
     private Gtk.Image url_image;
@@ -109,10 +115,7 @@ private class Boxes.WizardSource: GLib.Object {
         notebook.append_page (main_vbox, null);
 
         media_scrolled = new WizardScrolled (5);
-
-        media_vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
-        media_scrolled.set_no_show_all (true);
-        media_scrolled.add_with_viewport (media_vbox);
+        media_vbox = media_scrolled.vbox;
         main_vbox.add (media_scrolled);
 
         var hbox = add_entry (main_vbox, () => {


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