[gtk+] inspector: Don't show internal build ids
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] inspector: Don't show internal build ids
- Date: Thu, 15 May 2014 23:36:25 +0000 (UTC)
commit e170f31e2a321168adbfd16bd74fb822d57dc093
Author: Matthias Clasen <mclasen redhat com>
Date: Thu May 15 15:24:44 2014 -0400
inspector: Don't show internal build ids
These ___object_x___ ids just clutter up the tree.
gtk/inspector/widget-tree.c | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/gtk/inspector/widget-tree.c b/gtk/inspector/widget-tree.c
index fcb1b52..11d868f 100644
--- a/gtk/inspector/widget-tree.c
+++ b/gtk/inspector/widget-tree.c
@@ -223,27 +223,33 @@ gtk_inspector_widget_tree_append_object (GtkInspectorWidgetTree *wt,
{
GtkTreeIter iter;
GtkTreePath *path;
- const gchar *class_name = G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (object));
+ const gchar *class_name;
gchar *address;
gboolean mapped;
ObjectData *od;
const gchar *label;
- label = NULL;
- mapped = FALSE;
+ if (GTK_IS_WIDGET (object))
+ mapped = gtk_widget_get_mapped (GTK_WIDGET (object));
+ else
+ mapped = TRUE;
+
+ class_name = G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (object));
if (GTK_IS_WIDGET (object))
{
- GtkWidget *widget = GTK_WIDGET (object);
- if (name == NULL)
- name = gtk_widget_get_name (GTK_WIDGET (object));
- mapped = gtk_widget_get_mapped (widget);
+ const gchar *id;
+ id = gtk_widget_get_name (GTK_WIDGET (object));
+ if (name == NULL && id != NULL && g_strcmp0 (id, class_name) != 0)
+ name = id;
}
- if (name == NULL || g_strcmp0 (name, class_name) == 0)
+ if (GTK_IS_BUILDABLE (object))
{
- if (GTK_IS_BUILDABLE (object))
- name = gtk_buildable_get_name (GTK_BUILDABLE (object));
+ const gchar *id;
+ id = gtk_buildable_get_name (GTK_BUILDABLE (object));
+ if (name == NULL && id != NULL && !g_str_has_prefix (id, "___object_"))
+ name = id;
}
if (name == NULL)
@@ -269,7 +275,7 @@ gtk_inspector_widget_tree_append_object (GtkInspectorWidgetTree *wt,
OBJECT_NAME, name,
OBJECT_LABEL, label,
OBJECT_ADDRESS, address,
- SENSITIVE, !GTK_IS_WIDGET (object) || mapped,
+ SENSITIVE, mapped,
-1);
od = g_new0 (ObjectData, 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]