[glide] Man property bindings are cool



commit 06ebbb7eca4b47d5adb1b01c5c08d0545f97ccef
Author: Robert Carr <racarr Valentine localdomain>
Date:   Fri May 7 19:20:30 2010 -0400

    Man property bindings are cool

 libglide/glide-inspector-shape-priv.h |    1 +
 libglide/glide-inspector-shape.c      |   23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/libglide/glide-inspector-shape-priv.h b/libglide/glide-inspector-shape-priv.h
index da0051b..d2192b8 100644
--- a/libglide/glide-inspector-shape-priv.h
+++ b/libglide/glide-inspector-shape-priv.h
@@ -30,6 +30,7 @@ struct _GlideInspectorShapePrivate
   
   GtkWidget *color_button;
   GtkWidget *border_color_button;
+  GtkWidget *width_spin;
   
   GlideMutualBindingPool *pool;
 };
diff --git a/libglide/glide-inspector-shape.c b/libglide/glide-inspector-shape.c
index dfd090a..96a0efa 100644
--- a/libglide/glide-inspector-shape.c
+++ b/libglide/glide-inspector-shape.c
@@ -62,6 +62,9 @@ glide_inspector_shape_bind (GlideInspectorShape *ins)
 								       G_OBJECT (ins->priv->color_button));
   glide_inspector_shape_make_color_binding (ins, G_OBJECT (ins->priv->actor), "border-color",
 					    G_OBJECT (ins->priv->border_color_button));
+  glide_mutual_binding_pool_add_full (ins->priv->pool, G_OBJECT (ins->priv->actor), "border-width",
+				      G_OBJECT (ins->priv->width_spin), "value",
+				      NULL, NULL);
 }
 
 static void
@@ -149,15 +152,35 @@ glide_inspector_shape_make_border_color_box (GlideInspectorShape *ins)
   return ret;
 }
 
+static GtkWidget *
+glide_inspector_shape_make_border_width_box (GlideInspectorShape *ins)
+{
+  GtkWidget *ret = gtk_hbox_new (FALSE, 10);
+  GtkWidget *width_label = gtk_label_new (NULL);
+  GtkWidget *al = gtk_alignment_new (1, 0, 0.4, 1);
+  ins->priv->width_spin = gtk_spin_button_new_with_range (0, 100, 0.1);
+
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (ins->priv->width_spin), 1.0);
+  gtk_label_set_markup (GTK_LABEL (width_label), "<b>Border Width:</b>");
+  
+  gtk_container_add (GTK_CONTAINER (al), ins->priv->width_spin);
+  gtk_box_pack_start (GTK_BOX (ret), width_label, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (ret), al, TRUE, TRUE, 0);
+  
+  return ret;    
+}
+
 static void
 glide_inspector_shape_setup_ui (GlideInspectorShape *ins)
 {
   GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
   GtkWidget *color_box = glide_inspector_shape_make_color_box (ins);
   GtkWidget *border_color_box = glide_inspector_shape_make_border_color_box (ins);
+  GtkWidget *border_width_box = glide_inspector_shape_make_border_width_box (ins);
   
   gtk_box_pack_start (GTK_BOX (vbox), color_box, FALSE, FALSE, 0);
   gtk_box_pack_start (GTK_BOX (vbox), border_color_box, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), border_width_box, FALSE, FALSE, 0);
   
   gtk_container_add (GTK_CONTAINER (ins), vbox);
 }



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