inspector: Show object address

This is useful information when running the application
in a debugger.
https://bugzilla.gnome.org/show_bug.cgi?id=742518
This commit is contained in:
Matthias Clasen 2015-01-09 00:07:01 -05:00
parent 79f806fdab
commit 80969e34bc
3 changed files with 47 additions and 2 deletions

View File

@ -36,6 +36,7 @@ struct _GtkInspectorMiscInfoPrivate {
GObject *object;
GtkWidget *address;
GtkWidget *refcount_row;
GtkWidget *refcount;
GtkWidget *state_row;
@ -258,7 +259,7 @@ show_focus_widget (GtkWidget *button, GtkInspectorMiscInfo *sl)
widget = gtk_window_get_focus (GTK_WINDOW (sl->priv->object));
if (widget)
show_object (sl, G_OBJECT (widget), "properties");
show_object (sl, G_OBJECT (widget), "properties");
}
static void
@ -277,13 +278,17 @@ update_info (gpointer data)
GtkInspectorMiscInfo *sl = data;
gchar *tmp;
tmp = g_strdup_printf ("%p", sl->priv->object);
gtk_label_set_text (GTK_LABEL (sl->priv->address), tmp);
g_free (tmp);
if (G_IS_OBJECT (sl->priv->object))
{
tmp = g_strdup_printf ("%d", sl->priv->object->ref_count);
gtk_label_set_text (GTK_LABEL (sl->priv->refcount), tmp);
g_free (tmp);
}
if (GTK_IS_WIDGET (sl->priv->object))
{
AtkObject *accessible;
@ -549,6 +554,7 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass)
GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/misc-info.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, address);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, refcount_row);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, refcount);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, state_row);

View File

@ -26,6 +26,40 @@
<object class="GtkListBox">
<property name="visible">True</property>
<property name="selection-mode">none</property>
<child>
<object class="GtkListBoxRow" id="address_row">
<property name="visible">True</property>
<property name="activatable">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="margin">10</property>
<property name="spacing">40</property>
<child>
<object class="GtkLabel" id="address_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Address</property>
<property name="halign">start</property>
<property name="valign">baseline</property>
<property name="xalign">0.0</property>
</object>
<packing>
<property name="expand">True</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="address">
<property name="visible">True</property>
<property name="selectable">True</property>
<property name="halign">end</property>
<property name="valign">baseline</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="refcount_row">
<property name="visible">True</property>
@ -153,6 +187,7 @@
<child>
<object class="GtkLabel" id="default_widget">
<property name="visible">True</property>
<property name="selectable">True</property>
<property name="halign">end</property>
<property name="valign">baseline</property>
</object>
@ -195,6 +230,7 @@
<child>
<object class="GtkLabel" id="focus_widget">
<property name="visible">True</property>
<property name="selectable">True</property>
<property name="halign">end</property>
<property name="valign">baseline</property>
<property name="ellipsize">end</property>
@ -609,6 +645,8 @@
<object class="GtkSizeGroup">
<property name="mode">horizontal</property>
<widgets>
<widget name="address_label"/>
<widget name="refcount_label"/>
<widget name="state_label"/>
<widget namel="buildable_id_label"/>
<widget name="default_widget_label"/>

View File

@ -1,3 +1,4 @@
N_("Address");
N_("Reference count");
N_("State");
N_("Buildable ID");