[gthumb] DumbNotebook: changed the forall implementation to simplify the remove function
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] DumbNotebook: changed the forall implementation to simplify the remove function
- Date: Thu, 17 Nov 2011 17:29:38 +0000 (UTC)
commit ad3b03ccce1c8ad623532399936793c6553efea0
Author: Paolo Bacchilega <paobac src gnome org>
Date: Thu Nov 17 14:03:25 2011 +0100
DumbNotebook: changed the forall implementation to simplify the remove function
gthumb/gth-dumb-notebook.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/gthumb/gth-dumb-notebook.c b/gthumb/gth-dumb-notebook.c
index d435964..dc76896 100644
--- a/gthumb/gth-dumb-notebook.c
+++ b/gthumb/gth-dumb-notebook.c
@@ -239,22 +239,19 @@ gth_dumb_notebook_remove (GtkContainer *container,
GtkWidget *child)
{
GthDumbNotebook *notebook;
+ GList *link;
notebook = GTH_DUMB_NOTEBOOK (container);
- if (g_list_find (notebook->priv->children, child) == NULL)
+ link = g_list_find (notebook->priv->children, child);
+ if (link == NULL)
return;
- g_object_ref (child);
gtk_widget_unparent (child);
- /* do not modify the children list during destruction otherwise
- * gtk_container_forall doesn't work correctly. */
- if (! gtk_widget_in_destruction (GTK_WIDGET (container)))
- notebook->priv->children = g_list_remove (notebook->priv->children, child);
+ notebook->priv->children = g_list_remove_link (notebook->priv->children, link);
notebook->priv->n_children--;
-
- g_object_unref (child);
+ g_list_free (link);
}
@@ -269,8 +266,12 @@ gth_dumb_notebook_forall (GtkContainer *container,
notebook = GTH_DUMB_NOTEBOOK (container);
- for (scan = notebook->priv->children; scan; scan = scan->next)
- (* callback) (scan->data, callback_data);
+ for (scan = notebook->priv->children; scan; /* void */) {
+ GtkWidget *child = scan->data;
+
+ scan = scan->next;
+ (* callback) (child, callback_data);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]