[gtk/inspector-fixes: 3/4] inspector: Rearrange settings a bit



commit c92e53622fcc8deeadf60cca340a682b6b08d176
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Apr 6 17:39:00 2019 +0000

    inspector: Rearrange settings a bit
    
    Keep only the software gl setting for GL, and put it together
    with the simulate touchscreen setting in a 'misc' box. This
    keeps all the 'show' options nicely grouped.

 gtk/inspector/visual.c  | 65 +++++++++++++++++------------------------
 gtk/inspector/visual.ui | 78 ++++++-------------------------------------------
 2 files changed, 36 insertions(+), 107 deletions(-)
---
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index 8f369139c4..7abd300098 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -35,6 +35,7 @@
 #include "gtkswitch.h"
 #include "gtkscale.h"
 #include "gtkwindow.h"
+#include "gtklistbox.h"
 
 #include "fallback-c89.c"
 
@@ -69,14 +70,10 @@ struct _GtkInspectorVisualPrivate
   GtkAdjustment *cursor_size_adjustment;
 
   GtkWidget *debug_box;
-  GtkWidget *baselines_switch;
-  GtkWidget *layout_switch;
-  GtkWidget *touchscreen_switch;
 
-  GtkWidget *gl_box;
-  GtkWidget *gl_combo;
+  GtkWidget *misc_box;
+  GtkWidget *touchscreen_switch;
   GtkWidget *software_gl_switch;
-  GtkWidget *texture_rectangle_switch;
 
   GtkAdjustment *focus_adjustment;
 
@@ -461,9 +458,12 @@ init_theme (GtkInspectorVisual *vis)
 
   if (g_getenv ("GTK_THEME") != NULL)
     {
+      GtkWidget *row;
+
       /* theme is hardcoded, nothing we can do */
       gtk_widget_set_sensitive (vis->priv->theme_combo, FALSE);
-      gtk_widget_set_tooltip_text (vis->priv->theme_combo , _("Theme is hardcoded by GTK_THEME"));
+      row = gtk_widget_get_ancestor (vis->priv->theme_combo, GTK_TYPE_LIST_BOX_ROW);
+      gtk_widget_set_tooltip_text (row, _("Theme is hardcoded by GTK_THEME"));
     }
 }
 
@@ -476,9 +476,12 @@ init_dark (GtkInspectorVisual *vis)
 
   if (g_getenv ("GTK_THEME") != NULL)
     {
+      GtkWidget *row;
+
       /* theme is hardcoded, nothing we can do */
       gtk_widget_set_sensitive (vis->priv->dark_switch, FALSE);
-      gtk_widget_set_tooltip_text (vis->priv->dark_switch, _("Theme is hardcoded by GTK_THEME"));
+      row = gtk_widget_get_ancestor (vis->priv->theme_combo, GTK_TYPE_LIST_BOX_ROW);
+      gtk_widget_set_tooltip_text (row, _("Theme is hardcoded by GTK_THEME"));
     }
 }
 
@@ -683,10 +686,12 @@ init_scale (GtkInspectorVisual *vis)
   else
 #endif
     {
+      GtkWidget *row;
+
       gtk_adjustment_set_value (vis->priv->scale_adjustment, 1);
       gtk_widget_set_sensitive (vis->priv->hidpi_spin, FALSE);
-      gtk_widget_set_tooltip_text (vis->priv->hidpi_spin,
-                                   _("Backend does not support window scaling"));
+      row = gtk_widget_get_ancestor (vis->priv->hidpi_spin, GTK_TYPE_LIST_BOX_ROW);
+      gtk_widget_set_tooltip_text (row, _("Backend does not support window scaling"));
     }
 }
 
