[gtk+] inspector: Simplify populating the tree
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] inspector: Simplify populating the tree
- Date: Fri, 26 Sep 2014 13:51:01 +0000 (UTC)
commit e7bd73f2b0db50c00ef390b756c6597674d7b473
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Sep 26 09:49:47 2014 -0400
inspector: Simplify populating the tree
No need to loop toplevels in two places.
gtk/inspector/inspect-button.c | 3 ---
gtk/inspector/widget-tree.c | 5 +++--
gtk/inspector/window.c | 28 +++-------------------------
3 files changed, 6 insertions(+), 30 deletions(-)
---
diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c
index 1c3135f..b30b363 100644
--- a/gtk/inspector/inspect-button.c
+++ b/gtk/inspector/inspect-button.c
@@ -212,9 +212,6 @@ select_widget (GtkInspectorWindow *iw,
gtk_notebook_set_current_page (GTK_NOTEBOOK (iw->top_notebook), 0);
- gtk_inspector_widget_tree_scan (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree),
- gtk_widget_get_toplevel (widget));
-
gtk_inspector_widget_tree_select_object (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree),
G_OBJECT (widget));
}
diff --git a/gtk/inspector/widget-tree.c b/gtk/inspector/widget-tree.c
index 8fd6130..507513f 100644
--- a/gtk/inspector/widget-tree.c
+++ b/gtk/inspector/widget-tree.c
@@ -497,6 +497,9 @@ gtk_inspector_widget_tree_scan (GtkInspectorWidgetTree *wt,
if (g_application_get_default ())
gtk_inspector_widget_tree_append_object (wt, G_OBJECT (g_application_get_default ()), NULL, NULL);
+ if (window)
+ gtk_inspector_widget_tree_append_object (wt, G_OBJECT (window), NULL, NULL);
+
inspector_win = gtk_widget_get_toplevel (GTK_WIDGET (wt));
toplevels = gtk_window_list_toplevels ();
for (l = toplevels; l; l = l->next)
@@ -509,8 +512,6 @@ gtk_inspector_widget_tree_scan (GtkInspectorWidgetTree *wt,
}
g_list_free (toplevels);
- gtk_inspector_widget_tree_append_object (wt, G_OBJECT (window), NULL, NULL);
-
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (wt));
}
diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c
index 9957128..3e3750d 100644
--- a/gtk/inspector/window.c
+++ b/gtk/inspector/window.c
@@ -153,35 +153,13 @@ gtk_inspector_window_init (GtkInspectorWindow *iw)
}
static void
-gtk_inspector_window_select_initially (GtkInspectorWindow *iw)
-{
- GList *toplevels, *l;
- GtkWidget *widget;
-
- toplevels = gtk_window_list_toplevels ();
- widget = NULL;
- for (l = toplevels; l; l = l->next)
- {
- if (gtk_widget_get_mapped (GTK_WIDGET (l->data)) &&
- GTK_IS_WINDOW (l->data) &&
- !GTK_INSPECTOR_IS_WINDOW (l->data))
- {
- widget = l->data;
- break;
- }
- }
- g_list_free (toplevels);
-
- if (widget)
- gtk_inspector_widget_tree_scan (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree), widget);
-}
-
-static void
gtk_inspector_window_constructed (GObject *object)
{
- gtk_inspector_window_select_initially (GTK_INSPECTOR_WINDOW (object));
+ GtkInspectorWindow *iw = GTK_INSPECTOR_WINDOW (object);
G_OBJECT_CLASS (gtk_inspector_window_parent_class)->constructed (object);
+
+ gtk_inspector_widget_tree_scan (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree), NULL);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]