[gnome-control-center] info: Add distro information
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] info: Add distro information
- Date: Tue, 27 Nov 2012 10:24:59 +0000 (UTC)
commit 6ca822940a4a1ab55a19e280a79e1ef87f048884
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Nov 24 14:01:59 2012 -0500
info: Add distro information
This shows the name of the release in addition to 32/64-bit.
https://bugzilla.gnome.org/show_bug.cgi?id=688957
panels/info/cc-info-panel.c | 38 +++++++++++++++++++++++++++++++++++---
panels/info/info.ui | 2 +-
2 files changed, 36 insertions(+), 4 deletions(-)
---
diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
index d2225dd..9df67ee 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -569,15 +569,47 @@ static char *
get_os_type (void)
{
int bits;
+ char *buffer;
+ char *name;
+ char *result;
+
+ name = NULL;
+
+ if (g_file_get_contents ("/etc/os-release", &buffer, NULL, NULL))
+ {
+ char *start, *end;
+
+ start = end = NULL;
+ if ((start = strstr (buffer, "PRETTY_NAME=\"")) != NULL)
+ {
+ start += strlen ("PRETTY_NAME=\"");
+ end = strchr (start, '"');
+ }
+
+ if (start != NULL && end != NULL)
+ {
+ name = g_strndup (start, end - start);
+ }
+
+ g_free (buffer);
+ }
if (GLIB_SIZEOF_VOID_P == 8)
bits = 64;
else
bits = 32;
- /* translators: This is the type of architecture, for example:
- * "64-bit" or "32-bit" */
- return g_strdup_printf (_("%d-bit"), bits);
+ /* translators: This is the name of the OS, followed by the type
+ * of architecture, for example:
+ * "Fedora 18 (Spherical Cow) 64-bit" or "Ubuntu (Oneric Ocelot) 32-bit" */
+ if (name)
+ result = g_strdup_printf (_("%s %d-bit"), name, bits);
+ else
+ result = g_strdup_printf (_("%d-bit"), bits);
+
+ g_free (name);
+
+ return result;
}
static void
diff --git a/panels/info/info.ui b/panels/info/info.ui
index 844da4e..b5262c6 100644
--- a/panels/info/info.ui
+++ b/panels/info/info.ui
@@ -320,7 +320,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">OS type</property>
+ <property name="label" translatable="yes" comments="To translators: this field contains the distro name, version and type">Base system</property>
<property name="mnemonic_widget">os_type_label</property>
<style>
<class name="dim-label"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]