/*
* Copyright (C) 2010 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
*
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2 or version 3 of the License.
* See http://www.gnu.org/copyleft/lgpl.html the full text of the license.
*/
#include <string.h>
#include <locale.h>
#include <langinfo.h>
#include <stdio.h>
#include "lightdm/language.h"
enum {
};
typedef struct
{
#define GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE ((obj), LIGHTDM_TYPE_LANGUAGE, LightDMLanguagePrivate)
static void
update_languages (void)
{
if (have_languages)
return;
if (error)
{
g_clear_error (&error);
}
else if (exit_status != 0)
else if (result)
{
int i;
for (i = 0; tokens[i]; i++)
{
if (code[0] == '\0')
continue;
/* Ignore the non-interesting languages */
continue;
}
g_strfreev (tokens);
}
}
static gboolean
{
}
/* Get a valid locale name that can be passed to setlocale(), so we always can use nl_langinfo() to get language and country names. */
static gchar *
{
char *at;
gint i;
else
if (!avail_locales)
{
{
}
else
{
g_clear_error (&error);
}
}
if (avail_locales)
{
for (i = 0; avail_locales[i]; i++)
{
continue;
{
break;
}
}
}
return locale;
}
/**
* lightdm_get_language:
*
* Get the current language.
*
* Return value: (transfer none): The current language or #NULL if no language.
**/
lightdm_get_language (void)
{
if (!lang)
return NULL;
{
return language;
}
return NULL;
}
/**
* lightdm_get_languages:
*
* Get a list of languages to present to the user.
*
* Return value: (element-type LightDMLanguage) (transfer none): A list of #LightDMLanguage that should be presented to the user.
**/
GList *
lightdm_get_languages (void)
{
update_languages ();
return languages;
}
/**
* lightdm_language_get_code:
* @language: A #LightDMLanguage
*
* Get the code of a language.
*
* Return value: The code of the language
**/
const gchar *
{
}
/**
* lightdm_language_get_name:
* @language: A #LightDMLanguage
*
* Get the name of a language.
*
* Return value: The name of the language
**/
const gchar *
{
{
if (locale)
{
}
{
g_strfreev (tokens);
}
}
}
/**
* lightdm_language_get_territory:
* @language: A #LightDMLanguage
*
* Get the territory the language is used in.
*
* Return value: The territory the language is used in.
**/
const gchar *
{
{
if (locale)
{
}
{
g_strfreev (tokens);
}
}
}
/**
* lightdm_language_matches:
* @language: A #LightDMLanguage
* @code: A language code
*
* Check if a language code matches this language.
*
* Return value: #TRUE if the code matches this language.
**/
{
/* Handle the fact the UTF-8 is specified both as '.utf8' and '.UTF-8' */
{
/* Match the characters before the '.' */
int i;
}
}
static void
{
}
static void
{
switch (prop_id) {
case PROP_CODE:
break;
default:
break;
}
}
static void
{
switch (prop_id) {
case PROP_CODE:
break;
case PROP_NAME:
break;
case PROP_TERRITORY:
break;
default:
break;
}
}
static void
{
g_param_spec_string ("code",
"code",
"Language code",
NULL,
g_param_spec_string ("name",
"name",
"Name of the language",
NULL,
g_param_spec_string ("territory",
"territory",
"Territory the language is from",
NULL,
}