[gtk/event-recorder: 4/5] inspector: More tweaks to the recorder




commit 1028ca08413a2aa4a75adc074db60d41d41359d9
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Dec 14 19:51:35 2021 -0500

    inspector: More tweaks to the recorder
    
    Put the two left columns in a stack, and add
    an empty page there. This will let us add
    other recording types in the future, with
    their own pages.

 gtk/inspector/recorder.c  |  11 +++-
 gtk/inspector/recorder.ui | 124 +++++++++++++++++++++++++++-------------------
 2 files changed, 84 insertions(+), 51 deletions(-)
---
diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c
index a1d3b2b0cb..b7b423f11c 100644
--- a/gtk/inspector/recorder.c
+++ b/gtk/inspector/recorder.c
@@ -39,6 +39,7 @@
 #include <gtk/gtktreelistmodel.h>
 #include <gtk/gtktreemodel.h>
 #include <gtk/gtktreeview.h>
+#include <gtk/gtkstack.h>
 #include <gsk/gskrendererprivate.h>
 #include <gsk/gskrendernodeprivate.h>
 #include <gsk/gskroundedrectprivate.h>
@@ -70,6 +71,7 @@ struct _GtkInspectorRecorder
   GtkWidget *render_node_save_button;
   GtkWidget *render_node_clip_button;
   GtkWidget *node_property_tree;
+  GtkWidget *recording_data_stack;
   GtkTreeModel *render_node_properties;
 
   GtkInspectorRecording *recording; /* start recording if recording or NULL if not */
@@ -433,7 +435,10 @@ recording_selected (GtkSingleSelection   *selection,
   GtkInspectorRecording *recording;
 
   if (recorder->recordings == NULL)
-    return;
+    {
+      gtk_stack_set_visible_child_name (GTK_STACK (recorder->recording_data_stack), "no_data");
+      return;
+    }
 
   recording = gtk_single_selection_get_selected_item (selection);
 
@@ -443,6 +448,8 @@ recording_selected (GtkSingleSelection   *selection,
       GskRenderNode *node;
       GdkPaintable *paintable;
 
+      gtk_stack_set_visible_child_name (GTK_STACK (recorder->recording_data_stack), "frame_data");
+
       node = gtk_inspector_render_recording_get_node (GTK_INSPECTOR_RENDER_RECORDING (recording));
       gsk_render_node_get_bounds (node, &bounds);
       paintable = gtk_render_node_paintable_new (node, &bounds);
@@ -456,6 +463,7 @@ recording_selected (GtkSingleSelection   *selection,
     }
   else
     {
+      gtk_stack_set_visible_child_name (GTK_STACK (recorder->recording_data_stack), "no_data");
       gtk_picture_set_paintable (GTK_PICTURE (recorder->render_node_view), NULL);
       g_list_store_remove_all (recorder->render_node_root_model);
     }
@@ -1511,6 +1519,7 @@ gtk_inspector_recorder_class_init (GtkInspectorRecorderClass *klass)
   gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, render_node_save_button);
   gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, render_node_clip_button);
   gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, node_property_tree);
+  gtk_widget_class_bind_template_child (widget_class, GtkInspectorRecorder, recording_data_stack);
 
   gtk_widget_class_bind_template_callback (widget_class, recordings_clear_all);
   gtk_widget_class_bind_template_callback (widget_class, recording_selected);
diff --git a/gtk/inspector/recorder.ui b/gtk/inspector/recorder.ui
index 7a2e64e6df..cc2eb4a2a6 100644
--- a/gtk/inspector/recorder.ui
+++ b/gtk/inspector/recorder.ui
@@ -86,76 +86,100 @@
               <object class="GtkSeparator"/>
             </child>
             <child>
-              <object class="GtkScrolledWindow">
-                <property name="hscrollbar-policy">never</property>
-                <property name="propagate-natural-width">1</property>
+              <object class="GtkStack" id="recording_data_stack">
                 <child>
-                  <object class="GtkListView" id="render_node_list">
-                    <property name="vexpand">1</property>
-                    <property name="hexpand">1</property>
+                  <object class="GtkStackPage">
+                    <property name="name">no_data</property>
+                    <property name="child">
+                      <object class="GtkLabel">
+                        <property name="label">No data.</property>
+                        <property name="halign">center</property>
+                        <property name="valign">center</property>
+                      </object>
+                    </property>
                   </object>
                 </child>
