[gnome-desktop] xkbinfo: move two internal functions north for better grouping
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop] xkbinfo: move two internal functions north for better grouping
- Date: Fri, 25 Sep 2020 14:16:55 +0000 (UTC)
commit 763866c70fb6dc7ea6e4bcb4ec5bff053d7fe3ca
Author: Peter Hutterer <peter hutterer who-t net>
Date: Fri Sep 25 09:19:25 2020 +1000
xkbinfo: move two internal functions north for better grouping
No functional changes. This is preparation work for the libxkbregistry
integration, by moving these two up we have all the XML-parsing related
functions grouped together and can ifdef them out in one go.
libgnome-desktop/gnome-xkb-info.c | 128 +++++++++++++++++++-------------------
1 file changed, 64 insertions(+), 64 deletions(-)
---
diff --git a/libgnome-desktop/gnome-xkb-info.c b/libgnome-desktop/gnome-xkb-info.c
index f2f51abb..93184329 100644
--- a/libgnome-desktop/gnome-xkb-info.c
+++ b/libgnome-desktop/gnome-xkb-info.c
@@ -128,6 +128,70 @@ free_option_group (gpointer data)
g_slice_free (XkbOptionGroup, group);
}
+static void
+add_layout_to_table (GHashTable *table,
+ const gchar *key,
+ Layout *layout)
+{
+ GHashTable *set;
+
+ if (!layout->id)
+ return;
+
+ set = g_hash_table_lookup (table, key);
+ if (!set)
+ {
+ set = g_hash_table_new (g_str_hash, g_str_equal);
+ g_hash_table_replace (table, g_strdup (key), set);
+ }
+ else
+ {
+ if (g_hash_table_contains (set, layout->id))
+ return;
+ }
+ g_hash_table_replace (set, layout->id, layout);
+}
+
+static void
+add_layout_to_locale_tables (Layout *layout,
+ GHashTable *layouts_by_language,
+ GHashTable *layouts_by_country)
+{
+ GSList *l, *lang_codes, *country_codes;
+ gchar *language, *country;
+
+ lang_codes = layout->iso639Ids;
+ country_codes = layout->iso3166Ids;
+
+ if (layout->is_variant)
+ {
+ if (!lang_codes)
+ lang_codes = layout->main_layout->iso639Ids;
+ if (!country_codes)
+ country_codes = layout->main_layout->iso3166Ids;
+ }
+
+ for (l = lang_codes; l; l = l->next)
+ {
+ language = gnome_get_language_from_code ((gchar *) l->data, NULL);
+ if (language)
+ {
+ add_layout_to_table (layouts_by_language, language, layout);
+ g_free (language);
+ }
+ }
+
+ for (l = country_codes; l; l = l->next)
+ {
+ country = gnome_get_country_from_code ((gchar *) l->data, NULL);
+ if (country)
+ {
+ add_layout_to_table (layouts_by_country, country, layout);
+ g_free (country);
+ }
+ }
+}
+
static gchar *
get_xml_rules_file_path (const gchar *suffix)
{
@@ -286,70 +350,6 @@ parse_start_element (GMarkupParseContext *context,
}
}
-static void
-add_layout_to_table (GHashTable *table,
- const gchar *key,
- Layout *layout)
-{
- GHashTable *set;
-
- if (!layout->id)
- return;
-
- set = g_hash_table_lookup (table, key);
- if (!set)
- {
- set = g_hash_table_new (g_str_hash, g_str_equal);
- g_hash_table_replace (table, g_strdup (key), set);
- }
- else
- {
- if (g_hash_table_contains (set, layout->id))
- return;
- }
- g_hash_table_replace (set, layout->id, layout);
-}
-
-static void
-add_layout_to_locale_tables (Layout *layout,
- GHashTable *layouts_by_language,
- GHashTable *layouts_by_country)
-{
- GSList *l, *lang_codes, *country_codes;
- gchar *language, *country;
-
- lang_codes = layout->iso639Ids;
- country_codes = layout->iso3166Ids;
-
- if (layout->is_variant)
- {
- if (!lang_codes)
- lang_codes = layout->main_layout->iso639Ids;
- if (!country_codes)
- country_codes = layout->main_layout->iso3166Ids;
- }
-
- for (l = lang_codes; l; l = l->next)
- {
- language = gnome_get_language_from_code ((gchar *) l->data, NULL);
- if (language)
- {
- add_layout_to_table (layouts_by_language, language, layout);
- g_free (language);
- }
- }
-
- for (l = country_codes; l; l = l->next)
- {
- country = gnome_get_country_from_code ((gchar *) l->data, NULL);
- if (country)
- {
- add_layout_to_table (layouts_by_country, country, layout);
- g_free (country);
- }
- }
-}
-
static void
add_iso639 (Layout *layout,
gchar *id)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]