summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-03-18 10:46:57 +0100
committerraveit65 <[email protected]>2019-04-15 18:18:16 +0200
commite86eb044ee248349dd6a77738a09daddc023c962 (patch)
tree656f56ad1db76ff7055d6711a20dcee15b029593
parentf5db6d4ed7bca4c7193e7cf136d77ab14731b3aa (diff)
downloadmate-system-monitor-e86eb044ee248349dd6a77738a09daddc023c962.tar.bz2
mate-system-monitor-e86eb044ee248349dd6a77738a09daddc023c962.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.cpp33
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;
}