@@ -778,10 +783,13 @@ init_touchscreen (GtkInspectorVisual *vis)
 
   if (g_getenv ("GTK_TEST_TOUCHSCREEN") != 0)
     {
+      GtkWidget *row;
+
       /* hardcoded, nothing we can do */
       gtk_switch_set_active (GTK_SWITCH (vis->priv->touchscreen_switch), TRUE);
       gtk_widget_set_sensitive (vis->priv->touchscreen_switch, FALSE);
-      gtk_widget_set_tooltip_text (vis->priv->touchscreen_switch, _("Setting is hardcoded by 
GTK_TEST_TOUCHSCREEN"));
+      row = gtk_widget_get_ancestor (vis->priv->touchscreen_switch, GTK_TYPE_LIST_BOX_ROW);
+      gtk_widget_set_tooltip_text (row, _("Setting is hardcoded by GTK_TEST_TOUCHSCREEN"));
     }
 }
 
@@ -796,12 +804,12 @@ keynav_failed (GtkWidget *widget, GtkDirectionType direction, GtkInspectorVisual
     next = vis->priv->debug_box;
   else if (direction == GTK_DIR_DOWN &&
       widget == vis->priv->debug_box)
-    next = vis->priv->gl_box;
+    next = vis->priv->misc_box;
   else if (direction == GTK_DIR_UP &&
            widget == vis->priv->debug_box)
     next = vis->priv->visual_box;
   else if (direction == GTK_DIR_UP &&
-           widget == vis->priv->gl_box)
+           widget == vis->priv->misc_box)
     next = vis->priv->debug_box;
   else
     next = NULL;
@@ -836,23 +844,15 @@ init_gl (GtkInspectorVisual *vis)
 {
   GdkDebugFlags flags = gdk_display_get_debug_flags (gdk_display_get_default ());
 
-  if (flags & GDK_DEBUG_GL_DISABLE)
-    gtk_combo_box_set_active_id (GTK_COMBO_BOX (vis->priv->gl_combo), "disable");
-  else
-    gtk_combo_box_set_active_id (GTK_COMBO_BOX (vis->priv->gl_combo), "maybe");
-  gtk_widget_set_sensitive (vis->priv->gl_combo, FALSE);
-  gtk_widget_set_tooltip_text (vis->priv->gl_combo,
-                               _("Not settable at runtime.\nUse GDK_DEBUG=gl-disable instead"));
-
   gtk_switch_set_active (GTK_SWITCH (vis->priv->software_gl_switch), flags & GDK_DEBUG_GL_SOFTWARE);
-  gtk_switch_set_active (GTK_SWITCH (vis->priv->texture_rectangle_switch), flags & 
GDK_DEBUG_GL_TEXTURE_RECT);
 
   if (flags & GDK_DEBUG_GL_DISABLE)
     {
+      GtkWidget *row;
+
       gtk_widget_set_sensitive (vis->priv->software_gl_switch, FALSE);
-      gtk_widget_set_sensitive (vis->priv->texture_rectangle_switch, FALSE);
-      gtk_widget_set_tooltip_text (vis->priv->software_gl_switch, _("GL rendering is disabled"));
-      gtk_widget_set_tooltip_text (vis->priv->texture_rectangle_switch, _("GL rendering is disabled"));
+      row = gtk_widget_get_ancestor (vis->priv->software_gl_switch, GTK_TYPE_LIST_BOX_ROW);
+      gtk_widget_set_tooltip_text (row, _("GL rendering is disabled"));
     }
 }
 
@@ -876,12 +876,6 @@ software_gl_activate (GtkSwitch *sw)
   update_gl_flag (sw, GDK_DEBUG_GL_SOFTWARE);
 }
 
-static void
-texture_rectangle_activate (GtkSwitch *sw)
-{
-  update_gl_flag (sw, GDK_DEBUG_GL_TEXTURE_RECT);
-}
-
 static void
 gtk_inspector_visual_init (GtkInspectorVisual *vis)
 {
@@ -915,7 +909,7 @@ gtk_inspector_visual_constructed (GObject *object)
 
    g_signal_connect (vis->priv->visual_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
    g_signal_connect (vis->priv->debug_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
-   g_signal_connect (vis->priv->gl_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
+   g_signal_connect (vis->priv->misc_box, "keynav-failed", G_CALLBACK (keynav_failed), vis);
 }
 
 static void
@@ -945,8 +939,6 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/visual.ui");
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, direction_combo);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, baselines_switch);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, layout_switch);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, theme_combo);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, dark_switch);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, cursor_combo);
@@ -962,10 +954,8 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, visual_box);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, debug_box);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, font_button);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, gl_box);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, gl_combo);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, misc_box);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, software_gl_switch);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, texture_rectangle_switch);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, font_scale_entry);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, font_scale_adjustment);
 
@@ -976,7 +966,6 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, layout_activate);
   gtk_widget_class_bind_template_callback (widget_class, widget_resize_activate);
   gtk_widget_class_bind_template_callback (widget_class, software_gl_activate);
-  gtk_widget_class_bind_template_callback (widget_class, texture_rectangle_activate);
 }
 
 // vim: set et sw=2 ts=2:
diff --git a/gtk/inspector/visual.ui b/gtk/inspector/visual.ui
index 1b143fd291..d86682a63d 100644
--- a/gtk/inspector/visual.ui
+++ b/gtk/inspector/visual.ui
@@ -414,7 +414,7 @@
                           </object>
                         </child>
                         <child>
-                          <object class="GtkSwitch" id="updates_switch">
+                          <object class="GtkSwitch">
                             <property name="halign">end</property>
                             <property name="valign">baseline</property>
                             <property name="hexpand">1</property>
@@ -441,7 +441,7 @@
                           </object>
                         </child>
                         <child>
-                          <object class="GtkSwitch" id="baselines_switch">
+                          <object class="GtkSwitch">
                             <property name="halign">end</property>
                             <property name="valign">baseline</property>
                             <property name="hexpand">1</property>
@@ -468,7 +468,7 @@
                           </object>
                         </child>
                         <child>
-                          <object class="GtkSwitch" id="layout_switch">
+                          <object class="GtkSwitch">
                             <property name="halign">end</property>
                             <property name="valign">baseline</property>
                             <property name="hexpand">1</property>
@@ -506,41 +506,15 @@
                     </child>
                   </object>
                 </child>
-                <child>
-                  <object class="GtkListBoxRow">
-                    <property name="activatable">0</property>
-                    <child>
-                      <object class="GtkBox">
-                        <property name="margin">10</property>
-                        <property name="spacing">40</property>
-                        <child>
-                          <object class="GtkLabel" id="touchscreen_label">
-                            <property name="label" translatable="yes">Simulate Touchscreen</property>
-                            <property name="halign">start</property>
-                            <property name="valign">baseline</property>
-                            <property name="xalign">0.0</property>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GtkSwitch" id="touchscreen_switch">
-                            <property name="halign">end</property>
-                            <property name="valign">baseline</property>
-                            <property name="hexpand">1</property>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                  </object>
-                </child>
               </object>
             </child>
           </object>
         </child>
         <child>
-          <object class="GtkFrame" id="gl_frame">
+          <object class="GtkFrame" id="misc_frame">
             <property name="halign">center</property>
             <child>
-              <object class="GtkListBox" id="gl_box">
+              <object class="GtkListBox" id="misc_box">
                 <property name="selection-mode">none</property>
                 <child>
                   <object class="GtkListBoxRow">
@@ -550,22 +524,18 @@
                         <property name="margin">10</property>
                         <property name="spacing">40</property>
                         <child>
-                          <object class="GtkLabel" id="gl_label">
-                            <property name="label" translatable="yes">GL Rendering</property>
+                          <object class="GtkLabel" id="touchscreen_label">
+                            <property name="label" translatable="yes">Simulate Touchscreen</property>
                             <property name="halign">start</property>
                             <property name="valign">baseline</property>
                             <property name="xalign">0.0</property>
                           </object>
                         </child>
                         <child>
-                          <object class="GtkComboBoxText" id="gl_combo">
+                          <object class="GtkSwitch" id="touchscreen_switch">
                             <property name="halign">end</property>
                             <property name="valign">baseline</property>
                             <property name="hexpand">1</property>
-                            <items>
-                              <item translatable="yes" id="maybe">When Needed</item>
-                              <item translatable="yes" id="disable">Disabled</item>
-                            </items>
                           </object>
                         </child>
                       </object>
@@ -599,33 +569,6 @@
                     </child>
                   </object>
                 </child>
-                <child>
-                  <object class="GtkListBoxRow">
-                    <property name="activatable">0</property>
-                    <child>
-                      <object class="GtkBox">
-                        <property name="margin">10</property>
-                        <property name="spacing">40</property>
-                        <child>
-                          <object class="GtkLabel" id="texture_rectangle_label">
-                            <property name="label" translatable="yes">Texture Rectangle Extension</property>
-                            <property name="halign">start</property>
-                            <property name="valign">baseline</property>
-                            <property name="xalign">0.0</property>
-                          </object>
-                        </child>
-                        <child>
-                          <object class="GtkSwitch" id="texture_rectangle_switch">
-                            <property name="halign">end</property>
-                            <property name="valign">baseline</property>
-                            <property name="hexpand">1</property>
-                            <signal name="notify::active" handler="texture_rectangle_activate"/>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                  </object>
-                </child>
               </object>
             </child>
           </object>
@@ -648,9 +591,7 @@
       <widget name="baselines_label"/>
       <widget name="layout_label"/>
       <widget name="touchscreen_label"/>
-      <widget name="gl_label"/>
       <widget name="software_gl_label"/>
-      <widget name="texture_rectangle_label"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup">
@@ -660,14 +601,13 @@
       <widget name="cursor_combo"/>
       <widget name="font_button"/>
       <widget name="direction_combo"/>
-      <widget name="gl_combo"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup">
     <widgets>
       <widget name="visual_frame"/>
       <widget name="debug_frame"/>
-      <widget name="gl_frame"/>
+      <widget name="misc_frame"/>
     </widgets>
   </object>
 </interface>


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