[gtk/wip/hadess/app-id-inspector] inspector: Show app ID and resource path in the General tab
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/hadess/app-id-inspector] inspector: Show app ID and resource path in the General tab
- Date: Thu, 17 Feb 2022 11:27:38 +0000 (UTC)
commit 5c92e6ddc69037844c5d23979f287018045659e7
Author: Bastien Nocera <hadess hadess net>
Date: Thu Feb 17 12:24:51 2022 +0100
inspector: Show app ID and resource path in the General tab
This makes it easier to figure out those values (which are mentioned in
the GtkApplication documentation) rather than working that out from the
way they're generated (or documented as being generated).
gtk/inspector/general.c | 25 ++++++++++++++
gtk/inspector/general.ui | 84 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 109 insertions(+)
---
diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c
index 48237d1ea5..4fd0c3039c 100644
--- a/gtk/inspector/general.c
+++ b/gtk/inspector/general.c
@@ -62,6 +62,9 @@ struct _GtkInspectorGeneralPrivate
GtkWidget *device_box;
GtkWidget *gtk_version;
GtkWidget *gdk_backend;
+ GtkWidget *app_id_frame;
+ GtkWidget *app_id;
+ GtkWidget *resource_path;
GtkWidget *gl_version;
GtkWidget *gl_vendor;
GtkWidget *prefix;
@@ -119,6 +122,24 @@ init_version (GtkInspectorGeneral *gen)
gtk_label_set_text (GTK_LABEL (gen->priv->gdk_backend), backend);
}
+static void
+init_app_id (GtkInspectorGeneral *gen)
+{
+ GApplication *app;
+
+ app = g_application_get_default ();
+ if (!app)
+ {
+ gtk_widget_hide (gen->priv->app_id_frame);
+ return;
+ }
+
+ gtk_label_set_text (GTK_LABEL (gen->priv->app_id),
+ g_application_get_application_id (app));
+ gtk_label_set_text (GTK_LABEL (gen->priv->resource_path),
+ g_application_get_resource_base_path (app));
+}
+
static G_GNUC_UNUSED void
add_check_row (GtkInspectorGeneral *gen,
GtkListBox *list,
@@ -646,6 +667,7 @@ gtk_inspector_general_init (GtkInspectorGeneral *gen)
gen->priv = gtk_inspector_general_get_instance_private (gen);
gtk_widget_init_template (GTK_WIDGET (gen));
init_version (gen);
+ init_app_id (gen);
init_env (gen);
init_display (gen);
init_gl (gen);
@@ -735,6 +757,9 @@ 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, 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);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorGeneral, gl_version);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorGeneral, gl_vendor);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorGeneral, prefix);
diff --git a/gtk/inspector/general.ui b/gtk/inspector/general.ui
index e2ff8e9250..f57771c453 100644
--- a/gtk/inspector/general.ui
+++ b/gtk/inspector/general.ui
@@ -91,6 +91,87 @@
</object>
</child>
+ <child>
+ <object class="GtkFrame" id="app_id_frame">
+ <property name="visible">True</property>
+ <property name="halign">center</property>
+ <child>
+ <object class="GtkListBox" id="app_id_box">
+ <property name="visible">True</property>
+ <property name="selection-mode">none</property>
+ <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="app_id_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Application ID</property>
+ <property name="halign">start</property>
+ <property name="valign">baseline</property>
+ <property name="xalign">0.0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="app_id">
+ <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>
+ <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="resource_path_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Resource Path</property>
+ <property name="halign">start</property>
+ <property name="valign">baseline</property>
+ <property name="xalign">0.0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="resource_path">
+ <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>
+ </child>
+
<child>
<object class="GtkFrame" id="env_frame">
<property name="visible">True</property>
@@ -569,6 +650,8 @@
<widgets>
<widget name="gtk_version_label"/>
<widget name="gdk_backend_label"/>
+ <widget name="app_id_label"/>
+ <widget name="resource_path_label"/>
<widget name="gl_version_label"/>
<widget name="gl_vendor_label"/>
<widget name="prefix_label"/>
@@ -587,6 +670,7 @@
<property name="mode">horizontal</property>
<widgets>
<widget name="version_frame"/>
+ <widget name="app_id_frame"/>
<widget name="gl_frame"/>
<widget name="env_frame"/>
<widget name="display_frame"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]