inspector: Show the pango backend
authorMatthias Clasen <mclasen@redhat.com>
Sun, 28 Jul 2019 15:39:16 +0000 (11:39 -0400)
committerJan Tojnar <jtojnar@gmail.com>
Thu, 23 Mar 2023 17:59:40 +0000 (18:59 +0100)
(cherry picked from commit 7eb5dfd2947c8e8de0957f4339af66b47811f2c7)

gtk/inspector/general.c
gtk/inspector/general.ui

index 4fd0c3039c0c06a345eaccda7f49fce3fdb068fd..3c2c7056ee6f083a27530c16027b419f384ac6f8 100644 (file)
@@ -62,6 +62,7 @@ struct _GtkInspectorGeneralPrivate
   GtkWidget *device_box;
   GtkWidget *gtk_version;
   GtkWidget *gdk_backend;
+  GtkWidget *pango_fontmap;
   GtkWidget *app_id_frame;
   GtkWidget *app_id;
   GtkWidget *resource_path;
@@ -500,6 +501,27 @@ init_display (GtkInspectorGeneral *gen)
   populate_display (screen, gen);
 }
 
+static void
+init_pango (GtkInspectorGeneral *gen)
+{
+  PangoFontMap *fontmap;
+  const char *type;
+  const char *name;
+
+  fontmap = pango_cairo_font_map_get_default ();
+  type = G_OBJECT_TYPE_NAME (fontmap);
+  if (strcmp (type, "PangoCairoFcFontMap") == 0)
+    name = "fontconfig";
+  else if (strcmp (type, "PangoCairoCoreTextFontMap") == 0)
+    name = "coretext";
+  else if (strcmp (type, "PangoCairoWin32FontMap") == 0)
+    name = "win32";
+  else
+    name = type;
+
+  gtk_label_set_label (GTK_LABEL (gen->priv->pango_fontmap), name);
+}
+
 static void populate_seats (GtkInspectorGeneral *gen);
 
 static void
@@ -670,6 +692,7 @@ gtk_inspector_general_init (GtkInspectorGeneral *gen)
   init_app_id (gen);
   init_env (gen);
   init_display (gen);
+  init_pango (gen);
   init_gl (gen);
   init_device (gen);
 }
@@ -757,6 +780,7 @@ gtk_inspector_general_class_init (GtkInspectorGeneralClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorGeneral, gl_box);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorGeneral, gtk_version);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorGeneral, gdk_backend);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorGeneral, pango_fontmap);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorGeneral, app_id_frame);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorGeneral, app_id);
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorGeneral, resource_path);
index f57771c4538ad8d88d9b702d3502b752878557a0..bd5e9c09d397b2f573bd578e5e859c8cd02fe90e 100644 (file)
                     </child>
                   </object>
                 </child>
+                <child>
+                  <object class="GtkListBoxRow">
+                    <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="pango_fontmap_label">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Pango Fontmap</property>
+                            <property name="halign">start</property>
+                            <property name="valign">baseline</property>
+                            <property name="xalign">0.0</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="pango_fontmap">
+                            <property name="visible">True</property>
+                            <property name="selectable">True</property>
+                            <property name="halign">end</property>
+                            <property name="valign">baseline</property>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
               </object>
             </child>
           </object>
     <widgets>
       <widget name="gtk_version_label"/>
       <widget name="gdk_backend_label"/>
+      <widget name="pango_fontmap_label"/>
       <widget name="app_id_label"/>
       <widget name="resource_path_label"/>
       <widget name="gl_version_label"/>