clean up sorting to not use an imaginary column; change accel sort order
2007-02-04 Jens Granseuer <jensgr@gmx.net> * gnome-keybinding-properties.c: (keyentry_sort_func), (clear_old_model), (setup_dialog): clean up sorting to not use an imaginary column; change accel sort order to move disabled actions to the back of the list and also speed up sorting a bit svn path=/trunk/; revision=7243
This commit is contained in:
parent
765e80f953
commit
7aa1cede0d
2 changed files with 39 additions and 31 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2007-02-04 Jens Granseuer <jensgr@gmx.net>
|
||||||
|
|
||||||
|
* gnome-keybinding-properties.c: (keyentry_sort_func),
|
||||||
|
(clear_old_model), (setup_dialog): clean up sorting to not use an
|
||||||
|
imaginary column; change accel sort order to move disabled actions
|
||||||
|
to the back of the list and also speed up sorting a bit
|
||||||
|
|
||||||
2007-02-04 Jens Granseuer <jensgr@gmx.net>
|
2007-02-04 Jens Granseuer <jensgr@gmx.net>
|
||||||
|
|
||||||
* eggaccelerators.c: (egg_virtual_accelerator_name),
|
* eggaccelerators.c: (egg_virtual_accelerator_name),
|
||||||
|
|
|
@ -298,12 +298,8 @@ keyentry_sort_func (GtkTreeModel *model,
|
||||||
{
|
{
|
||||||
KeyEntry *key_entry_a;
|
KeyEntry *key_entry_a;
|
||||||
KeyEntry *key_entry_b;
|
KeyEntry *key_entry_b;
|
||||||
char *name_a;
|
|
||||||
char *name_b;
|
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
/* mmmmm, super-slow. */
|
|
||||||
|
|
||||||
key_entry_a = NULL;
|
key_entry_a = NULL;
|
||||||
gtk_tree_model_get (model, a,
|
gtk_tree_model_get (model, a,
|
||||||
KEYENTRY_COLUMN, &key_entry_a,
|
KEYENTRY_COLUMN, &key_entry_a,
|
||||||
|
@ -314,35 +310,42 @@ keyentry_sort_func (GtkTreeModel *model,
|
||||||
KEYENTRY_COLUMN, &key_entry_b,
|
KEYENTRY_COLUMN, &key_entry_b,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
|
if (key_entry_a && key_entry_b)
|
||||||
if (key_entry_a != NULL)
|
{
|
||||||
name_a = binding_name (key_entry_a->keyval,
|
if ((key_entry_a->keyval || key_entry_a->keycode) &&
|
||||||
key_entry_a->keycode,
|
(key_entry_b->keyval || key_entry_b->keycode))
|
||||||
key_entry_a->mask,
|
{
|
||||||
TRUE);
|
gchar *name_a, *name_b;
|
||||||
else
|
|
||||||
name_a = NULL;
|
|
||||||
|
|
||||||
if (key_entry_b != NULL)
|
name_a = binding_name (key_entry_a->keyval,
|
||||||
name_b = binding_name (key_entry_b->keyval,
|
key_entry_a->keycode,
|
||||||
key_entry_b->keycode,
|
key_entry_a->mask,
|
||||||
key_entry_b->mask,
|
TRUE);
|
||||||
TRUE);
|
|
||||||
else
|
|
||||||
name_b = NULL;
|
|
||||||
|
|
||||||
if (name_a && name_b)
|
name_b = binding_name (key_entry_b->keyval,
|
||||||
retval = g_utf8_collate (name_a, name_b);
|
key_entry_b->keycode,
|
||||||
else if (name_a)
|
key_entry_b->mask,
|
||||||
retval = 1;
|
TRUE);
|
||||||
else if (name_b)
|
|
||||||
|
retval = g_utf8_collate (name_a, name_b);
|
||||||
|
|
||||||
|
g_free (name_a);
|
||||||
|
g_free (name_b);
|
||||||
|
}
|
||||||
|
else if (key_entry_a->keyval || key_entry_a->keycode)
|
||||||
|
retval = -1;
|
||||||
|
else if (key_entry_b->keyval || key_entry_b->keycode)
|
||||||
|
retval = 1;
|
||||||
|
else
|
||||||
|
retval = 0;
|
||||||
|
}
|
||||||
|
else if (key_entry_a)
|
||||||
retval = -1;
|
retval = -1;
|
||||||
|
else if (key_entry_b)
|
||||||
|
retval = 1;
|
||||||
else
|
else
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
||||||
g_free (name_a);
|
|
||||||
g_free (name_b);
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,9 +366,8 @@ clear_old_model (GladeXML *dialog,
|
||||||
|
|
||||||
sort_model = gtk_tree_model_sort_new_with_model (model);
|
sort_model = gtk_tree_model_sort_new_with_model (model);
|
||||||
|
|
||||||
/* N_COLUMNS is just a place to stick the extra sort function */
|
|
||||||
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (sort_model),
|
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (sort_model),
|
||||||
N_COLUMNS,
|
KEYENTRY_COLUMN,
|
||||||
keyentry_sort_func,
|
keyentry_sort_func,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
|
@ -929,8 +931,7 @@ setup_dialog (GladeXML *dialog)
|
||||||
gtk_tree_view_column_set_resizable (column, FALSE);
|
gtk_tree_view_column_set_resizable (column, FALSE);
|
||||||
|
|
||||||
gtk_tree_view_append_column (GTK_TREE_VIEW (WID ("shortcut_treeview")), column);
|
gtk_tree_view_append_column (GTK_TREE_VIEW (WID ("shortcut_treeview")), column);
|
||||||
/* N_COLUMNS is just a place to stick the extra sort function */
|
gtk_tree_view_column_set_sort_column_id (column, KEYENTRY_COLUMN);
|
||||||
gtk_tree_view_column_set_sort_column_id (column, N_COLUMNS);
|
|
||||||
|
|
||||||
gconf_client_add_dir (client, "/apps/gnome_keybinding_properties", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
gconf_client_add_dir (client, "/apps/gnome_keybinding_properties", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||||
gconf_client_add_dir (client, "/apps/metacity/general", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
gconf_client_add_dir (client, "/apps/metacity/general", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue