[gnome-control-center] keyboard: Handle shortcuts conflict in different section
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] keyboard: Handle shortcuts conflict in different section
- Date: Wed, 13 Apr 2011 11:52:32 +0000 (UTC)
commit 995be4e6f00c3fde876ea6e74b60b1e4f53a3c17
Author: Bastien Nocera <hadess hadess net>
Date: Wed Apr 13 12:51:00 2011 +0100
keyboard: Handle shortcuts conflict in different section
https://bugzilla.gnome.org/show_bug.cgi?id=646504
panels/keyboard/keyboard-shortcuts.c | 42 +++++++++++++++++++++++++---------
1 files changed, 31 insertions(+), 11 deletions(-)
---
diff --git a/panels/keyboard/keyboard-shortcuts.c b/panels/keyboard/keyboard-shortcuts.c
index 1a848f3..2982007 100644
--- a/panels/keyboard/keyboard-shortcuts.c
+++ b/panels/keyboard/keyboard-shortcuts.c
@@ -1213,18 +1213,12 @@ typedef struct {
} CcUniquenessData;
static gboolean
-cb_check_for_uniqueness (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- CcUniquenessData *data)
+compare_keys_for_uniqueness (CcKeyboardItem *element,
+ CcUniquenessData *data)
{
- CcKeyboardItem *element;
CcKeyboardItem *orig_item;
orig_item = data->orig_item;
- gtk_tree_model_get (orig_item->model, iter,
- DETAIL_KEYENTRY_COLUMN, &element,
- -1);
/* no conflict for : blanks, different modifiers, or ourselves */
if (element == NULL || data->new_mask != element->mask ||
@@ -1242,6 +1236,24 @@ cb_check_for_uniqueness (GtkTreeModel *model,
return TRUE;
}
+static gboolean
+cb_check_for_uniqueness (gpointer key,
+ GPtrArray *keys_array,
+ CcUniquenessData *data)
+{
+ guint i;
+
+ for (i = 0; i < keys_array->len; i++)
+ {
+ CcKeyboardItem *item;
+
+ item = keys_array->pdata[i];
+ if (compare_keys_for_uniqueness (item, data))
+ return TRUE;
+ }
+ return FALSE;
+}
+
static void
accel_edited_callback (GtkCellRendererText *cell,
const char *path_string,
@@ -1280,9 +1292,17 @@ accel_edited_callback (GtkCellRendererText *cell,
data.conflict_item = NULL;
if (keyval != 0 || keycode != 0) /* any number of shortcuts can be disabled */
- gtk_tree_model_foreach (model,
- (GtkTreeModelForeachFunc) cb_check_for_uniqueness,
- &data);
+ {
+ BindingGroupType i;
+
+ for (i = BINDING_GROUP_SYSTEM; i <= BINDING_GROUP_USER && data.conflict_item == NULL; i++)
+ {
+ GHashTable *table;
+
+ table = get_hash_for_group (i);
+ g_hash_table_find (table, (GHRFunc) cb_check_for_uniqueness, &data);
+ }
+ }
/* Check for unmodified keys */
if (mask == 0 && keycode != 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]