gnome-system-monitor/gnome-system-monitor-2.17.2.1-fedora.patch
2006-11-18 06:24:57 +00:00

59 lines
1.2 KiB
Diff

--- gnome-system-monitor-2.17.2.1/src/sysinfo.cpp.fedora 2006-11-02 13:45:35.000000000 -0500
+++ gnome-system-monitor-2.17.2.1/src/sysinfo.cpp 2006-11-18 01:09:14.000000000 -0500
@@ -141,10 +141,55 @@
};
+ class RedHatSysInfo
+ : public SysInfo
+ {
+ public:
+ RedHatSysInfo() : SysInfo(_("Unknown distro"))
+ {
+ this->load_redhat_info();
+ }
+
+ private:
+ void load_redhat_info()
+ {
+ gchar *text, *t, *s;
+
+ if (!g_file_get_contents ("/etc/redhat-release", &text, NULL, NULL))
+ return;
+
+ t = strstr (text, " release");
+
+ if (!t)
+ {
+ g_free (text);
+ return;
+ }
+
+ *t = '\0';
+
+ t += strlen (" release");
+
+ while (*t == ' ')
+ t++;
+
+ s = strchr (t, ' ');
+
+ if (s)
+ *s = '\0';
+
+ this->distro_name = text;
+ this->distro_version = t;
+ }
+ };
+
+
SysInfo* get_sysinfo()
{
if (g_file_test("/etc/debian_version", G_FILE_TEST_EXISTS))
return new DebianSysInfo;
+ else if (g_file_test("/etc/redhat-release", G_FILE_TEST_EXISTS))
+ return new RedHatSysInfo;
else
return new SysInfo(_("Unknown distro"));
}