Revision: 1763
http://geeqie.svn.sourceforge.net/geeqie/?rev=1763&view=rev
Author: nadvornik
Date: 2009-06-24 20:31:30 +0000 (Wed, 24 Jun 2009)
Log Message:
-----------
test if an accelerator can be stored
gtk_accel_map_change_entry can't change accelerators
to keys like arrows. Test this and show the keys in the list
only if they can be really changed.
https://sourceforge.net/tracker/?func=detail&aid=2805139&group_id=222125&atid=1054680
Modified Paths:
--------------
trunk/src/preferences.c
Modified: trunk/src/preferences.c
===================================================================
--- trunk/src/preferences.c 2009-06-23 19:20:48 UTC (rev 1762)
+++ trunk/src/preferences.c 2009-06-24 20:31:30 UTC (rev 1763)
@@ -994,11 +994,24 @@
GtkTreeModel *model = (GtkTreeModel *)accel_store;
GtkTreeIter iter;
gchar *acc;
+ gchar *accel_path;
+ GtkAccelKey old_key, key;
GtkTreePath *path = gtk_tree_path_new_from_string(path_string);
gtk_tree_model_get_iter(model, &iter, path);
- acc = gtk_accelerator_name(accel_key, accel_mods);
+ gtk_tree_model_get(model, &iter, AE_ACCEL, &accel_path, -1);
+ /* test if the accelerator can be stored without conflicts*/
+ gtk_accel_map_lookup_entry(accel_path, &old_key);
+
+ /* change the key and read it back (change may fail on keys hardcoded
in gtk)*/
+ gtk_accel_map_change_entry(accel_path, accel_key, accel_mods, TRUE);
+ gtk_accel_map_lookup_entry(accel_path, &key);
+
+ /* restore the original for now, the key will be really changed when
the changes are confirmed */
+ gtk_accel_map_change_entry(accel_path, old_key.accel_key,
old_key.accel_mods, TRUE);
+
+ acc = gtk_accelerator_name(key.accel_key, key.accel_mods);
gtk_tree_model_foreach(GTK_TREE_MODEL(accel_store),
accel_remove_key_cb, acc);
gtk_tree_store_set(accel_store, &iter, AE_KEY, acc, -1);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn