[gtk+] inspector: Show baseline value



commit 57baf6804b63a598db49e2ffcc548dc46b145bea
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 22 22:24:46 2016 -0500

    inspector: Show baseline value
    
    The misc info page already shows the allocation and clip areas,
    the baseline fits right in.

 gtk/inspector/misc-info.c  |   10 ++++++++++
 gtk/inspector/misc-info.ui |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c
index 7ad9d75..cc54d05 100644
--- a/gtk/inspector/misc-info.c
+++ b/gtk/inspector/misc-info.c
@@ -55,6 +55,8 @@ struct _GtkInspectorMiscInfoPrivate {
   GtkWidget *request_mode;
   GtkWidget *allocated_size_row;
   GtkWidget *allocated_size;
+  GtkWidget *baseline_row;
+  GtkWidget *baseline;
   GtkWidget *clip_area_row;
   GtkWidget *clip_area;
   GtkWidget *tick_callback_row;
@@ -147,6 +149,10 @@ allocation_changed (GtkWidget *w, GdkRectangle *allocation, GtkInspectorMiscInfo
   gtk_label_set_label (GTK_LABEL (sl->priv->allocated_size), size_label);
   g_free (size_label);
 
+  size_label = g_strdup_printf ("%d", gtk_widget_get_allocated_baseline (w));
+  gtk_label_set_label (GTK_LABEL (sl->priv->baseline), size_label);
+  g_free (size_label);
+
   gtk_widget_get_clip (w, &clip);
 
   size_label = g_strdup_printf ("%d × %d +%d +%d",
@@ -414,6 +420,7 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
       gtk_widget_show (sl->priv->state_row);
       gtk_widget_show (sl->priv->request_mode_row);
       gtk_widget_show (sl->priv->allocated_size_row);
+      gtk_widget_show (sl->priv->baseline_row);
       gtk_widget_show (sl->priv->clip_area_row);
       gtk_widget_show (sl->priv->mnemonic_label_row);
       gtk_widget_show (sl->priv->tick_callback_row);
@@ -437,6 +444,7 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
       gtk_widget_hide (sl->priv->request_mode_row);
       gtk_widget_hide (sl->priv->mnemonic_label_row);
       gtk_widget_hide (sl->priv->allocated_size_row);
+      gtk_widget_hide (sl->priv->baseline_row);
       gtk_widget_hide (sl->priv->clip_area_row);
       gtk_widget_hide (sl->priv->tick_callback_row);
       gtk_widget_hide (sl->priv->accessible_role_row);
@@ -589,6 +597,8 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, request_mode);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, allocated_size_row);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, allocated_size);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, baseline_row);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, baseline);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, clip_area_row);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, clip_area);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, tick_callback_row);
diff --git a/gtk/inspector/misc-info.ui b/gtk/inspector/misc-info.ui
index 7cc1c22..5ed19d3 100644
--- a/gtk/inspector/misc-info.ui
+++ b/gtk/inspector/misc-info.ui
@@ -354,6 +354,40 @@
                 </child>
 
                 <child>
+                  <object class="GtkListBoxRow" id="baseline_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">
+                            <property name="visible">true</property>
+                            <property name="label" translatable="yes">Baseline</property>
+                            <property name="halign">start</property>
+                            <property name="valign">baseline</property>
+                            <property name="xalign">0</property>
+                          </object>
+                          <packing>
+                            <property name="expand">true</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="baseline">
+                            <property name="visible">true</property>
+                            <property name="halign">end</property>
+                            <property name="valign">baseline</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+
+                <child>
                   <object class="GtkListBoxRow" id="clip_area_row">
                     <property name="visible">true</property>
                     <property name="activatable">false</property>


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