[ease/builder: 34/34] Add the spin buttons



commit e3e114684b15a300d74e5748ba69b0ce081ed2d2
Author: Stéphane Maniaci <stephane maniaci gmail com>
Date:   Mon Jul 12 12:01:55 2010 -0500

    Add the spin buttons

 data/ui/welcome-window.ui    |   12 ++++++++++++
 src/ease-welcome-window.vala |   40 +++++++++++++++-------------------------
 2 files changed, 27 insertions(+), 25 deletions(-)
---
diff --git a/data/ui/welcome-window.ui b/data/ui/welcome-window.ui
index 501f883..d21e8ec 100644
--- a/data/ui/welcome-window.ui
+++ b/data/ui/welcome-window.ui
@@ -23,6 +23,7 @@
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="invisible_char">&#x25CF;</property>
+            <property name="adjustment">adjustment1</property>
           </object>
           <packing>
             <property name="position">1</property>
@@ -33,6 +34,7 @@
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="invisible_char">&#x25CF;</property>
+            <property name="adjustment">adjustment2</property>
           </object>
           <packing>
             <property name="position">2</property>
@@ -74,4 +76,14 @@
       </packing>
     </child>
   </object>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
 </interface>
diff --git a/src/ease-welcome-window.vala b/src/ease-welcome-window.vala
index d9f589d..d9ba8e0 100644
--- a/src/ease-welcome-window.vala
+++ b/src/ease-welcome-window.vala
@@ -100,12 +100,16 @@ public class Ease.WelcomeWindow : Gtk.Window
 		var vbox = builder.get_object ("vbox1") as Gtk.VBox;
 		var hbox = builder.get_object ("hbox1") as Gtk.HBox;
 		var combores = builder.get_object ("combo_resolution") as Gtk.ComboBox;
+		x_res = builder.get_object ("horiz_spin") as Gtk.SpinButton;
+		y_res = builder.get_object ("vert_spin") as Gtk.SpinButton;
 
+		// zoom slider
 		zoom_slider = new ZoomSlider(new Gtk.Adjustment(100, 100, 400, 10,
 		                                                50, 50), ZOOM_VALUES);
 		hbox.pack_start (zoom_slider, false, false);
 		hbox.reorder_child (zoom_slider, 4);
 
+		// Resolutions combo box
 		// FIXME : not re-create it, or do it from Glade.
 		hbox.remove (combores);
 		combores = new Gtk.ComboBox.text ();
@@ -117,34 +121,20 @@ public class Ease.WelcomeWindow : Gtk.Window
 		hbox.pack_start (combores);
 		hbox.reorder_child (combores, 0);
 
-		this.add (vbox);
+		// resolutions spin buttons
+		// FIXME : new SpinButton.with_range () avoid the need
+		// of a Gtk.Adjustments, but here I had to create them with
+		// Glade. Find a way to use the older, simpler way.
+		var resolution_count = RESOLUTIONS_X.length;
+		x_res.set_range(RESOLUTIONS_X[0],
+						RESOLUTIONS_X[resolution_count-1]);
 
+		y_res.set_range(RESOLUTIONS_Y[0],
+						RESOLUTIONS_Y[resolution_count-1]);
+
+		this.add (vbox);
 		this.show_all ();
 /*		// build the bottom UI
-		var hbox = new Gtk.HBox(false, 5);
-		resolution = new Gtk.ComboBox.text();
-		resolution.append_text(_("Custom"));
-		var align = new Gtk.Alignment(0, 0.5f, 0, 0);
-		align.add(resolution);
-		hbox.pack_start(align, false, false, 0);
-		
-		var resolution_count = RESOLUTIONS_X.length;
-		x_res = new Gtk.SpinButton.with_range(RESOLUTIONS_X[0],
-											  RESOLUTIONS_X[resolution_count-1],
-											  1);
-											  
-		align = new Gtk.Alignment(0, 0.5f, 0, 0);
-		align.add(x_res);
-		hbox.pack_start(align, false, false, 0);
-		
-		y_res = new Gtk.SpinButton.with_range(RESOLUTIONS_Y[0],
-											  RESOLUTIONS_Y[resolution_count-1],
-											  1);
-		
-		align = new Gtk.Alignment(0, 0.5f, 0, 0);
-		align.add(y_res);
-		hbox.pack_start(align, false, false, 0);
-		
 		new_button = new Gtk.Button.with_label(_("New Presentation"));
 		new_button.sensitive = false;
 		new_button.image = new Gtk.Image.from_stock("gtk-new",



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