[gtk+/wip/baedert/children: 10/13] inspector: Show child widgets of widgets
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/children: 10/13] inspector: Show child widgets of widgets
- Date: Fri, 18 Nov 2016 09:18:45 +0000 (UTC)
commit 131530f056158dcf40b49d97aae3232500286d0a
Author: Timm Bäder <mail baedert org>
Date: Tue Nov 15 16:49:41 2016 +0100
inspector: Show child widgets of widgets
gtk/inspector/inspect-button.c | 6 ++--
gtk/inspector/object-tree.c | 65 ++++++++++++++++------------------------
gtk/inspector/visual.c | 3 +-
3 files changed, 30 insertions(+), 44 deletions(-)
---
diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c
index 241a2d6..4b27c4f 100644
--- a/gtk/inspector/inspect-button.c
+++ b/gtk/inspector/inspect-button.c
@@ -121,9 +121,9 @@ find_widget (GtkWidget *widget,
new_data.found = FALSE;
new_data.first = FALSE;
- gtk_container_forall (GTK_CONTAINER (widget),
- (GtkCallback)find_widget,
- &new_data);
+ gtk_widget_forall (widget,
+ (GtkCallback)find_widget,
+ &new_data);
data->found = new_data.found;
if (data->found)
diff --git a/gtk/inspector/object-tree.c b/gtk/inspector/object-tree.c
index e129d6e..3e6ba03 100644
--- a/gtk/inspector/object-tree.c
+++ b/gtk/inspector/object-tree.c
@@ -125,6 +125,26 @@ object_tree_widget_get_parent (GObject *object)
return G_OBJECT (gtk_widget_get_parent (GTK_WIDGET (object)));
}
+static gboolean
+object_tree_widget_get_sensitive (GObject *object)
+{
+ return gtk_widget_get_mapped (GTK_WIDGET (object));
+}
+
+typedef struct {
+ ObjectTreeForallFunc forall_func;
+ gpointer forall_data;
+} ForallData;
+
+static void
+widget_children_callback (GtkWidget *widget,
+ gpointer client_data)
+{
+ ForallData *forall_data = client_data;
+
+ forall_data->forall_func (G_OBJECT (widget), NULL, forall_data->forall_data);
+}
+
static void
object_tree_widget_forall (GObject *object,
ObjectTreeForallFunc forall_func,
@@ -139,6 +159,10 @@ object_tree_widget_forall (GObject *object,
{ GTK_PHASE_BUBBLE, "bubble" },
{ GTK_PHASE_NONE, "" }
};
+ ForallData data = {
+ forall_func,
+ forall_data
+ };
gint i;
for (i = 0; i < G_N_ELEMENTS (phases); i++)
@@ -162,40 +186,9 @@ object_tree_widget_forall (GObject *object,
if (clock)
forall_func (clock, "frame-clock", forall_data);
}
-}
-
-static gboolean
-object_tree_widget_get_sensitive (GObject *object)
-{
- return gtk_widget_get_mapped (GTK_WIDGET (object));
-}
-
-typedef struct {
- ObjectTreeForallFunc forall_func;
- gpointer forall_data;
-} ForallData;
-
-static void
-container_children_callback (GtkWidget *widget,
- gpointer client_data)
-{
- ForallData *forall_data = client_data;
-
- forall_data->forall_func (G_OBJECT (widget), NULL, forall_data->forall_data);
-}
-
-static void
-object_tree_container_forall (GObject *object,
- ObjectTreeForallFunc forall_func,
- gpointer forall_data)
-{
- ForallData data = {
- forall_func,
- forall_data
- };
- gtk_container_forall (GTK_CONTAINER (object),
- container_children_callback,
+ gtk_widget_forall (GTK_WIDGET (object),
+ widget_children_callback,
&data);
}
@@ -457,12 +450,6 @@ static const ObjectTreeClassFuncs object_tree_class_funcs[] = {
object_tree_widget_get_sensitive
},
{
- gtk_container_get_type,
- object_tree_widget_get_parent,
- object_tree_container_forall,
- object_tree_widget_get_sensitive
- },
- {
gtk_widget_get_type,
object_tree_widget_get_parent,
object_tree_widget_forall,
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index 8c44401..d44b6f2 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -88,8 +88,7 @@ fix_direction_recurse (GtkWidget *widget,
g_object_ref (widget);
gtk_widget_set_direction (widget, dir);
- if (GTK_IS_CONTAINER (widget))
- gtk_container_forall (GTK_CONTAINER (widget), fix_direction_recurse, data);
+ gtk_widget_forall (widget, fix_direction_recurse, data);
g_object_unref (widget);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]