SF.net SVN: geany:[5317] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Fri Oct 22 12:20:37 UTC 2010
Revision: 5317
http://geany.svn.sourceforge.net/geany/?rev=5317&view=rev
Author: ntrel
Date: 2010-10-22 12:20:37 +0000 (Fri, 22 Oct 2010)
Log Message:
-----------
Fix not changing edited keybindings when cancelling the Preferences
dialog.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/prefs.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-10-21 16:40:31 UTC (rev 5316)
+++ trunk/ChangeLog 2010-10-22 12:20:37 UTC (rev 5317)
@@ -1,3 +1,10 @@
+2010-10-22 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/prefs.c:
+ Fix not changing edited keybindings when cancelling the Preferences
+ dialog.
+
+
2010-10-21 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/utils.c, src/filetypes.c:
Modified: trunk/src/prefs.c
===================================================================
--- trunk/src/prefs.c 2010-10-21 16:40:31 UTC (rev 5316)
+++ trunk/src/prefs.c 2010-10-22 12:20:37 UTC (rev 5317)
@@ -741,6 +741,50 @@
}
+/* read the treeview shortcut fields into keybindings */
+static void kb_update(void)
+{
+ GtkTreeModel *model = GTK_TREE_MODEL(store);
+ GtkTreeIter child, parent;
+ guint gid = 0;
+
+ /* get first parent */
+ if (! gtk_tree_model_iter_children(model, &parent, NULL))
+ return;
+
+ /* foreach parent */
+ while (TRUE)
+ {
+ /* get first child */
+ if (! gtk_tree_model_iter_children(model, &child, &parent))
+ return;
+
+ /* foreach child */
+ while (TRUE)
+ {
+ guint kid;
+ gchar *str;
+ guint key;
+ GdkModifierType mods;
+ GeanyKeyBinding *kb;
+
+ gtk_tree_model_get(model, &child, KB_TREE_INDEX, &kid, KB_TREE_SHORTCUT, &str, -1);
+ gtk_accelerator_parse(str, &key, &mods);
+ g_free(str);
+ kb = keybindings_lookup_item(gid, kid);
+ if (kb->key != key || kb->mods != mods)
+ keybindings_update_combo(kb, key, mods);
+
+ if (! gtk_tree_model_iter_next(model, &child))
+ break;
+ }
+ if (! gtk_tree_model_iter_next(model, &parent))
+ return;
+ gid++;
+ }
+}
+
+
/*
* callbacks
*/
@@ -1068,9 +1112,11 @@
/* Keybindings */
if (edited)
+ {
+ kb_update();
keybindings_write_to_file();
+ }
-
/* Printing */
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "radio_print_gtk");
printing_prefs.use_gtk_printing = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -1263,8 +1309,6 @@
/* set the values here, because of the above check, setting it in
* gtk_accelerator_parse would return a wrong key combination if it is duplicate */
- keybindings_update_combo(kb, lkey, lmods);
-
gtk_tree_store_set(store, iter, KB_TREE_SHORTCUT, new_text, -1);
edited = TRUE;
@@ -1393,7 +1437,6 @@
if (ret == GTK_RESPONSE_YES)
{
- keybindings_update_combo(kb, 0, 0);
kb_clear_tree_shortcut(g, kb->id);
/* carry on looking for other duplicates if overriding */
continue;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list