Skip to content

Commit 10934db

Browse files
committed
gnome-xkb-info.c: Add to existing option group when scanning extras,
instead of replacing the original group. The xkb 'extras' file includes many additional, unique layouts, but also option groups which already exist from the base file. Previously, if extras were enable, the only the extra options from an option group would be available, not the sum of both files.
1 parent 1d5c360 commit 10934db

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

libcinnamon-desktop/gnome-xkb-info.c

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,16 +459,39 @@ parse_end_element (GMarkupParseContext *context,
459459
}
460460
else if (strcmp (element_name, "group") == 0)
461461
{
462+
XkbOptionGroup *existing_group;
463+
462464
if (!priv->current_parser_group->description || !priv->current_parser_group->id)
463465
{
464466
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
465467
"'group' elements must enclose 'description' and 'name' elements");
466468
return;
467469
}
468470

469-
g_hash_table_replace (priv->option_groups_table,
470-
priv->current_parser_group->id,
471-
priv->current_parser_group);
471+
existing_group = g_hash_table_lookup (priv->option_groups_table,
472+
priv->current_parser_group->id);
473+
474+
if (existing_group)
475+
{
476+
GHashTableIter iter;
477+
gpointer key, value;
478+
479+
g_hash_table_iter_init (&iter, priv->current_parser_group->options_table);
480+
while (g_hash_table_iter_next (&iter, &key, &value))
481+
{
482+
g_hash_table_iter_steal (&iter);
483+
g_hash_table_replace (existing_group->options_table, key, value);
484+
}
485+
486+
free_option_group (priv->current_parser_group);
487+
}
488+
else
489+
{
490+
g_hash_table_replace (priv->option_groups_table,
491+
priv->current_parser_group->id,
492+
priv->current_parser_group);
493+
}
494+
472495
priv->current_parser_group = NULL;
473496
}
474497
else if (strcmp (element_name, "option") == 0)

0 commit comments

Comments
 (0)