diff options
author | rbuj <[email protected]> | 2019-03-18 10:46:57 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-04-12 17:43:29 +0200 |
commit | fbdd007ab4e35deb4c8a89d3400f4db652196542 (patch) | |
tree | e5eb93c5e168128dd2a344be8d59797bc97f7131 | |
parent | 5c0c91aa21feb6bdcd116ae9aa2ce8a8854b0125 (diff) | |
download | mate-system-monitor-fbdd007ab4e35deb4c8a89d3400f4db652196542.tar.bz2 mate-system-monitor-fbdd007ab4e35deb4c8a89d3400f4db652196542.tar.xz |
Show FreeBSD sysname, release, version in System tab
Release and version info is also applicable to non Linux OS.
-rw-r--r-- | src/sysinfo.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp index 273f2f9..27b00b0 100644 --- a/src/sysinfo.cpp +++ b/src/sysinfo.cpp @@ -75,9 +75,15 @@ namespace { /* Translators: The first string parameter is release version (codename), * the second one is the architecture, 32 or 64-bit */ +#ifdef __linux__ char* markup = g_strdup_printf(_("Release %s %s"), this->distro_release.c_str(), this->get_os_type().c_str()); +#else + char* markup = g_strdup_printf(_("Release %s"), + this->distro_release.c_str()); +#endif + g_object_set(G_OBJECT(release), "label", markup, @@ -86,6 +92,11 @@ namespace { g_free(markup); } + static string release() + { + return uname().release; + } + static string system() { return uname().sysname; @@ -287,7 +298,11 @@ namespace { void load_uname_info() { this->hostname = uname().nodename; +#ifdef __linux__ this->kernel = string(uname().sysname) + ' ' + uname().release + ' ' + uname().machine; +#else + this->kernel = string(uname().version) + ' ' + uname().machine; +#endif } @@ -325,7 +340,22 @@ namespace { } }; + class FreeBSDSysInfo + : public SysInfo + { + public: + FreeBSDSysInfo() + { + this->load_freebsd_info(); + } + private: + void load_freebsd_info() + { + this->distro_name = "FreeBSD"; + this->distro_release = release(); + } + }; class SolarisSysInfo : public SysInfo @@ -618,6 +648,9 @@ namespace { g_free(p); return new LSBSysInfo; } + else if (SysInfo::system() == "FreeBSD") { + return new FreeBSDSysInfo; + } else if (SysInfo::system() == "SunOS") { return new SolarisSysInfo; } |