Do not save twice the same value
This commit is contained in:
parent
34ea20e41c
commit
74dec19087
12
src/run.c
12
src/run.c
|
@ -154,7 +154,7 @@ static GtkWidget * _new_entry(Config * config)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%s%d", "command", i);
|
snprintf(buf, sizeof(buf), "%s%d", "command", i);
|
||||||
if((q = config_get(config, "", buf)) == NULL)
|
if((q = config_get(config, "", buf)) == NULL)
|
||||||
break;
|
continue;
|
||||||
gtk_list_store_append(store, &iter);
|
gtk_list_store_append(store, &iter);
|
||||||
gtk_list_store_set(store, &iter, 0, q, -1);
|
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 */
|
/* on_run_execute */
|
||||||
/* static void _execute_parent(GtkWidget * window, pid_t pid); */
|
|
||||||
static gboolean _execute_idle(gpointer data);
|
static gboolean _execute_idle(gpointer data);
|
||||||
static void _idle_save_config(Run * run);
|
static void _idle_save_config(Run * run);
|
||||||
|
|
||||||
|
@ -322,6 +321,15 @@ static void _idle_save_config(Run * run)
|
||||||
#endif
|
#endif
|
||||||
p = gtk_entry_get_text(GTK_ENTRY(run->entry));
|
p = gtk_entry_get_text(GTK_ENTRY(run->entry));
|
||||||
for(i = 0; i < 100; i++)
|
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);
|
snprintf(buf, sizeof(buf), "%s%d", "command", i);
|
||||||
q = config_get(run->config, "", buf);
|
q = config_get(run->config, "", buf);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user