[gtk+] inspector: Show object address



commit 80969e34bc9078255e803d630f434f48b0ade3ae
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 9 00:07:01 2015 -0500

    inspector: Show object address
    
    This is useful information when running the application
    in a debugger.
    https://bugzilla.gnome.org/show_bug.cgi?id=742518

 gtk/inspector/misc-info.c    |   10 ++++++++--
 gtk/inspector/misc-info.ui   |   38 ++++++++++++++++++++++++++++++++++++++
 gtk/inspector/misc-info.ui.h |    1 +
 3 files changed, 47 insertions(+), 2 deletions(-)
---
diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c
index 4502695..d390c16 100644
--- a/gtk/inspector/misc-info.c
+++ b/gtk/inspector/misc-info.c
@@ -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);
diff --git a/gtk/inspector/misc-info.ui b/gtk/inspector/misc-info.ui
index c8c75bc..c51814d 100644
--- a/gtk/inspector/misc-info.ui
+++ b/gtk/inspector/misc-info.ui
@@ -27,6 +27,40 @@
                 <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>
                     <property name="activatable">False</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"/>
diff --git a/gtk/inspector/misc-info.ui.h b/gtk/inspector/misc-info.ui.h
index a09a285..d843c09 100644
--- a/gtk/inspector/misc-info.ui.h
+++ b/gtk/inspector/misc-info.ui.h
@@ -1,3 +1,4 @@
+N_("Address");
 N_("Reference count");
 N_("State");
 N_("Buildable ID");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]