[gnome-initial-setup] driver: Initialize user language
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] driver: Initialize user language
- Date: Fri, 10 May 2013 16:44:04 +0000 (UTC)
commit d7e40ff76587234e70d2466febaba4b98bbf804c
Author: Rui Matos <tiagomatos gmail com>
Date: Thu May 9 16:02:20 2013 +0200
driver: Initialize user language
Some pages might want to query it and would get NULL if they tried
before the user changed it at least once.
https://bugzilla.gnome.org/show_bug.cgi?id=699501
gnome-initial-setup/gis-driver.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c
index 39886a0..09b5a05 100644
--- a/gnome-initial-setup/gis-driver.c
+++ b/gnome-initial-setup/gis-driver.c
@@ -26,6 +26,7 @@
#include "gnome-initial-setup.h"
#include <stdlib.h>
+#include <locale.h>
#include "gis-assistant-gtk.h"
#include "gis-assistant-gd.h"
@@ -75,12 +76,24 @@ struct _GisDriverPrivate {
ActUser *user_account;
const gchar *user_password;
- const gchar *lang_id;
+
+ gchar *lang_id;
GisDriverMode mode;
};
static void
+gis_driver_finalize (GObject *object)
+{
+ GisDriver *driver = GIS_DRIVER (object);
+ GisDriverPrivate *priv = driver->priv;
+
+ g_free (priv->lang_id);
+
+ G_OBJECT_CLASS (gis_driver_parent_class)->finalize (object);
+}
+
+static void
title_changed_cb (GisAssistant *assistant,
GParamSpec *gparam,
GisDriver *driver)
@@ -126,7 +139,8 @@ void
gis_driver_set_user_language (GisDriver *driver, const gchar *lang_id)
{
GisDriverPrivate *priv = driver->priv;
- priv->lang_id = lang_id;
+ g_free (priv->lang_id);
+ priv->lang_id = g_strdup (lang_id);
}
const gchar *
@@ -283,6 +297,8 @@ gis_driver_startup (GApplication *app)
gtk_widget_show (GTK_WIDGET (priv->assistant));
+ gis_driver_set_user_language (driver, setlocale (LC_MESSAGES, NULL));
+
prepare_main_window (driver);
rebuild_pages (driver);
}
@@ -303,6 +319,7 @@ gis_driver_class_init (GisDriverClass *klass)
gobject_class->get_property = gis_driver_get_property;
gobject_class->set_property = gis_driver_set_property;
+ gobject_class->finalize = gis_driver_finalize;
application_class->startup = gis_driver_startup;
application_class->activate = gis_driver_activate;
klass->locale_changed = gis_driver_real_locale_changed;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]