[gnome-initial-setup] Use the distro name in the 'Start' button
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] Use the distro name in the 'Start' button
- Date: Tue, 13 Aug 2013 17:33:43 +0000 (UTC)
commit dfc86a4c71042d411f03592e2fcc9882e672f304
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Aug 13 13:04:35 2013 -0400
Use the distro name in the 'Start' button
Parse /etc/os-release to find the name of the distribution, and
use it instead of 'GNOME 3'. If we don't find that file, fall back
to using 'GNOME 3'.
https://bugzilla.gnome.org/show_bug.cgi?id=695692
.../pages/summary/gis-summary-page.c | 62 +++++++++++++++++++-
1 files changed, 60 insertions(+), 2 deletions(-)
---
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.c
b/gnome-initial-setup/pages/summary/gis-summary-page.c
index 789e64c..f16c4eb 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.c
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.c
@@ -296,6 +296,63 @@ gis_summary_page_get_builder (GisPage *page)
return builder;
}
+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 void
+update_distro_name (GisSummaryPage *page)
+{
+ char *buffer;
+ char *name;
+
+ name = NULL;
+
+ if (g_file_get_contents ("/etc/os-release", &buffer, NULL, NULL))
+ {
+ name = get_item (buffer, "NAME");
+ g_free (buffer);
+ }
+
+ if (name)
+ {
+ gchar *label;
+ label = g_strdup_printf (_("_Start using %s"), name);
+ gtk_label_set_label (GTK_LABEL (WID ("summary-start-button-label")), label);
+ g_free (label);
+ g_free (name);
+ }
+}
+
static void
gis_summary_page_constructed (GObject *object)
{
@@ -304,7 +361,7 @@ gis_summary_page_constructed (GObject *object)
G_OBJECT_CLASS (gis_summary_page_parent_class)->constructed (object);
gtk_container_add (GTK_CONTAINER (page), WID ("summary-page"));
-
+ update_distro_name (page);
g_signal_connect (WID("summary-start-button"), "clicked", G_CALLBACK (done_cb), page);
gis_page_set_complete (GIS_PAGE (page), TRUE);
@@ -315,7 +372,8 @@ gis_summary_page_constructed (GObject *object)
static void
gis_summary_page_locale_changed (GisPage *page)
{
- gis_page_set_title (GIS_PAGE (page), _("Thank You"));
+ gis_page_set_title (page, _("Thank You"));
+ update_distro_name (GIS_SUMMARY_PAGE (page));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]