[gnome-control-center/info-overview-add-kernel-row: 2/2] info-overview: Add "Kernel Version" row
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/info-overview-add-kernel-row: 2/2] info-overview: Add "Kernel Version" row
- Date: Thu, 13 Oct 2022 09:19:14 +0000 (UTC)
commit ce6ef30e993226c51ea3e2f111d939c59ee74eb6
Author: Felipe Borges <felipeborges gnome org>
Date: Thu Oct 13 11:16:03 2022 +0200
info-overview: Add "Kernel Version" row
Fixes #1112
panels/info-overview/cc-info-overview-panel.c | 25 +++++++++++++++++++++++++
panels/info-overview/cc-info-overview-panel.ui | 9 +++++++++
2 files changed, 34 insertions(+)
---
diff --git a/panels/info-overview/cc-info-overview-panel.c b/panels/info-overview/cc-info-overview-panel.c
index 2885010d9..d30c6151b 100644
--- a/panels/info-overview/cc-info-overview-panel.c
+++ b/panels/info-overview/cc-info-overview-panel.c
@@ -66,6 +66,7 @@ struct _CcInfoOverviewPanel
GtkDialog *hostname_editor;
CcHostnameEntry *hostname_entry;
CcListRow *hostname_row;
+ CcListRow *kernel_row;
CcListRow *memory_row;
GtkPicture *os_logo;
CcListRow *os_name_row;
@@ -438,6 +439,24 @@ get_hardware_model_string ()
return NULL;
}
+static char *
+get_kernel_version_string ()
+{
+ g_autofree char *kernel_name = NULL;
+
+ kernel_name = get_hostnamed_property ("KernelName");
+ if (kernel_name && g_strcmp0 (kernel_name, "") != 0)
+ {
+ g_autofree char *kernel_release = NULL;
+
+ kernel_release = get_hostnamed_property ("KernelRelease");
+
+ return g_strdup_printf ("%s %s", kernel_name, kernel_release);
+ }
+
+ return NULL;
+}
+
static char *
get_cpu_info (const glibtop_sysinfo *info)
{
@@ -696,6 +715,7 @@ info_overview_panel_setup_overview (CcInfoOverviewPanel *self)
g_autofree char *os_name_text = NULL;
g_autofree char *os_build_text = NULL;
g_autofree char *hardware_model_text = NULL;
+ g_autofree char *kernel_version_text = NULL;
g_autofree gchar *graphics_hardware_string = NULL;
cc_object_storage_create_dbus_proxy (G_BUS_TYPE_SESSION,
@@ -739,6 +759,10 @@ info_overview_panel_setup_overview (CcInfoOverviewPanel *self)
cc_list_row_set_secondary_label (self->os_type_row, os_type_text);
cc_list_row_set_secondary_label (self->windowing_system_row, get_windowing_system ());
+
+ kernel_version_text = get_kernel_version_string ();
+ cc_list_row_set_secondary_label (self->kernel_row, kernel_version_text);
+ gtk_widget_set_visible (GTK_WIDGET (self->kernel_row), kernel_version_text != NULL);
}
static gboolean
@@ -946,6 +970,7 @@ cc_info_overview_panel_class_init (CcInfoOverviewPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, hostname_editor);
gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, hostname_entry);
gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, hostname_row);
+ gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, kernel_row);
gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, memory_row);
gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, os_logo);
gtk_widget_class_bind_template_child (widget_class, CcInfoOverviewPanel, os_name_row);
diff --git a/panels/info-overview/cc-info-overview-panel.ui b/panels/info-overview/cc-info-overview-panel.ui
index ec2ed2706..2b1fa5d58 100644
--- a/panels/info-overview/cc-info-overview-panel.ui
+++ b/panels/info-overview/cc-info-overview-panel.ui
@@ -143,6 +143,15 @@
</object>
</child>
+ <!-- Kernel version -->
+ <child>
+ <object class="CcListRow" id="kernel_row">
+ <property name="visible">False</property>
+ <property name="title" translatable="yes">Kernel Version</property>
+ <property name="activatable">False</property>
+ </object>
+ </child>
+
<!-- Software Updates -->
<child>
<object class="AdwActionRow" id="software_updates_row">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]