[gtk/matthiasc/for-master] gtk-demo: Tweak descriptions of constraints demos



commit 19052d4360d2a20b5a580f116492d617e419af09
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Oct 30 15:26:37 2020 -0400

    gtk-demo: Tweak descriptions of constraints demos
    
    Make these a little longer, and include more details.

 demos/gtk-demo/constraints.c  |  9 ++++++++-
 demos/gtk-demo/constraints2.c |  2 +-
 demos/gtk-demo/constraints3.c |  4 ++++
 demos/gtk-demo/constraints4.c | 21 ++++++++++++++++++---
 4 files changed, 31 insertions(+), 5 deletions(-)
---
diff --git a/demos/gtk-demo/constraints.c b/demos/gtk-demo/constraints.c
index 29facd12fd..2104948ad5 100644
--- a/demos/gtk-demo/constraints.c
+++ b/demos/gtk-demo/constraints.c
@@ -2,8 +2,15 @@
  * #Keywords: GtkLayoutManager
  *
  * GtkConstraintLayout provides a layout manager that uses relations
- * between widgets (also known as "constraints") to compute the position
+ * between widgets (also known as “constraints”) to compute the position
  * and size of each child.
+ *
+ * In addition to child widgets, the constraints can involve spacer
+ * objects (also known as “guides”). This example has a guide between
+ * the two buttons in the top row.
+ *
+ * Try resizing the window to see how the constraints react to update
+ * the layout.
  */
 
 #include <glib/gi18n.h>
diff --git a/demos/gtk-demo/constraints2.c b/demos/gtk-demo/constraints2.c
index d63b369739..124a5e18ef 100644
--- a/demos/gtk-demo/constraints2.c
+++ b/demos/gtk-demo/constraints2.c
@@ -1,7 +1,7 @@
 /* Constraints/Interactive
  * #Keywords: GtkConstraintLayout
  *
- * Demonstrate how constraints can be updates during user interaction.
+ * This example shows how constraints can be updated during user interaction.
  * The vertical edge between the buttons can be dragged with the mouse.
  */
 
diff --git a/demos/gtk-demo/constraints3.c b/demos/gtk-demo/constraints3.c
index 0cb9b97702..d702f75430 100644
--- a/demos/gtk-demo/constraints3.c
+++ b/demos/gtk-demo/constraints3.c
@@ -2,6 +2,10 @@
  *
  * GtkConstraintLayout allows defining constraints using a
  * compact syntax called Visual Format Language, or VFL.
+ *
+ * A typical example of a VFL specification looks like this:
+ *
+ * H:|-[button1(==button2)]-12-[button2]-|
  */
 
 #include <glib/gi18n.h>
diff --git a/demos/gtk-demo/constraints4.c b/demos/gtk-demo/constraints4.c
index 8bde6af653..4b4ca49643 100644
--- a/demos/gtk-demo/constraints4.c
+++ b/demos/gtk-demo/constraints4.c
@@ -1,8 +1,8 @@
 /* Constraints/Builder
  *
- * GtkConstraintLayouts can be created in .ui files, and
- * constraints can be set up at that time as well, as this
- * example demonstrates.
+ * GtkConstraintLayouts can be created in .ui files, and constraints can be
+ * set up at that time as well, as this example demonstrates. It uses the
+ * same setup as the “Simple” constraints demo.
  */
 
 #include <glib/gi18n.h>
@@ -22,9 +22,24 @@ constraints_grid_init (ConstraintsGrid *grid)
 {
 }
 
+static void
+constraints_grid_dispose (GObject *object)
+{
+  GtkWidget *widget = GTK_WIDGET (object);
+  GtkWidget *child;
+
+  while ((child = gtk_widget_get_first_child (widget)))
+    gtk_widget_unparent (child);
+
+  G_OBJECT_CLASS (constraints_grid_parent_class)->dispose (object);
+}
+
 static void
 constraints_grid_class_init (ConstraintsGridClass *klass)
 {
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->dispose = constraints_grid_dispose;
 }
 
 GtkWidget *


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