[gtk+] inspector: Show the size request mode



commit 150728d6b03b7eca175b9100b27a2f6633216899
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Nov 30 22:27:27 2015 -0500

    inspector: Show the size request mode
    
    This is not a property, so show it in the misc page.

 gtk/inspector/misc-info.c  |   12 ++++++++++++
 gtk/inspector/misc-info.ui |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c
index 6138f62..71684d2 100644
--- a/gtk/inspector/misc-info.c
+++ b/gtk/inspector/misc-info.c
@@ -51,6 +51,8 @@ struct _GtkInspectorMiscInfoPrivate {
   GtkWidget *focus_widget_button;
   GtkWidget *mnemonic_label_row;
   GtkWidget *mnemonic_label;
+  GtkWidget *request_mode_row;
+  GtkWidget *request_mode;
   GtkWidget *allocated_size_row;
   GtkWidget *allocated_size;
   GtkWidget *clip_area_row;
@@ -133,6 +135,8 @@ allocation_changed (GtkWidget *w, GdkRectangle *allocation, GtkInspectorMiscInfo
 {
   GtkAllocation clip;
   gchar *size_label;
+  GEnumClass *class;
+  GEnumValue *value;
 
   size_label = g_strdup_printf ("%d × %d",
                                 gtk_widget_get_allocated_width (w),
@@ -156,6 +160,11 @@ allocation_changed (GtkWidget *w, GdkRectangle *allocation, GtkInspectorMiscInfo
       gtk_label_set_label (GTK_LABEL (sl->priv->clip_area), size_label);
       g_free (size_label);
     }
+
+  class = G_ENUM_CLASS (g_type_class_ref (GTK_TYPE_SIZE_REQUEST_MODE));
+  value = g_enum_get_value (class, gtk_widget_get_request_mode (w));
+  gtk_label_set_label (GTK_LABEL (sl->priv->request_mode), value->value_nick);
+  g_type_class_unref (class);
 }
 
 static void
@@ -409,6 +418,7 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
     {
       gtk_widget_show (sl->priv->refcount_row);
       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->mnemonic_label_row);
       gtk_widget_show (sl->priv->tick_callback_row);
@@ -579,6 +589,8 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, focus_widget_button);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, mnemonic_label_row);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, mnemonic_label);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, request_mode_row);
+  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, clip_area_row);
diff --git a/gtk/inspector/misc-info.ui b/gtk/inspector/misc-info.ui
index 8707c28..f7beb52 100644
--- a/gtk/inspector/misc-info.ui
+++ b/gtk/inspector/misc-info.ui
@@ -286,6 +286,40 @@
                 </child>
 
                 <child>
+                  <object class="GtkListBoxRow" id="request_mode_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">Request mode</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="request_mode">
+                            <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="allocated_size_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]