diff options
author | Oz Tiram <[email protected]> | 2024-03-03 14:36:27 +0100 |
---|---|---|
committer | Luke from DC <[email protected]> | 2024-03-11 18:33:37 +0000 |
commit | 2ad956843e49cfb74862a07589810d6638122121 (patch) | |
tree | c140c6c52b88e66892db9a57bc0d23f93e91135b | |
parent | 4c33e64b171b52252f353720a322af6fd8b8cf54 (diff) | |
download | mate-control-center-2ad956843e49cfb74862a07589810d6638122121.tar.bz2 mate-control-center-2ad956843e49cfb74862a07589810d6638122121.tar.xz |
Make systemd optional
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.
Signed-off-by: Oz Tiram <[email protected]>
-rw-r--r-- | capplets/system-info/mate-system-info.c | 12 | ||||
-rw-r--r-- | configure.ac | 16 |
2 files changed, 25 insertions, 3 deletions
diff --git a/capplets/system-info/mate-system-info.c b/capplets/system-info/mate-system-info.c index 36380678..180cdf3e 100644 --- a/capplets/system-info/mate-system-info.c +++ b/capplets/system-info/mate-system-info.c @@ -21,6 +21,7 @@ * */ #include <gtk/gtk.h> +#include <glib.h> #include <glibtop/fsusage.h> #include <glibtop/mountlist.h> #include <glibtop/mem.h> @@ -159,6 +160,7 @@ mate_system_info_set_row (MateSystemInfo *info) static char * get_system_hostname (void) { +# ifdef HAVE_SYSTEMD GDBusProxy *hostnamed_proxy; g_autoptr(GVariant) variant = NULL; g_autoptr(GError) error = NULL; @@ -206,6 +208,9 @@ get_system_hostname (void) g_object_unref (hostnamed_proxy); return g_variant_dup_string (variant, NULL); } +# else + return g_strdup (g_get_host_name ()); +# endif } static char * @@ -493,7 +498,9 @@ static struct { { "openvz", "OpenVZ" }, { "lxc", "LXC" }, { "lxc-libvirt", "LXC (libvirt)" }, - { "systemd-nspawn", "systemd (nspawn)" } +# ifdef HAVE_SYSTEMD + { "systemd-nspawn", "systemd (nspawn)" }, +# endif }; static char * @@ -666,7 +673,7 @@ mate_system_info_setup (MateSystemInfo *info) kernel_text = get_kernel_vesrion (); label = g_object_get_data (G_OBJECT (info->kernel_row), "labelvalue"); set_lable_style (label, "gray", 12, kernel_text, FALSE); - +# ifdef HAVE_SYSTEMD virt_text = get_system_virt (); if (virt_text != NULL) { @@ -674,6 +681,7 @@ mate_system_info_setup (MateSystemInfo *info) label = g_object_get_data (G_OBJECT (info->virtualization_row), "labelvalue"); set_lable_style (label, "gray", 12, virt_text, FALSE); } +# endif windowing_system_text = get_windowing_system (); label = g_object_get_data (G_OBJECT (info->windowing_system_row), "labelvalue"); set_lable_style (label, "gray", 12, windowing_system_text, FALSE); diff --git a/configure.ac b/configure.ac index aa43d083..45d5365f 100644 --- a/configure.ac +++ b/configure.ac @@ -121,7 +121,6 @@ PKG_CHECK_MODULES(TYPING, $GMODULE_ADD glib-2.0 >= $GLIB_REQUIRED gio-2.0 gtk+-3 PKG_CHECK_MODULES(GIO, gio-2.0) PKG_CHECK_MODULES(GLIBTOP, libgtop-2.0) PKG_CHECK_MODULES(UDISKS, udisks2) -PKG_CHECK_MODULES(SYSTEMD, systemd >= $SYSTEMD_REQUIRED) PKG_CHECK_MODULES([DCONF], [dconf >= 0.13.4]) AC_SUBST(DCONF_CFLAGS) @@ -168,6 +167,20 @@ AC_ARG_ENABLE([libappindicator], [enable_appindicator=yes], [enable_appindicator=no])])]) +AC_ARG_ENABLE([systemd], + [AS_HELP_STRING([--enable-systemd[=@<:@no/auto/yes@:>@]],[Use systemd @<:@default=yes@:>@])], + [enable_systemd=$enableval], + [PKG_CHECK_EXISTS([$SYSTEMD >= $SYSTEMD_REQUIRED], + [enable_systemd=no], + , + )]) + +AS_IF([test "x$enable_systemd" = xyes], + [AC_MSG_NOTICE([Building with systemd support.]) + PKG_CHECK_MODULES([SYSTEMD], + [systemd >= $SYSTEMD_REQUIRED], + [AC_DEFINE(HAVE_SYSTEMD, 1, [Have systemd])])]) + AS_IF([test "x$enable_appindicator" = xyes], [AC_MSG_NOTICE([Buidling against Ubuntu AppIndicator.]) PKG_CHECK_MODULES([APPINDICATOR], @@ -313,6 +326,7 @@ Configure summary: Ayatana AppIndicator (preferred) $(test "x$enable_appindicator" = xyes && echo no || echo yes) Ubuntu AppIndicator (legacy) $(test "x$enable_appindicator" = xyes && echo yes || echo no) + Systemd: $(test "x$enable_systemd" = xyes && echo yes || echo no) Accountsservice: ${have_accountsservice} Native Language support: ${USE_NLS} |