|
|
34cf59 |
From 12c6bf272242bff469627013ed1e566429b6a571 Mon Sep 17 00:00:00 2001
|
|
|
e6931d |
From: Matthias Clasen <mclasen@redhat.com>
|
|
|
e6931d |
Date: Sun, 31 Mar 2013 20:28:19 -0400
|
|
|
e6931d |
Subject: [PATCH] info: Switch around GNOME and distro information
|
|
|
e6931d |
|
|
|
e6931d |
This makes the distribution logo prominent, and puts GNOME version
|
|
|
e6931d |
information in the small print.
|
|
|
e6931d |
|
|
|
e6931d |
https://bugzilla.gnome.org/show_bug.cgi?id=695691
|
|
|
e6931d |
---
|
|
|
34cf59 |
panels/info/cc-info-panel.c | 90 +++++++++++++++++++++++++++++++++------------
|
|
|
34cf59 |
panels/info/info.ui | 77 +++++++++++++++++++++++++++-----------
|
|
|
34cf59 |
2 files changed, 121 insertions(+), 46 deletions(-)
|
|
|
e6931d |
|
|
|
e6931d |
diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
|
|
|
34cf59 |
index 9fba215..bc52c61 100644
|
|
|
e6931d |
--- a/panels/info/cc-info-panel.c
|
|
|
e6931d |
+++ b/panels/info/cc-info-panel.c
|
|
|
34cf59 |
@@ -432,48 +432,85 @@ cc_info_panel_class_init (CcInfoPanelClass *klass)
|
|
|
e6931d |
}
|
|
|
e6931d |
|
|
|
e6931d |
static char *
|
|
|
e6931d |
+get_item (const char *buffer, const char *name)
|
|
|
e6931d |
+{
|
|
|
e6931d |
+ char *label, *start, *end, *result;
|
|
|
e6931d |
+ char end_char;
|
|
|
e6931d |
+
|
|
|
e6931d |
+ result = NULL;
|
|
|
e6931d |
+ start = NULL;
|
|
|
e6931d |
+ end = NULL;
|
|
|
e6931d |
+ label = g_strconcat (name, "=", NULL);
|
|
|
e6931d |
+ if ((start = strstr (buffer, label)) != NULL)
|
|
|
e6931d |
+ {
|
|
|
e6931d |
+ start += strlen (label);
|
|
|
e6931d |
+ end_char = '\n';
|
|
|
e6931d |
+ if (*start == '"')
|
|
|
e6931d |
+ {
|
|
|
e6931d |
+ start++;
|
|
|
e6931d |
+ end_char = '"';
|
|
|
e6931d |
+ }
|
|
|
e6931d |
+
|
|
|
e6931d |
+ end = strchr (start, end_char);
|
|
|
e6931d |
+ }
|
|
|
e6931d |
+
|
|
|
e6931d |
+ if (start != NULL && end != NULL)
|
|
|
e6931d |
+ {
|
|
|
e6931d |
+ result = g_strndup (start, end - start);
|
|
|
e6931d |
+ }
|
|
|
e6931d |
+
|
|
|
e6931d |
+ g_free (label);
|
|
|
e6931d |
+
|
|
|
e6931d |
+ return result;
|
|
|
e6931d |
+}
|
|
|
e6931d |
+
|
|
|
e6931d |
+static char *
|
|
|
e6931d |
get_os_type (void)
|
|
|
e6931d |
{
|
|
|
e6931d |
- int bits;
|
|
|
e6931d |
char *buffer;
|
|
|
e6931d |
char *name;
|
|
|
e6931d |
char *result;
|
|
|
e6931d |
+ char *version;
|
|
|
e6931d |
|
|
|
e6931d |
+ result = NULL;
|
|
|
e6931d |
name = NULL;
|
|
|
e6931d |
-
|
|
|
e6931d |
+ version = NULL;
|
|
|
e6931d |
if (g_file_get_contents ("/etc/os-release", &buffer, NULL, NULL))
|
|
|
e6931d |
{
|
|
|
e6931d |
- char *start, *end;
|
|
|
34cf59 |
+ name = get_item (buffer, "NAME");
|
|
|
34cf59 |
+ version = get_item (buffer, "VERSION_ID");
|
|
|
34cf59 |
|
|
|
e6931d |
- start = end = NULL;
|
|
|
e6931d |
- if ((start = strstr (buffer, "PRETTY_NAME=\"")) != NULL)
|
|
|
e6931d |
- {
|
|
|
e6931d |
- start += strlen ("PRETTY_NAME=\"");
|
|
|
e6931d |
- end = strchr (start, '"');
|
|
|
e6931d |
- }
|
|
|
34cf59 |
-
|
|
|
e6931d |
- if (start != NULL && end != NULL)
|
|
|
e6931d |
- {
|
|
|
e6931d |
- name = g_strndup (start, end - start);
|
|
|
e6931d |
- }
|
|
|
e6931d |
+ g_free (buffer);
|
|
|
e6931d |
+ }
|
|
|
e6931d |
|
|
|
e6931d |
- g_free (buffer);
|
|
|
34cf59 |
+ if (name && version)
|
|
|
e6931d |
+ {
|
|
|
e6931d |
+ result = g_strconcat (name, " ", version, NULL);
|
|
|
e6931d |
+ }
|
|
|
e6931d |
+ else if (name)
|
|
|
e6931d |
+ {
|
|
|
e6931d |
+ result = g_strdup (name);
|
|
|
34cf59 |
}
|
|
|
34cf59 |
|
|
|
e6931d |
+ g_free (name);
|
|
|
e6931d |
+ g_free (version);
|
|
|
e6931d |
+
|
|
|
e6931d |
+ return result;
|
|
|
e6931d |
+}
|
|
|
e6931d |
+
|
|
|
e6931d |
+static char *
|
|
|
e6931d |
+get_os_description (void)
|
|
|
e6931d |
+{
|
|
|
e6931d |
+ int bits;
|
|
|
e6931d |
+ gchar *result;
|
|
|
34cf59 |
+
|
|
|
e6931d |
if (GLIB_SIZEOF_VOID_P == 8)
|
|
|
e6931d |
bits = 64;
|
|
|
e6931d |
else
|
|
|
e6931d |
bits = 32;
|
|
|
e6931d |
|
|
|
e6931d |
- /* translators: This is the name of the OS, followed by the type
|
|
|
e6931d |
- * of architecture, for example:
|
|
|
e6931d |
- * "Fedora 18 (Spherical Cow) 64-bit" or "Ubuntu (Oneric Ocelot) 32-bit" */
|
|
|
e6931d |
- if (name)
|
|
|
e6931d |
- result = g_strdup_printf (_("%s %d-bit"), name, bits);
|
|
|
e6931d |
- else
|
|
|
e6931d |
- result = g_strdup_printf (_("%d-bit"), bits);
|
|
|
e6931d |
-
|
|
|
e6931d |
- g_free (name);
|
|
|
e6931d |
+ /* translators: This is the the type of OS architecture, eg: "64-bit" or "32-bit" */
|
|
|
e6931d |
+ result = g_strdup_printf (_("%d-bit"), bits);
|
|
|
e6931d |
|
|
|
e6931d |
return result;
|
|
|
e6931d |
}
|
|
|
34cf59 |
@@ -1499,6 +1536,11 @@ info_panel_setup_overview (CcInfoPanel *self)
|
|
|
e6931d |
gtk_label_set_text (GTK_LABEL (widget), text ? text : "");
|
|
|
e6931d |
g_free (text);
|
|
|
e6931d |
|
|
|
e6931d |
+ widget = WID ("os_description_label");
|
|
|
e6931d |
+ text = get_os_description ();
|
|
|
e6931d |
+ gtk_label_set_text (GTK_LABEL (widget), text ? text : "");
|
|
|
e6931d |
+ g_free (text);
|
|
|
e6931d |
+
|
|
|
e6931d |
get_primary_disc_info (self);
|
|
|
e6931d |
|
|
|
e6931d |
widget = WID ("graphics_label");
|
|
|
e6931d |
diff --git a/panels/info/info.ui b/panels/info/info.ui
|
|
|
34cf59 |
index 1967fdf..0bdfc1a 100644
|
|
|
e6931d |
--- a/panels/info/info.ui
|
|
|
e6931d |
+++ b/panels/info/info.ui
|
|
|
34cf59 |
@@ -199,13 +199,14 @@
|
|
|
e6931d |
<object class="GtkBox" id="vbox2">
|
|
|
e6931d |
<property name="visible">True</property>
|
|
|
e6931d |
<property name="can_focus">False</property>
|
|
|
e6931d |
- <property name="spacing">18</property>
|
|
|
e6931d |
+ <property name="spacing">6</property>
|
|
|
e6931d |
<property name="orientation">vertical</property>
|
|
|
e6931d |
<child>
|
|
|
e6931d |
<object class="GtkImage" id="system_image">
|
|
|
e6931d |
<property name="visible">True</property>
|
|
|
e6931d |
<property name="can_focus">False</property>
|
|
|
34cf59 |
- <property name="resource">/org/gnome/control-center/info/GnomeLogoVerticalMedium.svg</property>
|
|
|
34cf59 |
+ <property name="pixel_size">128</property>
|
|
|
34cf59 |
+ <property name="icon_name">fedora-logo-icon</property>
|
|
|
e6931d |
</object>
|
|
|
e6931d |
<packing>
|
|
|
e6931d |
<property name="expand">False</property>
|
|
|
34cf59 |
@@ -214,11 +215,12 @@
|
|
|
e6931d |
</packing>
|
|
|
e6931d |
</child>
|
|
|
e6931d |
<child>
|
|
|
e6931d |
- <object class="GtkLabel" id="version_label">
|
|
|
e6931d |
+ <object class="GtkLabel" id="os_type_label">
|
|
|
e6931d |
<property name="visible">True</property>
|
|
|
e6931d |
<property name="can_focus">False</property>
|
|
|
e6931d |
<property name="label">Version 3.0</property>
|
|
|
e6931d |
<property name="selectable">True</property>
|
|
|
e6931d |
+ <property name="margin-bottom">24</property>
|
|
|
e6931d |
<attributes>
|
|
|
e6931d |
<attribute name="scale" value="1.25"/>
|
|
|
e6931d |
</attributes>
|
|
|
34cf59 |
@@ -282,19 +284,35 @@
|
|
|
e6931d |
</packing>
|
|
|
e6931d |
</child>
|
|
|
e6931d |
<child>
|
|
|
e6931d |
+ <object class="GtkLabel" id="label19">
|
|
|
e6931d |
+ <property name="visible">True</property>
|
|
|
e6931d |
+ <property name="can_focus">False</property>
|
|
|
e6931d |
+ <property name="xalign">1</property>
|
|
|
e6931d |
+ <property name="label" translatable="yes">OS Type</property>
|
|
|
e6931d |
+ <property name="mnemonic_widget">os_description_label</property>
|
|
|
e6931d |
+ <style>
|
|
|
e6931d |
+ <class name="dim-label"/>
|
|
|
e6931d |
+ </style>
|
|
|
e6931d |
+ </object>
|
|
|
e6931d |
+ <packing>
|
|
|
e6931d |
+ <property name="top_attach">3</property>
|
|
|
e6931d |
+ <property name="bottom_attach">4</property>
|
|
|
e6931d |
+ </packing>
|
|
|
e6931d |
+ </child>
|
|
|
e6931d |
+ <child>
|
|
|
e6931d |
<object class="GtkLabel" id="label7">
|
|
|
e6931d |
<property name="visible">True</property>
|
|
|
e6931d |
<property name="can_focus">False</property>
|
|
|
e6931d |
<property name="xalign">1</property>
|
|
|
e6931d |
- <property name="label" translatable="yes" comments="To translators: this field contains the distro name, version and type">Base system</property>
|
|
|
e6931d |
- <property name="mnemonic_widget">os_type_label</property>
|
|
|
e6931d |
+ <property name="label">GNOME</property>
|
|
|
e6931d |
+ <property name="mnemonic_widget">version_label</property>
|
|
|
e6931d |
<style>
|
|
|
e6931d |
<class name="dim-label"/>
|
|
|
e6931d |
</style>
|
|
|
e6931d |
</object>
|
|
|
e6931d |
<packing>
|
|
|
e6931d |
- <property name="top_attach">4</property>
|
|
|
e6931d |
- <property name="bottom_attach">5</property>
|
|
|
e6931d |
+ <property name="top_attach">5</property>
|
|
|
e6931d |
+ <property name="bottom_attach">6</property>
|
|
|
e6931d |
</packing>
|
|
|
e6931d |
</child>
|
|
|
e6931d |
<child>
|
|
|
34cf59 |
@@ -309,8 +327,8 @@
|
|
|
e6931d |
</style>
|
|
|
e6931d |
</object>
|
|
|
e6931d |
<packing>
|
|
|
e6931d |
- <property name="top_attach">6</property>
|
|
|
e6931d |
- <property name="bottom_attach">7</property>
|
|
|
e6931d |
+ <property name="top_attach">7</property>
|
|
|
e6931d |
+ <property name="bottom_attach">8</property>
|
|
|
e6931d |
</packing>
|
|
|
e6931d |
</child>
|
|
|
e6931d |
<child>
|
|
|
34cf59 |
@@ -354,7 +372,7 @@
|
|
|
e6931d |
</packing>
|
|
|
e6931d |
</child>
|
|
|
e6931d |
<child>
|
|
|
e6931d |
- <object class="GtkLabel" id="os_type_label">
|
|
|
e6931d |
+ <object class="GtkLabel" id="os_description_label">
|
|
|
e6931d |
<property name="visible">True</property>
|
|
|
e6931d |
<property name="can_focus">False</property>
|
|
|
e6931d |
<property name="xalign">0</property>
|
|
|
34cf59 |
@@ -364,8 +382,23 @@
|
|
|
e6931d |
<packing>
|
|
|
e6931d |
<property name="left_attach">1</property>
|
|
|
e6931d |
<property name="right_attach">2</property>
|
|
|
e6931d |
- <property name="top_attach">4</property>
|
|
|
e6931d |
- <property name="bottom_attach">5</property>
|
|
|
e6931d |
+ <property name="top_attach">3</property>
|
|
|
e6931d |
+ <property name="bottom_attach">4</property>
|
|
|
e6931d |
+ </packing>
|
|
|
e6931d |
+ </child>
|
|
|
e6931d |
+ <child>
|
|
|
e6931d |
+ <object class="GtkLabel" id="version_label">
|
|
|
e6931d |
+ <property name="visible">True</property>
|
|
|
e6931d |
+ <property name="can_focus">False</property>
|
|
|
e6931d |
+ <property name="xalign">0</property>
|
|
|
e6931d |
+ <property name="label">Unknown</property>
|
|
|
e6931d |
+ <property name="selectable">True</property>
|
|
|
e6931d |
+ </object>
|
|
|
e6931d |
+ <packing>
|
|
|
e6931d |
+ <property name="left_attach">1</property>
|
|
|
e6931d |
+ <property name="right_attach">2</property>
|
|
|
e6931d |
+ <property name="top_attach">5</property>
|
|
|
e6931d |
+ <property name="bottom_attach">6</property>
|
|
|
e6931d |
</packing>
|
|
|
e6931d |
</child>
|
|
|
e6931d |
<child>
|
|
|
34cf59 |
@@ -379,8 +412,8 @@
|
|
|
e6931d |
<packing>
|
|
|
e6931d |
<property name="left_attach">1</property>
|
|
|
e6931d |
<property name="right_attach">2</property>
|
|
|
e6931d |
- <property name="top_attach">6</property>
|
|
|
e6931d |
- <property name="bottom_attach">7</property>
|
|
|
e6931d |
+ <property name="top_attach">7</property>
|
|
|
e6931d |
+ <property name="bottom_attach">8</property>
|
|
|
e6931d |
</packing>
|
|
|
e6931d |
</child>
|
|
|
e6931d |
<child>
|
|
|
34cf59 |
@@ -462,8 +495,8 @@
|
|
|
e6931d |
</style>
|
|
|
e6931d |
</object>
|
|
|
e6931d |
<packing>
|
|
|
e6931d |
- <property name="top_attach">3</property>
|
|
|
e6931d |
- <property name="bottom_attach">4</property>
|
|
|
e6931d |
+ <property name="top_attach">4</property>
|
|
|
e6931d |
+ <property name="bottom_attach">5</property>
|
|
|
e6931d |
</packing>
|
|
|
e6931d |
</child>
|
|
|
e6931d |
<child>
|
|
|
34cf59 |
@@ -491,8 +524,8 @@
|
|
|
e6931d |
<packing>
|
|
|
e6931d |
<property name="left_attach">1</property>
|
|
|
e6931d |
<property name="right_attach">2</property>
|
|
|
e6931d |
- <property name="top_attach">3</property>
|
|
|
e6931d |
- <property name="bottom_attach">4</property>
|
|
|
e6931d |
+ <property name="top_attach">4</property>
|
|
|
e6931d |
+ <property name="bottom_attach">5</property>
|
|
|
e6931d |
</packing>
|
|
|
e6931d |
</child>
|
|
|
e6931d |
<child>
|
|
|
34cf59 |
@@ -510,8 +543,8 @@
|
|
|
e6931d |
</style>
|
|
|
e6931d |
</object>
|
|
|
e6931d |
<packing>
|
|
|
e6931d |
- <property name="top_attach">5</property>
|
|
|
e6931d |
- <property name="bottom_attach">6</property>
|
|
|
e6931d |
+ <property name="top_attach">6</property>
|
|
|
e6931d |
+ <property name="bottom_attach">7</property>
|
|
|
e6931d |
</packing>
|
|
|
e6931d |
</child>
|
|
|
e6931d |
<child>
|
|
|
34cf59 |
@@ -525,8 +558,8 @@
|
|
|
e6931d |
<packing>
|
|
|
e6931d |
<property name="left_attach">1</property>
|
|
|
e6931d |
<property name="right_attach">2</property>
|
|
|
e6931d |
- <property name="top_attach">5</property>
|
|
|
e6931d |
- <property name="bottom_attach">6</property>
|
|
|
e6931d |
+ <property name="top_attach">6</property>
|
|
|
e6931d |
+ <property name="bottom_attach">7</property>
|
|
|
e6931d |
</packing>
|
|
|
e6931d |
</child>
|
|
|
e6931d |
</object>
|
|
|
e6931d |
--
|
|
|
34cf59 |
2.0.1
|
|
|
e6931d |
|