[gnome-builder] radio-box: use count before adding row



commit 734854dd5d45666fc4f404e91423ab896c658c7d
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 29 14:49:25 2016 -0700

    radio-box: use count before adding row
    
    We want the count before we add this row to get the modulus correct.

 contrib/egg/egg-radio-box.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/contrib/egg/egg-radio-box.c b/contrib/egg/egg-radio-box.c
index 22872b8..297e9e4 100644
--- a/contrib/egg/egg-radio-box.c
+++ b/contrib/egg/egg-radio-box.c
@@ -262,11 +262,14 @@ egg_radio_box_add_item (EggRadioBox *self,
 {
   EggRadioBoxPrivate *priv = egg_radio_box_get_instance_private (self);
   EggRadioBoxItem item = { 0 };
+  guint precount;
 
   g_return_if_fail (EGG_IS_RADIO_BOX (self));
   g_return_if_fail (id != NULL);
   g_return_if_fail (text != NULL);
 
+  precount = priv->items->len;
+
   item.id = g_strdup (id);
   item.text = g_strdup (text);
   item.button = g_object_new (GTK_TYPE_TOGGLE_BUTTON,
@@ -279,7 +282,7 @@ egg_radio_box_add_item (EggRadioBox *self,
 
   g_array_append_val (priv->items, item);
 
-  if (priv->items->len > 0 && (priv->items->len % N_PER_ROW) == 0)
+  if (precount > 0 && (precount % N_PER_ROW) == 0)
     {
       gboolean show_more = egg_radio_box_get_show_more (self);
       gboolean visible = !priv->has_more || show_more;


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