[libhandy] keypad: Make it inherit from GtkBin



commit e390d105f84cbb4de8bee1049e49a54e3a861ec7
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue May 26 13:56:34 2020 +0200

    keypad: Make it inherit from GtkBin
    
    This prevents users from directly accessing the grid.
    
    This breaks the demo as it uses the row-spacing and column-spacing
    properties from GtkGrid, they will be added in the next commit.

 doc/hdy-migrating-0-0-to-1.xml |   8 +
 src/hdy-keypad.c               |  22 ++-
 src/hdy-keypad.h               |   4 +-
 src/hdy-keypad.ui              | 379 +++++++++++++++++++++--------------------
 tests/test-keypad.c            |  16 +-
 5 files changed, 226 insertions(+), 203 deletions(-)
---
diff --git a/doc/hdy-migrating-0-0-to-1.xml b/doc/hdy-migrating-0-0-to-1.xml
index 5bca748d..e5e510c6 100644
--- a/doc/hdy-migrating-0-0-to-1.xml
+++ b/doc/hdy-migrating-0-0-to-1.xml
@@ -226,6 +226,14 @@
       </para>
     </refsect3>
 
+    <refsect3>
+      <title>Adapt to HdyKeypad API changes</title>
+      <para>
+        #HdyKeypad doesn't subclass #Gtkgrid anymore. Instead, it subclasses
+        #GtkBin and contains a grid.
+      </para>
+    </refsect3>
+
   </refsect2>
 
 </refentry>
diff --git a/src/hdy-keypad.c b/src/hdy-keypad.c
index e2301ef1..065fc89f 100644
--- a/src/hdy-keypad.c
+++ b/src/hdy-keypad.c
@@ -29,6 +29,7 @@
 typedef struct
 {
   GtkWidget *entry;
+  GtkWidget *grid;
   GtkWidget *label_asterisk;
   GtkWidget *label_hash;
   GtkGesture *long_press_zero_gesture;
@@ -36,7 +37,7 @@ typedef struct
   gboolean show_symbols;
 } HdyKeypadPrivate;
 
