From 0e0b3687bb0af669b0e625c181f1261fd61665c4 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Sun, 3 Apr 2011 17:52:49 +0000 Subject: [PATCH] Fix ID of newly added commands in the `Set Custom Commands` dialog git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5687 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 2 ++ src/tools.c | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64691351..602333dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,8 @@ Fix loading and updating menu accelerators for custom commands. * src/prefs.c: Don't allow editing keybinding column of group rows. + * src/tools.c: + Fix ID of newly added commands in the `Set Custom Commands` dialog. 2011-04-02 Colomban Wendling diff --git a/src/tools.c b/src/tools.c index d2527d7a..ba36274f 100644 --- a/src/tools.c +++ b/src/tools.c @@ -65,7 +65,7 @@ enum /* custom commands code*/ struct cc_dialog { - gint count; + guint count; GtkWidget *view; GtkTreeViewColumn *edit_column; GtkListStore *store; @@ -133,13 +133,14 @@ static void cc_dialog_add_command(struct cc_dialog *cc, gint idx, gboolean start { GtkTreeIter iter; const gchar *cmd; + guint id = cc->count; cmd = (idx >= 0) ? ui_prefs.custom_commands[idx] : NULL; - gtk_list_store_append(cc->store, &iter); - gtk_list_store_set(cc->store, &iter, CC_COLUMN_ID, cc->count, CC_COLUMN_CMD, cmd, -1); - cc_dialog_update_row_status(cc->store, &iter, cmd); cc->count++; + gtk_list_store_append(cc->store, &iter); + gtk_list_store_set(cc->store, &iter, CC_COLUMN_ID, id, CC_COLUMN_CMD, cmd, -1); + cc_dialog_update_row_status(cc->store, &iter, cmd); if (start_editing) {