Do not save twice the same value

This commit is contained in:
Pierre Pronchery 2009-10-04 14:05:11 +00:00
parent 34ea20e41c
commit 74dec19087

View File

@ -154,7 +154,7 @@ static GtkWidget * _new_entry(Config * config)
{
snprintf(buf, sizeof(buf), "%s%d", "command", i);
if((q = config_get(config, "", buf)) == NULL)
break;
continue;
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, 0, q, -1);
}
@ -242,7 +242,6 @@ static void _on_run_choose_activate(GtkWidget * widget, gint arg1,
/* on_run_execute */
/* static void _execute_parent(GtkWidget * window, pid_t pid); */
static gboolean _execute_idle(gpointer data);
static void _idle_save_config(Run * run);
@ -322,6 +321,15 @@ static void _idle_save_config(Run * run)
#endif
p = gtk_entry_get_text(GTK_ENTRY(run->entry));
for(i = 0; i < 100; i++)
{
snprintf(buf, sizeof(buf), "%s%d", "command", i);
q = config_get(run->config, "", buf);
if(q == NULL || strcmp(p, q) != 0)
continue;
free(filename); /* the command is already known */
return;
}
for(i = 0; i < 100; i++)
{
snprintf(buf, sizeof(buf), "%s%d", "command", i);
q = config_get(run->config, "", buf);