Revision: 1855 http://geany.svn.sourceforge.net/geany/?rev=1855&view=rev Author: eht16 Date: 2007-09-05 12:40:46 -0700 (Wed, 05 Sep 2007)
Log Message: ----------- Store the index of a keybinding in the treeview store to fix problems getting the correct index when editing a cell of the treeview.
Modified Paths: -------------- trunk/ChangeLog trunk/src/prefs.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-09-05 18:55:51 UTC (rev 1854) +++ trunk/ChangeLog 2007-09-05 19:40:46 UTC (rev 1855) @@ -3,6 +3,9 @@ * src/document.c: Fix missing syntax colouring when saving new files. * src/document.c, src/keybindings.c, src/keybindings.h: Make keybinding for scrolling by one line changeable. + * src/prefs.c: Store the index of a keybinding in the treeview store + to fix problems getting the correct index when editing + a cell of the treeview.
2007-09-05 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/prefs.c =================================================================== --- trunk/src/prefs.c 2007-09-05 18:55:51 UTC (rev 1854) +++ trunk/src/prefs.c 2007-09-05 19:40:46 UTC (rev 1855) @@ -370,7 +370,7 @@ tree = GTK_TREE_VIEW(lookup_widget(ui_widgets.prefs_dialog, "treeview7")); //g_object_set(tree, "vertical-separator", 6, NULL);
- store = gtk_tree_store_new(2, G_TYPE_STRING, G_TYPE_STRING); + store = gtk_tree_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT); gtk_tree_view_set_model(GTK_TREE_VIEW(tree), GTK_TREE_MODEL(store));
renderer = gtk_cell_renderer_text_new(); @@ -410,7 +410,7 @@
key_string = gtk_accelerator_name(keys[i]->key, keys[i]->mods); gtk_tree_store_append(store, &iter, &parent); - gtk_tree_store_set(store, &iter, 0, keys[i]->label, 1, key_string, -1); + gtk_tree_store_set(store, &iter, 0, keys[i]->label, 1, key_string, 2, i, -1); g_free(key_string); } } @@ -969,14 +969,8 @@ guint idx; guint lkey; GdkModifierType lmods; - gchar *test; GtkTreeIter iter;
- // get the index of the shortcut - idx = strtol(path, &test, 10); - if (test == path) - return; - gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(store), &iter, path); if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(store), &iter)) return; @@ -986,6 +980,9 @@ if (find_duplicate(idx, lkey, lmods, new_text)) return;
+ // get index + gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 2, &idx, -1); + // 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 keys[idx]->key = lkey; @@ -1025,10 +1022,8 @@ guint lkey; GdkModifierType lmods;
- for (idx = 0; idx < GEANY_MAX_KEYS; idx++) - { - if (utils_str_equal(dialog_key_name, keys[idx]->label)) break; - } + // get index + gtk_tree_model_get(GTK_TREE_MODEL(store), &g_iter, 2, &idx, -1);
gtk_accelerator_parse(gtk_label_get_text(GTK_LABEL(dialog_label)), &lkey, &lmods);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.