From 12c6bf272242bff469627013ed1e566429b6a571 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 31 Mar 2013 20:28:19 -0400 Subject: [PATCH] info: Switch around GNOME and distro information This makes the distribution logo prominent, and puts GNOME version information in the small print. https://bugzilla.gnome.org/show_bug.cgi?id=695691 --- panels/info/cc-info-panel.c | 90 +++++++++++++++++++++++++++++++++------------ panels/info/info.ui | 77 +++++++++++++++++++++++++++----------- 2 files changed, 121 insertions(+), 46 deletions(-) diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c index 9fba215..bc52c61 100644 --- a/panels/info/cc-info-panel.c +++ b/panels/info/cc-info-panel.c @@ -432,48 +432,85 @@ cc_info_panel_class_init (CcInfoPanelClass *klass) } static char * +get_item (const char *buffer, const char *name) +{ + char *label, *start, *end, *result; + char end_char; + + result = NULL; + start = NULL; + end = NULL; + label = g_strconcat (name, "=", NULL); + if ((start = strstr (buffer, label)) != NULL) + { + start += strlen (label); + end_char = '\n'; + if (*start == '"') + { + start++; + end_char = '"'; + } + + end = strchr (start, end_char); + } + + if (start != NULL && end != NULL) + { + result = g_strndup (start, end - start); + } + + g_free (label); + + return result; +} + +static char * get_os_type (void) { - int bits; char *buffer; char *name; char *result; + char *version; + result = NULL; name = NULL; - + version = NULL; if (g_file_get_contents ("/etc/os-release", &buffer, NULL, NULL)) { - char *start, *end; + name = get_item (buffer, "NAME"); + version = get_item (buffer, "VERSION_ID"); - 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); + } - g_free (buffer); + if (name && version) + { + result = g_strconcat (name, " ", version, NULL); + } + else if (name) + { + result = g_strdup (name); } + g_free (name); + g_free (version); + + return result; +} + +static char * +get_os_description (void) +{ + int bits; + gchar *result; + if (GLIB_SIZEOF_VOID_P == 8) bits = 64; else bits = 32; - /* 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); + /* translators: This is the the type of OS architecture, eg: "64-bit" or "32-bit" */ + result = g_strdup_printf (_("%d-bit"), bits); return result; } @@ -1499,6 +1536,11 @@ info_panel_setup_overview (CcInfoPanel *self) gtk_label_set_text (GTK_LABEL (widget), text ? text : ""); g_free (text); + widget = WID ("os_description_label"); + text = get_os_description (); + gtk_label_set_text (GTK_LABEL (widget), text ? text : ""); + g_free (text); + get_primary_disc_info (self); widget = WID ("graphics_label"); diff --git a/panels/info/info.ui b/panels/info/info.ui index 1967fdf..0bdfc1a 100644 --- a/panels/info/info.ui +++ b/panels/info/info.ui @@ -199,13 +199,14 @@ True False - 18 + 6 vertical True False - /org/gnome/control-center/info/GnomeLogoVerticalMedium.svg + 128 + fedora-logo-icon False @@ -214,11 +215,12 @@ - + True False Version 3.0 True + 24 @@ -282,19 +284,35 @@ + + True + False + 1 + OS Type + os_description_label + + + + 3 + 4 + + + True False 1 - Base system - os_type_label + GNOME + version_label - 4 - 5 + 5 + 6 @@ -309,8 +327,8 @@ - 6 - 7 + 7 + 8 @@ -354,7 +372,7 @@ - + True False 0 @@ -364,8 +382,23 @@ 1 2 - 4 - 5 + 3 + 4 + + + + + True + False + 0 + Unknown + True + + + 1 + 2 + 5 + 6 @@ -379,8 +412,8 @@ 1 2 - 6 - 7 + 7 + 8 @@ -462,8 +495,8 @@ - 3 - 4 + 4 + 5 @@ -491,8 +524,8 @@ 1 2 - 3 - 4 + 4 + 5 @@ -510,8 +543,8 @@ - 5 - 6 + 6 + 7 @@ -525,8 +558,8 @@ 1 2 - 5 - 6 + 6 + 7 -- 2.0.1