[gtk+] GtkListBox: Make reseparate a no-op for hidden lists
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkListBox: Make reseparate a no-op for hidden lists
- Date: Thu, 13 Jun 2013 10:18:49 +0000 (UTC)
commit 1eb729dcd91c7e490d669dcb0e5f574c4e966003
Author: Alexander Larsson <alexl redhat com>
Date: Tue Jun 11 16:04:58 2013 +0200
GtkListBox: Make reseparate a no-op for hidden lists
We already take care to not track headers when the listbox is hidden,
because that can be very expensive during creation, so we might as
well skip reseparate() too. The only time we don't want to skip it
is when we're about to show the list.
gtk/gtklistbox.c | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 20e8d98..8292977 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -815,6 +815,21 @@ gtk_list_box_resort (GtkListBox *list_box)
gtk_widget_queue_resize (GTK_WIDGET (list_box));
}
+static void
+gtk_list_box_do_reseparate (GtkListBox *list_box)
+{
+ GtkListBoxPrivate *priv = list_box->priv;
+ GSequenceIter *iter;
+
+ for (iter = g_sequence_get_begin_iter (priv->children);
+ !g_sequence_iter_is_end (iter);
+ iter = g_sequence_iter_next (iter))
+ gtk_list_box_update_header (list_box, iter);
+
+ gtk_widget_queue_resize (GTK_WIDGET (list_box));
+}
+
+
/**
* gtk_list_box_reseparate:
* @list_box: a #GtkListBox
@@ -828,17 +843,12 @@ gtk_list_box_resort (GtkListBox *list_box)
void
gtk_list_box_reseparate (GtkListBox *list_box)
{
- GtkListBoxPrivate *priv = list_box->priv;
- GSequenceIter *iter;
-
g_return_if_fail (list_box != NULL);
- for (iter = g_sequence_get_begin_iter (priv->children);
- !g_sequence_iter_is_end (iter);
- iter = g_sequence_iter_next (iter))
- gtk_list_box_update_header (list_box, iter);
+ if (!gtk_widget_get_visible (GTK_WIDGET (list_box)))
+ return;
- gtk_widget_queue_resize (GTK_WIDGET (list_box));
+ gtk_list_box_do_reseparate (list_box);
}
/**
@@ -1186,7 +1196,7 @@ gtk_list_box_real_show (GtkWidget *widget)
{
GtkListBox * list_box = GTK_LIST_BOX (widget);
- gtk_list_box_reseparate (list_box);
+ gtk_list_box_do_reseparate (list_box);
GTK_WIDGET_CLASS (gtk_list_box_parent_class)->show (widget);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]