Avoid duplicate entries for custom keybindings
The a11y keybindings live in /desktop/gnome/keybindings as well, and we don't want to show them twice. So filter them out.
This commit is contained in:
parent
a66d9a5a35
commit
8effcb317c
1 changed files with 30 additions and 3 deletions
|
@ -144,6 +144,28 @@ free_key_array (GPtrArray *keys)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
has_gconf_key (const gchar *name)
|
||||||
|
{
|
||||||
|
GHashTableIter iter;
|
||||||
|
GPtrArray *keys;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
g_hash_table_iter_init (&iter, kb_sections);
|
||||||
|
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&keys))
|
||||||
|
{
|
||||||
|
for (i = 0; i < keys->len; i++)
|
||||||
|
{
|
||||||
|
KeyEntry *entry = g_ptr_array_index (keys, i);
|
||||||
|
|
||||||
|
if (g_strcmp0 (name, entry->gconf_key) == 0)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
should_show_key (const KeyListEntry *entry)
|
should_show_key (const KeyListEntry *entry)
|
||||||
{
|
{
|
||||||
|
@ -685,9 +707,14 @@ append_sections_from_gconf (GtkBuilder *builder, const gchar *gconf_path)
|
||||||
for (l = custom_list; l != NULL; l = l->next)
|
for (l = custom_list; l != NULL; l = l->next)
|
||||||
{
|
{
|
||||||
key.name = g_strconcat (l->data, "/binding", NULL);
|
key.name = g_strconcat (l->data, "/binding", NULL);
|
||||||
key.cmd_name = g_strconcat (l->data, "/action", NULL);
|
if (!has_gconf_key (key.name))
|
||||||
key.description_name = g_strconcat (l->data, "/name", NULL);
|
{
|
||||||
g_array_append_val (entries, key);
|
key.cmd_name = g_strconcat (l->data, "/action", NULL);
|
||||||
|
key.description_name = g_strconcat (l->data, "/name", NULL);
|
||||||
|
g_array_append_val (entries, key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_free (key.name);
|
||||||
|
|
||||||
g_free (l->data);
|
g_free (l->data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue