[gtk+/gtk-3-14] GtkStack: Remove some clumsy use of GList API
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-14] GtkStack: Remove some clumsy use of GList API
- Date: Thu, 27 Nov 2014 01:25:11 +0000 (UTC)
commit 8a2bf9f853840d7bc10507936a23e29aff401a97
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Nov 10 18:45:58 2014 -0500
GtkStack: Remove some clumsy use of GList API
No need for g_list_next(), and don't open-code g_list_index().
gtk/gtkstack.c | 17 ++++-------------
1 files changed, 4 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index 144724e..b85fd8e 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -523,13 +523,13 @@ reorder_child (GtkStack *stack,
}
}
- l = g_list_next (l);
+ l = l->next;
num++;
}
g_return_if_fail (old_link != NULL);
- if (old_link == new_link || (g_list_next (old_link) == NULL && new_link == NULL))
+ if (old_link == new_link || (old_link->next == NULL && new_link == NULL))
return;
priv->children = g_list_delete_link (priv->children, old_link);
@@ -548,8 +548,6 @@ gtk_stack_get_child_property (GtkContainer *container,
GtkStack *stack = GTK_STACK (container);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
GtkStackChildInfo *info;
- GList *list;
- guint i;
info = find_child_info_for_widget (stack, child);
if (info == NULL)
@@ -573,14 +571,7 @@ gtk_stack_get_child_property (GtkContainer *container,
break;
case CHILD_PROP_POSITION:
- i = 0;
- for (list = priv->children; list != NULL; list = g_list_next (list))
- {
- if (info == list->data)
- break;
- ++i;
- }
- g_value_set_int (value, i);
+ g_value_set_int (value, g_list_index (priv->children, info));
break;
case CHILD_PROP_NEEDS_ATTENTION:
@@ -1012,7 +1003,7 @@ set_visible_child (GtkStack *stack,
else if (is_direction_dependent_transition (transition_type))
{
gboolean i_first = FALSE;
- for (l = priv->children; l != NULL; l = g_list_next (l))
+ for (l = priv->children; l != NULL; l = l->next)
{
if (child_info == l->data)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]