[gnome-control-center/wip/region-panel] Adapt to gnome-languages API change



commit 7759ec30ae6a84486559eed313f5c8346af75de7
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Feb 4 13:47:59 2013 +0100

    Adapt to gnome-languages API change

 panels/common/cc-common-language.c  |   40 +++++++++++++++++-----------------
 panels/common/cc-language-chooser.c |    4 +-
 panels/region/cc-format-chooser.c   |    4 +-
 panels/region/cc-region-panel.c     |    4 +-
 4 files changed, 26 insertions(+), 26 deletions(-)
---
diff --git a/panels/common/cc-common-language.c b/panels/common/cc-common-language.c
index 741f564..ac8a777 100644
--- a/panels/common/cc-common-language.c
+++ b/panels/common/cc-common-language.c
@@ -113,13 +113,13 @@ iter_for_language (GtkTreeModel *model,
                 g_free (l);
         } while (gtk_tree_model_iter_next (model, iter));
 
-        name = gnome_normalize_language_name (lang);
+        name = gnome_normalize_locale (lang);
         if (name != NULL) {
                 if (region) {
-                        language = gnome_get_region_from_name (name, NULL);
+                        language = gnome_get_country_from_locale (name, NULL);
                 }
                 else {
-                        language = gnome_get_language_from_name (name, NULL);
+                        language = gnome_get_language_from_locale (name, NULL);
                 }
 
                 gtk_list_store_insert_with_values (GTK_LIST_STORE (model),
@@ -167,7 +167,7 @@ cc_common_language_has_font (const gchar *locale)
         object_set = NULL;
         font_set = NULL;
 
-        if (!gnome_parse_language_name (locale, &language_code, NULL, NULL, NULL))
+        if (!gnome_parse_locale (locale, &language_code, NULL, NULL, NULL))
                 return FALSE;
 
         charset = FcLangGetCharSet ((FcChar8 *) language_code);
@@ -242,7 +242,7 @@ add_one_language (gpointer d)
     return FALSE;
   }
 
-  name = gnome_normalize_language_name (data->languages[data->position]);
+  name = gnome_normalize_locale (data->languages[data->position]);
   if (g_hash_table_lookup (data->user_langs, name) != NULL) {
     g_free (name);
     goto next;
@@ -254,10 +254,10 @@ add_one_language (gpointer d)
   }
 
   if (data->regions) {
-    language = gnome_get_region_from_name (name, NULL);
+    language = gnome_get_country_from_locale (name, NULL);
   }
   else {
-    language = gnome_get_language_from_name (name, NULL);
+    language = gnome_get_language_from_locale (name, NULL);
   }
   if (!language) {
     g_debug ("Ignoring '%s' as a locale, because we couldn't figure the language name", name);
@@ -292,7 +292,7 @@ cc_common_language_add_available_languages (GtkListStore *store,
 
   data->store = g_object_ref (store);
   data->user_langs = g_hash_table_ref (user_langs);
-  data->languages = gnome_get_all_language_names ();
+  data->languages = gnome_get_all_locales ();
   data->regions = regions;
   data->position = 0;
 
@@ -314,7 +314,7 @@ cc_common_language_get_current_language (void)
 
         locale = (const gchar *) setlocale (LC_MESSAGES, NULL);
         if (locale)
-                language = gnome_normalize_language_name (locale);
+                language = gnome_normalize_locale (locale);
         else
                 language = NULL;
 
@@ -467,10 +467,10 @@ user_language_has_translations (const char *locale)
         char *name, *language_code, *territory_code;
         gboolean ret;
 
-        gnome_parse_language_name (locale,
-                                   &language_code,
-                                   &territory_code,
-                                   NULL, NULL);
+        gnome_parse_locale (locale,
+                            &language_code,
+                            &territory_code,
+                            NULL, NULL);
         name = g_strdup_printf ("%s%s%s",
                                 language_code,
                                 territory_code != NULL? "_" : "",
@@ -557,9 +557,9 @@ add_other_users_language (GHashTable *ht)
                 if (lang != NULL && *lang != '\0' &&
                     cc_common_language_has_font (lang) &&
                     user_language_has_translations (lang)) {
-                        name = gnome_normalize_language_name (lang);
+                        name = gnome_normalize_locale (lang);
                         if (!g_hash_table_lookup (ht, name)) {
-                                language = gnome_get_language_from_name (name, NULL);
+                                language = gnome_get_language_from_locale (name, NULL);
                                 g_hash_table_insert (ht, name, language);
                         }
                         else {
@@ -663,7 +663,7 @@ cc_common_language_get_user_languages (void)
         /* Add current locale */
         name = cc_common_language_get_current_language ();
         if (g_hash_table_lookup (ht, name) == NULL) {
-                language = gnome_get_language_from_name (name, NULL);
+                language = gnome_get_language_from_locale (name, NULL);
                 g_hash_table_insert (ht, name, language);
         } else {
                 g_free (name);
@@ -691,14 +691,14 @@ cc_common_language_get_initial_regions (const gchar *lang)
         g_hash_table_insert (ht, g_strdup ("zh_CN.utf8"), g_strdup (_("China")));
 #endif
 
-        gnome_parse_language_name (lang, &language, NULL, NULL, NULL);
-        langs = gnome_get_all_language_names ();
+        gnome_parse_locale (lang, &language, NULL, NULL, NULL);
+        langs = gnome_get_all_locales ();
         for (i = 0; langs[i]; i++) {
                 gchar *l, *s;
-                gnome_parse_language_name (langs[i], &l, NULL, NULL, NULL);
+                gnome_parse_locale (langs[i], &l, NULL, NULL, NULL);
                 if (g_strcmp0 (language, l) == 0) {
                         if (!g_hash_table_lookup (ht, langs[i])) {
-                                s = gnome_get_region_from_name (langs[i], NULL);
+                                s = gnome_get_country_from_locale (langs[i], NULL);
                                 g_hash_table_insert (ht, g_strdup (langs[i]), s);
                         }
                 }
diff --git a/panels/common/cc-language-chooser.c b/panels/common/cc-language-chooser.c
index 93eb1e4..a1ac6e7 100644
--- a/panels/common/cc-language-chooser.c
+++ b/panels/common/cc-language-chooser.c
@@ -142,7 +142,7 @@ language_widget_new (const gchar *locale_id,
         GtkWidget *widget;
         GtkWidget *check;
 
-        locale_name = gnome_get_language_from_name (locale_id, locale_id);
+        locale_name = gnome_get_language_from_locale (locale_id, locale_id);
 
         widget = padded_label_new (locale_name, is_extra);
 
@@ -222,7 +222,7 @@ add_all_languages (GtkDialog *chooser)
         gchar **locale_ids;
         GHashTable *initial;
 
-        locale_ids = gnome_get_all_language_names ();
+        locale_ids = gnome_get_all_locales ();
         initial = cc_common_language_get_initial_languages ();
         add_languages (chooser, locale_ids, initial);
 }
diff --git a/panels/region/cc-format-chooser.c b/panels/region/cc-format-chooser.c
index 99d4323..43d04f8 100644
--- a/panels/region/cc-format-chooser.c
+++ b/panels/region/cc-format-chooser.c
@@ -235,7 +235,7 @@ region_widget_new (const gchar *locale_id,
         GtkWidget *widget;
         GtkWidget *check;
 
-        locale_name = gnome_get_region_from_name (locale_id, locale_id);
+        locale_name = gnome_get_country_from_locale (locale_id, locale_id);
 
         widget = padded_label_new (locale_name, is_extra);
 
@@ -312,7 +312,7 @@ add_all_regions (GtkDialog *chooser)
         gchar **locale_ids;
         GHashTable *initial;
 
-        locale_ids = gnome_get_all_language_names ();
+        locale_ids = gnome_get_all_locales ();
         initial = cc_common_language_get_initial_languages ();
         add_regions (chooser, locale_ids, initial);
 }
diff --git a/panels/region/cc-region-panel.c b/panels/region/cc-region-panel.c
index baf6903..5eecc1e 100644
--- a/panels/region/cc-region-panel.c
+++ b/panels/region/cc-region-panel.c
@@ -435,7 +435,7 @@ update_language_label (CcRegionPanel *self)
         else
                 language = priv->language;
         if (language)
-                name = gnome_get_language_from_name (language, language);
+                name = gnome_get_language_from_locale (language, language);
         else
                 name = g_strdup (C_("Language", "None"));
         gtk_label_set_label (GTK_LABEL (priv->language_label), name);
@@ -466,7 +466,7 @@ update_region_from_setting (CcRegionPanel *self)
 
         g_free (priv->region);
         priv->region = g_settings_get_string (priv->locale_settings, KEY_REGION);
-        name = gnome_get_region_from_name (priv->region, priv->region);
+        name = gnome_get_country_from_locale (priv->region, priv->region);
         gtk_label_set_label (GTK_LABEL (priv->formats_label), name);
         g_free (name);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]