[gtk+/wip/baedert/children: 3/13] widget: Use gtk_widget_forall instead of gtk_container_forall
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/children: 3/13] widget: Use gtk_widget_forall instead of gtk_container_forall
- Date: Fri, 18 Nov 2016 09:18:10 +0000 (UTC)
commit 2c80b7474637b0362da3a111a7c2a3ef33857df4
Author: Timm Bäder <mail baedert org>
Date: Fri Nov 18 09:46:34 2016 +0100
widget: Use gtk_widget_forall instead of gtk_container_forall
gtk/gtkwidget.c | 91 ++++++++++++++++++++++--------------------------------
1 files changed, 37 insertions(+), 54 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 316a4f1..11a2185 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -4542,8 +4542,8 @@ gtk_widget_set_device_enabled_internal (GtkWidget *widget,
g_list_foreach (window_list, device_enable_foreach_window, &data);
}
- if (recurse && GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget), device_enable_foreach, &data);
+ if (recurse)
+ gtk_widget_forall (widget, device_enable_foreach, &data);
}
static void
@@ -8677,10 +8677,9 @@ gtk_widget_propagate_hierarchy_changed_recurse (GtkWidget *widget,
g_signal_emit (widget, widget_signals[HIERARCHY_CHANGED], 0, info->previous_toplevel);
do_screen_change (widget, info->previous_screen, info->new_screen);
- if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget),
- gtk_widget_propagate_hierarchy_changed_recurse,
- client_data);
+ gtk_widget_forall (widget,
+ gtk_widget_propagate_hierarchy_changed_recurse,
+ client_data);
g_object_unref (widget);
}
@@ -8734,8 +8733,7 @@ gtk_widget_propagate_screen_changed_recurse (GtkWidget *widget,
do_screen_change (widget, info->previous_screen, info->new_screen);
- if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget),
+ gtk_widget_forall (widget,
gtk_widget_propagate_screen_changed_recurse,
client_data);
@@ -8773,8 +8771,7 @@ reset_style_recurse (GtkWidget *widget, gpointer data)
{
_gtk_widget_invalidate_style_context (widget, GTK_CSS_CHANGE_ANY);
- if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget),
+ gtk_widget_forall (widget,
reset_style_recurse,
NULL);
}
@@ -8965,20 +8962,15 @@ gtk_widget_pop_verify_invariants (GtkWidget *widget)
{
gtk_widget_verify_invariants (widget);
- if (GTK_IS_CONTAINER (widget))
- {
- /* Check one level of children, because our
- * push_verify_invariants() will have prevented some of the
- * checks. This does not recurse because if recursion is
- * needed, it will happen naturally as each child has a
- * push/pop on that child. For example if we're recursively
- * mapping children, we'll push/pop on each child as we map
- * it.
- */
- gtk_container_forall (GTK_CONTAINER (widget),
- gtk_widget_verify_child_invariants,
- NULL);
- }
+ /* Check one level of children, because our
+ * push_verify_invariants() will have prevented some of the
+ * checks. This does not recurse because if recursion is
+ * needed, it will happen naturally as each child has a
+ * push/pop on that child. For example if we're recursively
+ * mapping children, we'll push/pop on each child as we map
+ * it.
+ */
+ gtk_widget_forall (widget, gtk_widget_verify_child_invariants, NULL);
}
}
#endif /* G_ENABLE_CONSISTENCY_CHECKS */
@@ -9152,8 +9144,7 @@ gtk_widget_set_font_map_recurse (GtkWidget *widget, gpointer data)
gtk_widget_update_pango_context (widget);
- if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget),
+ gtk_widget_forall (widget,
gtk_widget_set_font_map_recurse,
data);
}
@@ -9187,8 +9178,7 @@ gtk_widget_set_font_map (GtkWidget *widget,
g_object_unref);
gtk_widget_update_pango_context (widget);
- if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget),
+ gtk_widget_forall (widget,
gtk_widget_set_font_map_recurse,
NULL);
}
@@ -9512,10 +9502,9 @@ _gtk_widget_scale_changed (GtkWidget *widget)
gtk_widget_queue_draw (widget);
- if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget),
- (GtkCallback) _gtk_widget_scale_changed,
- NULL);
+ gtk_widget_forall (widget,
+ (GtkCallback) _gtk_widget_scale_changed,
+ NULL);
}
/**
@@ -10394,10 +10383,9 @@ gtk_widget_set_default_direction_recurse (GtkWidget *widget, gpointer data)
if (widget->priv->direction == GTK_TEXT_DIR_NONE)
gtk_widget_emit_direction_changed (widget, old_dir);
- if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget),
- gtk_widget_set_default_direction_recurse,
- data);
+ gtk_widget_forall (widget,
+ gtk_widget_set_default_direction_recurse,
+ data);
g_object_unref (widget);
}
@@ -10811,10 +10799,9 @@ gtk_widget_real_unrealize (GtkWidget *widget)
* (for example, gdk_ic_destroy () with destroyed window causes crash.)
*/
- if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget),
- (GtkCallback) gtk_widget_unrealize,
- NULL);
+ gtk_widget_forall (widget,
+ (GtkCallback) gtk_widget_unrealize,
+ NULL);
if (_gtk_widget_get_has_window (widget))
{
@@ -11215,6 +11202,7 @@ gtk_widget_propagate_state (GtkWidget *widget,
{
GtkWidgetPrivate *priv = widget->priv;
GtkStateFlags new_flags, old_flags = priv->state_flags;
+ GtkStateData child_data;
priv->state_flags |= data->flags_to_set;
priv->state_flags &= ~(data->flags_to_unset);
@@ -11286,18 +11274,14 @@ gtk_widget_propagate_state (GtkWidget *widget,
if (!gtk_widget_is_sensitive (widget))
gtk_widget_reset_controllers (widget);
- if (GTK_IS_CONTAINER (widget))
- {
- GtkStateData child_data;
- /* Make sure to only propagate the right states further */
- child_data.flags_to_set = data->flags_to_set & GTK_STATE_FLAGS_DO_PROPAGATE;
- child_data.flags_to_unset = data->flags_to_unset & GTK_STATE_FLAGS_DO_PROPAGATE;
+ /* Make sure to only propagate the right states further */
+ child_data.flags_to_set = data->flags_to_set & GTK_STATE_FLAGS_DO_PROPAGATE;
+ child_data.flags_to_unset = data->flags_to_unset & GTK_STATE_FLAGS_DO_PROPAGATE;
- gtk_container_forall (GTK_CONTAINER (widget),
- (GtkCallback) gtk_widget_propagate_state,
- &child_data);
- }
+ gtk_widget_forall (widget,
+ (GtkCallback) gtk_widget_propagate_state,
+ &child_data);
g_object_unref (widget);
}
@@ -14516,10 +14500,9 @@ gtk_widget_ensure_allocate (GtkWidget *widget)
{
priv->alloc_needed_on_child = FALSE;
- if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget),
- (GtkCallback) gtk_widget_ensure_allocate,
- NULL);
+ gtk_widget_forall (widget,
+ (GtkCallback) gtk_widget_ensure_allocate,
+ NULL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]