Closed oz123 closed 8 months ago
This patch compiles, but system host name is still missing:
Suggestions on how to fix will be most welcome.
Code update required
diff --git a/capplets/system-info/mate-system-info.c b/capplets/system-info/mate-system-info.c
index 3638067..8f7325f 100644
--- a/capplets/system-info/mate-system-info.c
+++ b/capplets/system-info/mate-system-info.c
@@ -130,21 +130,25 @@ mate_system_info_row_fill (GtkWidget *row,
static void
mate_system_info_set_row (MateSystemInfo *info)
{
+#ifdef HAVE_SYSTEMD
mate_system_info_row_fill (info->hostname_row, _("Device Name"), FALSE);
mate_system_info_row_fill (info->hardware_model_row, _("Hardware Model"), TRUE);
+ mate_system_info_row_fill (info->virtualization_row, _("Virtualization"), TRUE);
+#endif
mate_system_info_row_fill (info->memory_row, _("Memory"), TRUE);
mate_system_info_row_fill (info->processor_row, _("Processor"), TRUE);
mate_system_info_row_fill (info->graphics_row, _("Graphics"), TRUE);
mate_system_info_row_fill (info->disk_row, _("Disk Capacity"), FALSE);
mate_system_info_row_fill (info->kernel_row, _("Kernel Version"), FALSE);
- mate_system_info_row_fill (info->virtualization_row, _("Virtualization"), TRUE);
mate_system_info_row_fill (info->windowing_system_row, _("Windowing System"), TRUE);
mate_system_info_row_fill (info->mate_version_row, _("MATE Version"), TRUE);
mate_system_info_row_fill (info->os_name_row, _("OS Name"), TRUE);
mate_system_info_row_fill (info->os_type_row, _("OS Type"), TRUE);
gtk_widget_show (info->logo_image);
+#ifdef HAVE_SYSTEMD
gtk_widget_show_all (info->hostname_row);
+#endif
gtk_widget_show_all (info->memory_row);
gtk_widget_show_all (info->processor_row);
gtk_widget_show_all (info->graphics_row);
@@ -614,8 +618,11 @@ void
mate_system_info_setup (MateSystemInfo *info)
{
g_autofree char *logo_name = NULL;
+#ifdef HAVE_SYSTEMD
g_autofree char *hostname_text = NULL;
g_autofree char *hw_model_text = NULL;
+ g_autofree char *virt_text = NULL;
+#endif
g_autofree char *memory_text = NULL;
g_autofree char *cpu_text = NULL;
g_autofree char *os_type_text = NULL;
@@ -623,7 +630,6 @@ mate_system_info_setup (MateSystemInfo *info)
g_autofree char *disk_text = NULL;
g_autofree char *kernel_text = NULL;
g_autofree char *windowing_system_text = NULL;
- g_autofree char *virt_text = NULL;
g_autofree char *de_text = NULL;
g_autofree char *graphics_hardware_string = NULL;
@@ -634,6 +640,7 @@ mate_system_info_setup (MateSystemInfo *info)
gtk_image_set_from_icon_name (GTK_IMAGE (info->logo_image), logo_name, GTK_ICON_SIZE_INVALID);
gtk_image_set_pixel_size (GTK_IMAGE (info->logo_image), 128);
+#ifdef HAVE_SYSTEMD
hostname_text = get_system_hostname ();
label = g_object_get_data (G_OBJECT (info->hostname_row), "labelvalue");
set_lable_style (label, "gray", 12, hostname_text, FALSE);
@@ -645,7 +652,7 @@ mate_system_info_setup (MateSystemInfo *info)
label = g_object_get_data (G_OBJECT (info->hardware_model_row), "labelvalue");
set_lable_style (label, "gray", 12, hw_model_text, FALSE);
}
+#endif
glibtop_get_mem (&mem);
memory_text = g_format_size_full (mem.total, G_FORMAT_SIZE_IEC_UNITS);
label = g_object_get_data (G_OBJECT (info->memory_row), "labelvalue");
@@ -704,20 +711,21 @@ mate_system_info_class_init (MateSystemInfoClass *klass)
widget_class->destroy = mate_system_info_destroy;
gtk_widget_class_set_template_from_resource (widget_class, "/org/mate/control-center/system-info/mate-system-info.ui");
-
+#ifdef HAVE_SYSTEMD
gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, hostname_row);
+ gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, hardware_model_row);
+ gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, virtualization_row);
+#endif
gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, hardware_box);
gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, disk_row);
gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, mate_version_row);
gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, graphics_row);
- gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, hardware_model_row);
gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, memory_row);
gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, os_box);
gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, logo_image);
gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, os_name_row);
gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, os_type_row);
gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, processor_row);
- gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, virtualization_row);
gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, kernel_row);
gtk_widget_class_bind_template_child (widget_class, MateSystemInfo, windowing_system_row);
}
Fix #744 #738
@zhuyaliang thank you for your suggestions. I have disabled some of the definitions, but left the hostname row.
This is how the applet now looks on my system with the latest patch:
Also --enable-systemd=auto
doesn't build with systemd support.
I have to use --enable-systemd=yes
to build with systemd support.
That's not acceptable nowadays as most distros are using systemd.
You can take a look at mate-system-monitor repository. https://github.com/mate-desktop/mate-system-monitor/blob/master/configure.ac There it works without using a configure flag, only systemd-devel needs to be in buildroot.
@raveit65 I updated my PR as requested.
@raveit65 is there anything else that needs to be done to get this merged?
I am not an active maintainer any more. @lukefromdc
Thank you for merging this, on behalf of all BSD\Alpine\Gentoo\Void linux and others I might forget.
Thank you for merging this, on behalf of all BSD\Alpine\Gentoo\Void linux and others I might forget.
Second that (Gentoo user here), thanks for staying independent.
There is not much of direct systemd usage in the system-info plugin. This patch suggestion enables building this plugin on system like alpine, voidlinux or gentoo with openrc.
I apologize in advance if this seems sloppy. I am not very knowledgeable with autotools (also, this patch excludes meson).
Suggestions on how to improve the patch are most welcome.