-              </object>
-            </child>
-            <child>
-              <object class="GtkSeparator"/>
-            </child>
-            <child>
-              <object class="GtkPaned" id="render_paned">
-                <property name="orientation">vertical</property>
-                <property name="position">300</property>
-                <property name="wide-handle">1</property>
                 <child>
-                  <object class="GtkScrolledWindow">
-                    <child>
-                      <object class="GtkTreeView" id="node_property_tree">
-                        <property name="activate-on-single-click">1</property>
-                        <signal name="row-activated" handler="node_property_activated"/>
+                  <object class="GtkStackPage">
+                    <property name="name">frame_data</property>
+                    <property name="child">
+                      <object class="GtkPaned">
+                        <property name="position">400</property>
+                        <property name="wide-handle">1</property>
                         <child>
-                          <object class="GtkTreeViewColumn">
-                            <property name="title" translatable="yes">Property</property>
+                          <object class="GtkScrolledWindow">
+                            <property name="propagate-natural-width">1</property>
                             <child>
-                              <object class="GtkCellRendererText">
-                                <property name="yalign">0</property>
+                              <object class="GtkListView" id="render_node_list">
+                                <property name="vexpand">1</property>
+                                <property name="hexpand">1</property>
                               </object>
-                              <attributes>
-                                <attribute name="text">0</attribute>
-                              </attributes>
                             </child>
                           </object>
                         </child>
                         <child>
-                          <object class="GtkTreeViewColumn">
-                            <property name="title" translatable="yes">Value</property>
+                          <object class="GtkPaned" id="render_paned">
+                            <property name="orientation">vertical</property>
+                            <property name="position">200</property>
+                            <property name="wide-handle">1</property>
                             <child>
-                              <object class="GtkCellRendererText">
-                                <property name="yalign">0</property>
-                                <property name="wrap-mode">word</property>
-                                <property name="max-width-chars">50</property>
+                              <object class="GtkScrolledWindow">
+                                <property name="propagate-natural-width">1</property>
+                                <child>
+                                  <object class="GtkTreeView" id="node_property_tree">
+                                    <property name="activate-on-single-click">1</property>
+                                    <signal name="row-activated" handler="node_property_activated"/>
+                                    <child>
+                                      <object class="GtkTreeViewColumn">
+                                        <property name="title" translatable="yes">Property</property>
+                                        <child>
+                                          <object class="GtkCellRendererText">
+                                            <property name="yalign">0</property>
+                                          </object>
+                                          <attributes>
+                                            <attribute name="text">0</attribute>
+                                          </attributes>
+                                        </child>
+                                      </object>
+                                    </child>
+                                    <child>
+                                      <object class="GtkTreeViewColumn">
+                                        <property name="title" translatable="yes">Value</property>
+                                        <child>
+                                          <object class="GtkCellRendererText">
+                                            <property name="yalign">0</property>
+                                            <property name="wrap-mode">word</property>
+                                            <property name="max-width-chars">50</property>
+                                          </object>
+                                          <attributes>
+                                            <attribute name="text">1</attribute>
+                                          </attributes>
+                                        </child>
+                                        <child>
+                                          <object class="GtkCellRendererPixbuf">
+                                            <property name="xalign">0</property>
+                                          </object>
+                                          <attributes>
+                                            <attribute name="visible">2</attribute>
+                                            <attribute name="texture">3</attribute>
+                                          </attributes>
+                                        </child>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
                               </object>
-                              <attributes>
-                                <attribute name="text">1</attribute>
-                              </attributes>
                             </child>
                             <child>
-                              <object class="GtkCellRendererPixbuf">
-                                <property name="xalign">0</property>
+                              <object class="GtkPicture" id="render_node_view">
+                                <property name="hexpand">1</property>
+                                <property name="vexpand">1</property>
                               </object>
-                              <attributes>
-                                <attribute name="visible">2</attribute>
-                                <attribute name="texture">3</attribute>
-                              </attributes>
                             </child>
                           </object>
                         </child>
                       </object>
-                    </child>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkPicture" id="render_node_view">
-                    <property name="hexpand">1</property>
-                    <property name="vexpand">1</property>
+                    </property>
                   </object>
                 </child>
               </object>


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