-G_DEFINE_TYPE_WITH_PRIVATE (HdyKeypad, hdy_keypad, GTK_TYPE_GRID)
+G_DEFINE_TYPE_WITH_PRIVATE (HdyKeypad, hdy_keypad, GTK_TYPE_BIN)
 
 enum {
   PROP_0,
@@ -277,6 +278,7 @@ hdy_keypad_class_init (HdyKeypadClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class,
                                                "/sm/puri/handy/ui/hdy-keypad.ui");
+  gtk_widget_class_bind_template_child_private (widget_class, HdyKeypad, grid);
   gtk_widget_class_bind_template_child_private (widget_class, HdyKeypad, label_asterisk);
   gtk_widget_class_bind_template_child_private (widget_class, HdyKeypad, label_hash);
   gtk_widget_class_bind_template_child_private (widget_class, HdyKeypad, long_press_zero_gesture);
@@ -423,20 +425,23 @@ void
 hdy_keypad_set_left_action (HdyKeypad *self,
                             GtkWidget *widget)
 {
+  HdyKeypadPrivate *priv;
   GtkWidget *old_widget;
 
   g_return_if_fail (HDY_IS_KEYPAD (self));
 
-  old_widget = gtk_grid_get_child_at (GTK_GRID (self), 0, 3);
+  priv = hdy_keypad_get_instance_private (self);
+
+  old_widget = gtk_grid_get_child_at (GTK_GRID (priv->grid), 0, 3);
 
   if (old_widget == widget)
     return;
 
   if (old_widget != NULL)
-    gtk_container_remove (GTK_CONTAINER (self), old_widget);
+    gtk_container_remove (GTK_CONTAINER (priv->grid), old_widget);
 
   if (widget != NULL)
-    gtk_grid_attach (GTK_GRID (self), widget, 0, 3, 1, 1);
+    gtk_grid_attach (GTK_GRID (priv->grid), widget, 0, 3, 1, 1);
 
   g_object_notify_by_pspec (G_OBJECT (self), props[PROP_LEFT_ACTION]);
 }
@@ -454,20 +459,23 @@ void
 hdy_keypad_set_right_action (HdyKeypad *self,
                              GtkWidget *widget)
 {
+  HdyKeypadPrivate *priv;
   GtkWidget *old_widget;
 
   g_return_if_fail (HDY_IS_KEYPAD (self));
 
-  old_widget = gtk_grid_get_child_at (GTK_GRID (self), 2, 3);
+  priv = hdy_keypad_get_instance_private (self);
+
+  old_widget = gtk_grid_get_child_at (GTK_GRID (priv->grid), 2, 3);
 
   if (old_widget == widget)
     return;
 
   if (old_widget != NULL)
-    gtk_container_remove (GTK_CONTAINER (self), old_widget);
+    gtk_container_remove (GTK_CONTAINER (priv->grid), old_widget);
 
   if (widget != NULL)
-    gtk_grid_attach (GTK_GRID (self), widget, 2, 3, 1, 1);
+    gtk_grid_attach (GTK_GRID (priv->grid), widget, 2, 3, 1, 1);
 
   g_object_notify_by_pspec (G_OBJECT (self), props[PROP_RIGHT_ACTION]);
 }
diff --git a/src/hdy-keypad.h b/src/hdy-keypad.h
index 67089b3e..49fc9e43 100644
--- a/src/hdy-keypad.h
+++ b/src/hdy-keypad.h
@@ -16,7 +16,7 @@ G_BEGIN_DECLS
 
 #define HDY_TYPE_KEYPAD (hdy_keypad_get_type())
 
-G_DECLARE_DERIVABLE_TYPE (HdyKeypad, hdy_keypad, HDY, KEYPAD, GtkGrid)
+G_DECLARE_DERIVABLE_TYPE (HdyKeypad, hdy_keypad, HDY, KEYPAD, GtkBin)
 
 /**
  * HdyKeypadClass:
@@ -24,7 +24,7 @@ G_DECLARE_DERIVABLE_TYPE (HdyKeypad, hdy_keypad, HDY, KEYPAD, GtkGrid)
  */
 struct _HdyKeypadClass
 {
-  GtkGridClass parent_class;
+  GtkBinClass parent_class;
 };
 
 GtkWidget       *hdy_keypad_new                     (gboolean only_digits,
diff --git a/src/hdy-keypad.ui b/src/hdy-keypad.ui
index 8faf3dec..35006459 100644
--- a/src/hdy-keypad.ui
+++ b/src/hdy-keypad.ui
@@ -1,205 +1,210 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="3.20"/>
-  <template class="HdyKeypad" parent="GtkGrid">
-    <property name="can_focus">True</property>
-    <property name="hexpand">False</property>
-    <property name="vexpand">False</property>
-    <property name="column_homogeneous">True</property>
-    <property name="column_homogeneous">True</property>
+  <template class="HdyKeypad" parent="GtkBin">
     <child>
-      <object class="HdyKeypadButton" id="btn_1">
-        <property name="symbols">1</property>
+      <object class="GtkGrid" id="grid">
         <property name="visible">True</property>
         <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="focus_on_click">False</property>
-        <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
-        <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="HdyKeypadButton" id="btn_2">
-        <property name="symbols">2ABC</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="focus_on_click">False</property>
-        <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
-        <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
-      </object>
-      <packing>
-        <property name="left_attach">1</property>
-        <property name="top_attach">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="HdyKeypadButton" id="btn_3">
-        <property name="symbols">3DEF</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="focus_on_click">False</property>
-        <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
-        <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
-      </object>
-      <packing>
-        <property name="left_attach">2</property>
-        <property name="top_attach">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="HdyKeypadButton" id="btn_4">
-        <property name="symbols">4GHI</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="focus_on_click">False</property>
-        <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
-        <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="HdyKeypadButton" id="btn_5">
-        <property name="symbols">5JKL</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="focus_on_click">False</property>
-        <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
-        <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
-      </object>
-      <packing>
-        <property name="left_attach">1</property>
-        <property name="top_attach">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="HdyKeypadButton" id="btn_6">
-        <property name="symbols">6MNO</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="focus_on_click">False</property>
-        <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
-        <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
-      </object>
-      <packing>
-        <property name="left_attach">2</property>
-        <property name="top_attach">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="HdyKeypadButton" id="btn_7">
-        <property name="symbols">7PQRS</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="focus_on_click">False</property>
-        <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
-        <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="HdyKeypadButton" id="btn_8">
-        <property name="symbols">8TUV</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="focus_on_click">False</property>
-        <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
-        <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
-      </object>
-      <packing>
-        <property name="left_attach">1</property>
-        <property name="top_attach">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="HdyKeypadButton" id="btn_9">
-        <property name="symbols">9WXYZ</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="focus_on_click">False</property>
-        <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
-        <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
-      </object>
-      <packing>
-        <property name="left_attach">2</property>
-        <property name="top_attach">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkButton" id="btn_asterisk">
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="focus_on_click">False</property>
-        <property name="visible" bind-source="HdyKeypad" bind-property="only-digits" bind-flags="sync-create 
| invert-boolean"/>
-        <signal name="clicked" handler="asterisk_button_clicked_cb" swapped="true"/>
+        <property name="hexpand">False</property>
+        <property name="vexpand">False</property>
+        <property name="column_homogeneous">True</property>
+        <property name="column_homogeneous">True</property>
         <child>
-          <object class="GtkLabel" id="label_asterisk">
+          <object class="HdyKeypadButton" id="btn_1">
+            <property name="symbols">1</property>
             <property name="visible">True</property>
-            <property name="label">∗</property>
-            <style>
-              <class name="symbol"/>
-            </style>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="focus_on_click">False</property>
+            <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
+            <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
           </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="HdyKeypadButton" id="btn_2">
+            <property name="symbols">2ABC</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="focus_on_click">False</property>
+            <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
+            <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="HdyKeypadButton" id="btn_3">
+            <property name="symbols">3DEF</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="focus_on_click">False</property>
+            <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
+            <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="HdyKeypadButton" id="btn_4">
+            <property name="symbols">4GHI</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="focus_on_click">False</property>
+            <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
+            <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="HdyKeypadButton" id="btn_5">
+            <property name="symbols">5JKL</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="focus_on_click">False</property>
+            <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
+            <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+          </packing>
         </child>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="HdyKeypadButton" id="btn_0">
-        <property name="symbols">0+</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="focus_on_click">False</property>
-        <property name="show-symbols" bind-source="HdyKeypad" bind-property="only-digits" 
bind-flags="sync-create|invert-boolean"/>
-        <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
-      </object>
-      <packing>
-        <property name="left_attach">1</property>
-        <property name="top_attach">3</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkButton" id="btn_hash">
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="focus_on_click">False</property>
-        <property name="visible" bind-source="HdyKeypad" bind-property="only-digits" bind-flags="sync-create 
| invert-boolean"/>
-        <signal name="clicked" handler="hash_button_clicked_cb" swapped="true"/>
         <child>
-          <object class="GtkLabel" id="label_hash">
+          <object class="HdyKeypadButton" id="btn_6">
+            <property name="symbols">6MNO</property>
             <property name="visible">True</property>
-            <property name="label">#</property>
-            <style>
-              <class name="symbol"/>
-            </style>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="focus_on_click">False</property>
+            <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
+            <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="HdyKeypadButton" id="btn_7">
+            <property name="symbols">7PQRS</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="focus_on_click">False</property>
+            <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
+            <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="HdyKeypadButton" id="btn_8">
+            <property name="symbols">8TUV</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="focus_on_click">False</property>
+            <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
+            <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="HdyKeypadButton" id="btn_9">
+            <property name="symbols">9WXYZ</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="focus_on_click">False</property>
+            <property name="show-symbols" bind-source="HdyKeypad" bind-property="show-symbols" 
bind-flags="sync-create"/>
+            <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="btn_asterisk">
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="focus_on_click">False</property>
+            <property name="visible" bind-source="HdyKeypad" bind-property="only-digits" 
bind-flags="sync-create | invert-boolean"/>
+            <signal name="clicked" handler="asterisk_button_clicked_cb" swapped="true"/>
+            <child>
+              <object class="GtkLabel" id="label_asterisk">
+                <property name="visible">True</property>
+                <property name="label">∗</property>
+                <style>
+                  <class name="symbol"/>
+                </style>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="HdyKeypadButton" id="btn_0">
+            <property name="symbols">0+</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="focus_on_click">False</property>
+            <property name="show-symbols" bind-source="HdyKeypad" bind-property="only-digits" 
bind-flags="sync-create|invert-boolean"/>
+            <signal name="clicked" handler="button_clicked_cb" swapped="true"/>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="btn_hash">
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="focus_on_click">False</property>
+            <property name="visible" bind-source="HdyKeypad" bind-property="only-digits" 
bind-flags="sync-create | invert-boolean"/>
+            <signal name="clicked" handler="hash_button_clicked_cb" swapped="true"/>
+            <child>
+              <object class="GtkLabel" id="label_hash">
+                <property name="visible">True</property>
+                <property name="label">#</property>
+                <style>
+                  <class name="symbol"/>
+                </style>
+              </object>
+            </child>
           </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">3</property>
+          </packing>
         </child>
       </object>
-      <packing>
-        <property name="left_attach">2</property>
-        <property name="top_attach">3</property>
-      </packing>
     </child>
   </template>
   <object class="GtkGestureLongPress" id="long_press_zero_gesture">
diff --git a/tests/test-keypad.c b/tests/test-keypad.c
index bb0d7ef4..e617c40b 100644
--- a/tests/test-keypad.c
+++ b/tests/test-keypad.c
@@ -43,24 +43,25 @@ static void
 test_hdy_keypad_set_actions (void)
 {
   HdyKeypad *keypad = HDY_KEYPAD (hdy_keypad_new (FALSE, TRUE));
+  GtkGrid *grid = GTK_GRID (gtk_bin_get_child (GTK_BIN (keypad)));
   GtkWidget *button_right = gtk_button_new ();
   GtkWidget *button_left = gtk_button_new ();
 
   // Right extra button
-  g_assert (gtk_grid_get_child_at (GTK_GRID (keypad), 2, 3) != NULL);
+  g_assert (gtk_grid_get_child_at (grid, 2, 3) != NULL);
   // Left extra button
-  g_assert (gtk_grid_get_child_at (GTK_GRID (keypad), 0, 3) != NULL);
+  g_assert (gtk_grid_get_child_at (grid, 0, 3) != NULL);
 
   hdy_keypad_set_right_action (keypad, button_right);
   hdy_keypad_set_left_action (keypad, button_left);
-  g_assert (button_right == gtk_grid_get_child_at (GTK_GRID (keypad), 2, 3));
-  g_assert (button_left == gtk_grid_get_child_at (GTK_GRID (keypad), 0, 3));
+  g_assert (button_right == gtk_grid_get_child_at (grid, 2, 3));
+  g_assert (button_left == gtk_grid_get_child_at (grid, 0, 3));
 
   hdy_keypad_set_right_action (keypad, NULL);
-  g_assert (gtk_grid_get_child_at (GTK_GRID (keypad), 2, 3) == NULL);
+  g_assert (gtk_grid_get_child_at (grid, 2, 3) == NULL);
 
   hdy_keypad_set_left_action (keypad, NULL);
-  g_assert (gtk_grid_get_child_at (GTK_GRID (keypad), 0, 3) == NULL);
+  g_assert (gtk_grid_get_child_at (grid, 0, 3) == NULL);
 }
 
 
@@ -68,6 +69,7 @@ static void
 test_hdy_keypad_button_clicked (void)
 {
   HdyKeypad *keypad = HDY_KEYPAD (hdy_keypad_new (FALSE, TRUE));
+  GtkWidget *grid = gtk_bin_get_child (GTK_BIN (keypad));
   GtkWidget *entry = gtk_entry_new ();
   GList *l;
   GList *list;
@@ -78,7 +80,7 @@ test_hdy_keypad_button_clicked (void)
 
   g_signal_connect (hdy_keypad_get_entry (keypad), "insert-text", G_CALLBACK (notify_cb), NULL);
 
-  list = gtk_container_get_children (GTK_CONTAINER (keypad));
+  list = gtk_container_get_children (GTK_CONTAINER (grid));
 
   for (l = list; l != NULL; l = l->next) {
     if (HDY_IS_KEYPAD_BUTTON(l->data)) {


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