[gnome-control-center/wip/hadess/add-windowing-system] info: Add windowing system field



commit e7b645e8d81054194a7a40f099bb35bf50c18f15
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Oct 30 13:49:32 2019 +0100

    info: Add windowing system field
    
    This is supposed to give information that's not easily accessible to an
    end user otherwise. It's supposed to give information "at a glance" and
    should be removed when X11 is removed.

 panels/info-overview/cc-info-overview-panel.c  | 23 +++++++++++++++++++++++
 panels/info-overview/cc-info-overview-panel.ui | 10 ++++++++++
 2 files changed, 33 insertions(+)
---
diff --git a/panels/info-overview/cc-info-overview-panel.c b/panels/info-overview/cc-info-overview-panel.c
index e304c4123..f49ac8c12 100644
--- a/panels/info-overview/cc-info-overview-panel.c
+++ b/panels/info-overview/cc-info-overview-panel.c
@@ -60,6 +60,7 @@ struct _CcInfoOverviewPanel
   GtkEntry        *device_name_entry;
   CcListRow       *disk_row;
   CcListRow       *gnome_version_row;
+  CcListRow       *windowing_system_row;
   CcListRow       *graphics_row;
   GtkListBox      *hardware_box;
   GtkDialog       *hostname_editor;
@@ -588,6 +589,24 @@ info_overview_panel_setup_virt (CcInfoOverviewPanel *self)
   set_virtualization_label (self, g_variant_get_string (inner, NULL));
 }
 
+static const char *
+get_windowing_system (void)
+{
+  GdkDisplay *display;
+
+  display = gdk_display_get_default ();
+
+#if defined(GDK_WINDOWING_X11)
+  if (GDK_IS_X11_DISPLAY (display))
+    return N_("X11");
+#endif /* GDK_WINDOWING_X11 */
+#if defined(GDK_WINDOWING_WAYLAND)
+  if (GDK_IS_WAYLAND_DISPLAY (display))
+    return N_("Wayland");
+#endif /* GDK_WINDOWING_WAYLAND */
+  return N_("Unknown");
+}
+
 static void
 info_overview_panel_setup_overview (CcInfoOverviewPanel *self)
 {
@@ -603,6 +622,9 @@ info_overview_panel_setup_overview (CcInfoOverviewPanel *self)
   if (load_gnome_version (&gnome_version, NULL, NULL))
     cc_list_row_set_secondary_label (self->gnome_version_row, gnome_version);
 
+  cc_list_row_set_secondary_label (self->windowing_system_row,
+                                   _(get_windowing_system ()));
+
   glibtop_get_mem (&mem);
   memory_text = g_format_size_full (mem.total, G_FORMAT_SIZE_IEC_UNITS);
   cc_list_row_set_secondary_label (self->memory_row, memory_text);
@@ -712,6 +734,7 @@ cc_info_overview_panel_class_init (CcInfoOverviewPanelClass *klass)
   gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, device_name_entry);
   gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, disk_row);
   gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, gnome_version_row);
+  gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, windowing_system_row);
   gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, graphics_row);
   gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, hardware_box);
   gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, hostname_editor);
diff --git a/panels/info-overview/cc-info-overview-panel.ui b/panels/info-overview/cc-info-overview-panel.ui
index 691611f4b..b8e91eaa4 100644
--- a/panels/info-overview/cc-info-overview-panel.ui
+++ b/panels/info-overview/cc-info-overview-panel.ui
@@ -146,6 +146,16 @@
                       </object>
                     </child>
 
+                    <!-- Windowing System -->
+                    <child>
+                      <object class="CcListRow" id="windowing_system_row">
+                        <property name="visible">True</property>
+                        <property name="activatable">False</property>
+                        <property name="title" translatable="yes">Windowing System</property>
+                        <property name="secondary-label">Wayland</property>
+                      </object>
+                    </child>
+
                     <!-- Virtualization -->
                     <child>
                       <object class="CcListRow" id="virtualization_row">


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