Commit 8475a4f8 authored by GMT 1998 Andy Thomas's avatar GMT 1998 Andy Thomas Committed by Andy Thomas

app/gradient.c


Sat Oct 31 21:47:14 GMT 1998 Andy Thomas <alt@picnic.demon.co.uk>

	* app/gradient.c

	Fixed for problems with renaming + fix for interactions between editor
	and gradient selection popups.
parent d4ccd85a
Sat Oct 31 21:47:14 GMT 1998 Andy Thomas <alt@picnic.demon.co.uk>
* app/gradient.c
Fixed for problems with renaming + fix for interactions between editor
and gradient selection popups.
Sat Oct 31 14:57:40 GMT 1998 Andy Thomas <alt@picnic.demon.co.uk> Sat Oct 31 14:57:40 GMT 1998 Andy Thomas <alt@picnic.demon.co.uk>
* app/gradient.c * app/gradient.c
......
...@@ -576,6 +576,9 @@ static void sel_update_dialogs(gint row, gradient_t *grad); ...@@ -576,6 +576,9 @@ static void sel_update_dialogs(gint row, gradient_t *grad);
static void grad_sel_free_all(); static void grad_sel_free_all();
static void grad_sel_refill_all(); static void grad_sel_refill_all();
static void grad_sel_rename_all(gint n, gradient_t *grad); static void grad_sel_rename_all(gint n, gradient_t *grad);
static void grad_sel_new_all(gint n, gradient_t *grad);
static void grad_sel_copy_all(gint n, gradient_t *grad);
static void grad_sel_delete_all(gint n);
/* Procedural database functions */ /* Procedural database functions */
...@@ -1487,6 +1490,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca ...@@ -1487,6 +1490,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca
curr_gradient = grad; curr_gradient = grad;
ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL); ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);
grad_sel_new_all(pos,grad);
} /* ed_do_new_gradient_callback */ } /* ed_do_new_gradient_callback */
/*****/ /*****/
...@@ -1494,7 +1499,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca ...@@ -1494,7 +1499,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca
static void static void
ed_do_rename_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer call_data) ed_do_rename_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer call_data)
{ {
gradient_t *grad = NULL; gradient_t *grad = (gradient_t *)client_data;
gradient_t *grad_list = NULL;
char *gradient_name; char *gradient_name;
GSList *tmp; GSList *tmp;
int n; int n;
...@@ -1510,25 +1516,26 @@ ed_do_rename_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ...@@ -1510,25 +1516,26 @@ ed_do_rename_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer
tmp = gradients_list; tmp = gradients_list;
while (tmp) { while (tmp) {
grad = tmp->data; grad_list = tmp->data;
if (strcmp(gradient_name, grad->name) <= 0) if(grad_list == grad)
break; /* We found the one we want */ break;
n++; n++;
tmp = g_slist_next(tmp); tmp = g_slist_next(tmp);
} /* while */ } /* while */
if (!grad) { if (!grad || !grad_list) {
g_message ("ed_do_rename_gradient_callback(): oops, can't find gradient to delete"); g_message ("ed_do_rename_gradient_callback(): oops, can't find gradient to rename");
return; return;
} /* if */ } /* if */
/* leak? */
grad->name = gradient_name; /* We don't need to copy since this memory is ours */ grad->name = gradient_name; /* We don't need to copy since this memory is ours */
grad->dirty = 1; grad->dirty = 1;
/* Delete file and free gradient */ /* Delete file and free gradient */
unlink(curr_gradient->filename); unlink(grad->filename);
grad->filename = build_user_filename(grad->name, gradient_path); grad->filename = build_user_filename(grad->name, gradient_path);
...@@ -1621,6 +1628,8 @@ ed_do_copy_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer c ...@@ -1621,6 +1628,8 @@ ed_do_copy_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer c
curr_gradient = grad; curr_gradient = grad;
ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL); ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);
grad_sel_copy_all(pos,grad);
} /* ed_do_copy_gradient_callback */ } /* ed_do_copy_gradient_callback */
...@@ -1750,6 +1759,9 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data) ...@@ -1750,6 +1759,9 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
/* Update! */ /* Update! */
ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL); ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);
grad_sel_delete_all(real_pos);
} /* ed_do_delete_gradient_callback */ } /* ed_do_delete_gradient_callback */
...@@ -1782,7 +1794,7 @@ ed_rename_grads_callback(GtkWidget *widget, gpointer client_data) ...@@ -1782,7 +1794,7 @@ ed_rename_grads_callback(GtkWidget *widget, gpointer client_data)
query_string_box("Rename gradient", query_string_box("Rename gradient",
"Enter a new name for the gradient", "Enter a new name for the gradient",
curr_gradient->name, curr_gradient->name,
ed_do_rename_gradient_callback, NULL); ed_do_rename_gradient_callback, curr_gradient);
} }
/*****/ /*****/
...@@ -6676,6 +6688,71 @@ grad_sel_rename_all(gint n, gradient_t *grad) ...@@ -6676,6 +6688,71 @@ grad_sel_rename_all(gint n, gradient_t *grad)
} }
} }
static void
grad_sel_new_all(gint pos, gradient_t *grad)
{
GSList *list = active_dialogs;
GradSelectP gsp;
while(list)
{
gsp = (GradSelectP)list->data;
gtk_clist_freeze(GTK_CLIST(gsp->clist));
ed_insert_in_gradients_listbox(gsp->gc,gsp->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gsp->clist));
list = g_slist_next(list);
}
if(gradient_select_dialog)
{
gtk_clist_freeze(GTK_CLIST(gradient_select_dialog->clist));
ed_insert_in_gradients_listbox(gradient_select_dialog->gc,gradient_select_dialog->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gradient_select_dialog->clist));
}
}
static void
grad_sel_copy_all(gint pos, gradient_t *grad)
{
GSList *list = active_dialogs;
GradSelectP gsp;
while(list)
{
gsp = (GradSelectP)list->data;
gtk_clist_freeze(GTK_CLIST(gsp->clist));
ed_insert_in_gradients_listbox(gsp->gc,gsp->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gsp->clist));
list = g_slist_next(list);
}
if(gradient_select_dialog)
{
gtk_clist_freeze(GTK_CLIST(gradient_select_dialog->clist));
ed_insert_in_gradients_listbox(gradient_select_dialog->gc,gradient_select_dialog->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gradient_select_dialog->clist));
}
}
static void
grad_sel_delete_all(gint n)
{
GSList *list = active_dialogs;
GradSelectP gsp;
while(list)
{
gsp = (GradSelectP)list->data;
gtk_clist_remove(GTK_CLIST(gsp->clist), n);
list = g_slist_next(list);
}
if(gradient_select_dialog)
{
gtk_clist_remove(GTK_CLIST(gradient_select_dialog->clist), n);
}
}
static void static void
grad_sel_free_all() grad_sel_free_all()
{ {
...@@ -7286,7 +7363,7 @@ gradients_set_popup_invoker (Argument *args) ...@@ -7286,7 +7363,7 @@ gradients_set_popup_invoker (Argument *args)
while (tmp) { while (tmp) {
active = tmp->data; active = tmp->data;
if (strcmp(gradient_name, active->name) <= 0) if (strcmp(gradient_name, active->name) == 0)
break; /* We found the one we want */ break; /* We found the one we want */
pos++; pos++;
......
...@@ -576,6 +576,9 @@ static void sel_update_dialogs(gint row, gradient_t *grad); ...@@ -576,6 +576,9 @@ static void sel_update_dialogs(gint row, gradient_t *grad);
static void grad_sel_free_all(); static void grad_sel_free_all();
static void grad_sel_refill_all(); static void grad_sel_refill_all();
static void grad_sel_rename_all(gint n, gradient_t *grad); static void grad_sel_rename_all(gint n, gradient_t *grad);
static void grad_sel_new_all(gint n, gradient_t *grad);
static void grad_sel_copy_all(gint n, gradient_t *grad);
static void grad_sel_delete_all(gint n);
/* Procedural database functions */ /* Procedural database functions */
...@@ -1487,6 +1490,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca ...@@ -1487,6 +1490,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca
curr_gradient = grad; curr_gradient = grad;
ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL); ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);
grad_sel_new_all(pos,grad);
} /* ed_do_new_gradient_callback */ } /* ed_do_new_gradient_callback */
/*****/ /*****/
...@@ -1494,7 +1499,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca ...@@ -1494,7 +1499,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca
static void static void
ed_do_rename_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer call_data) ed_do_rename_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer call_data)
{ {
gradient_t *grad = NULL; gradient_t *grad = (gradient_t *)client_data;
gradient_t *grad_list = NULL;
char *gradient_name; char *gradient_name;
GSList *tmp; GSList *tmp;
int n; int n;
...@@ -1510,25 +1516,26 @@ ed_do_rename_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ...@@ -1510,25 +1516,26 @@ ed_do_rename_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer
tmp = gradients_list; tmp = gradients_list;
while (tmp) { while (tmp) {
grad = tmp->data; grad_list = tmp->data;
if (strcmp(gradient_name, grad->name) <= 0) if(grad_list == grad)
break; /* We found the one we want */ break;
n++; n++;
tmp = g_slist_next(tmp); tmp = g_slist_next(tmp);
} /* while */ } /* while */
if (!grad) { if (!grad || !grad_list) {
g_message ("ed_do_rename_gradient_callback(): oops, can't find gradient to delete"); g_message ("ed_do_rename_gradient_callback(): oops, can't find gradient to rename");
return; return;
} /* if */ } /* if */
/* leak? */
grad->name = gradient_name; /* We don't need to copy since this memory is ours */ grad->name = gradient_name; /* We don't need to copy since this memory is ours */
grad->dirty = 1; grad->dirty = 1;
/* Delete file and free gradient */ /* Delete file and free gradient */
unlink(curr_gradient->filename); unlink(grad->filename);
grad->filename = build_user_filename(grad->name, gradient_path); grad->filename = build_user_filename(grad->name, gradient_path);
...@@ -1621,6 +1628,8 @@ ed_do_copy_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer c ...@@ -1621,6 +1628,8 @@ ed_do_copy_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer c
curr_gradient = grad; curr_gradient = grad;
ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL); ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);
grad_sel_copy_all(pos,grad);
} /* ed_do_copy_gradient_callback */ } /* ed_do_copy_gradient_callback */
...@@ -1750,6 +1759,9 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data) ...@@ -1750,6 +1759,9 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
/* Update! */ /* Update! */
ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL); ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);
grad_sel_delete_all(real_pos);
} /* ed_do_delete_gradient_callback */ } /* ed_do_delete_gradient_callback */
...@@ -1782,7 +1794,7 @@ ed_rename_grads_callback(GtkWidget *widget, gpointer client_data) ...@@ -1782,7 +1794,7 @@ ed_rename_grads_callback(GtkWidget *widget, gpointer client_data)
query_string_box("Rename gradient", query_string_box("Rename gradient",
"Enter a new name for the gradient", "Enter a new name for the gradient",
curr_gradient->name, curr_gradient->name,
ed_do_rename_gradient_callback, NULL); ed_do_rename_gradient_callback, curr_gradient);
} }
/*****/ /*****/
...@@ -6676,6 +6688,71 @@ grad_sel_rename_all(gint n, gradient_t *grad) ...@@ -6676,6 +6688,71 @@ grad_sel_rename_all(gint n, gradient_t *grad)
} }
} }
static void
grad_sel_new_all(gint pos, gradient_t *grad)
{
GSList *list = active_dialogs;
GradSelectP gsp;
while(list)
{
gsp = (GradSelectP)list->data;
gtk_clist_freeze(GTK_CLIST(gsp->clist));
ed_insert_in_gradients_listbox(gsp->gc,gsp->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gsp->clist));
list = g_slist_next(list);
}
if(gradient_select_dialog)
{
gtk_clist_freeze(GTK_CLIST(gradient_select_dialog->clist));
ed_insert_in_gradients_listbox(gradient_select_dialog->gc,gradient_select_dialog->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gradient_select_dialog->clist));
}
}
static void
grad_sel_copy_all(gint pos, gradient_t *grad)
{
GSList *list = active_dialogs;
GradSelectP gsp;
while(list)
{
gsp = (GradSelectP)list->data;
gtk_clist_freeze(GTK_CLIST(gsp->clist));
ed_insert_in_gradients_listbox(gsp->gc,gsp->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gsp->clist));
list = g_slist_next(list);
}
if(gradient_select_dialog)
{
gtk_clist_freeze(GTK_CLIST(gradient_select_dialog->clist));
ed_insert_in_gradients_listbox(gradient_select_dialog->gc,gradient_select_dialog->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gradient_select_dialog->clist));
}
}
static void
grad_sel_delete_all(gint n)
{
GSList *list = active_dialogs;
GradSelectP gsp;
while(list)
{
gsp = (GradSelectP)list->data;
gtk_clist_remove(GTK_CLIST(gsp->clist), n);
list = g_slist_next(list);
}
if(gradient_select_dialog)
{
gtk_clist_remove(GTK_CLIST(gradient_select_dialog->clist), n);
}
}
static void static void
grad_sel_free_all() grad_sel_free_all()
{ {
...@@ -7286,7 +7363,7 @@ gradients_set_popup_invoker (Argument *args) ...@@ -7286,7 +7363,7 @@ gradients_set_popup_invoker (Argument *args)
while (tmp) { while (tmp) {
active = tmp->data; active = tmp->data;
if (strcmp(gradient_name, active->name) <= 0) if (strcmp(gradient_name, active->name) == 0)
break; /* We found the one we want */ break; /* We found the one we want */
pos++; pos++;
......
...@@ -576,6 +576,9 @@ static void sel_update_dialogs(gint row, gradient_t *grad); ...@@ -576,6 +576,9 @@ static void sel_update_dialogs(gint row, gradient_t *grad);
static void grad_sel_free_all(); static void grad_sel_free_all();
static void grad_sel_refill_all(); static void grad_sel_refill_all();
static void grad_sel_rename_all(gint n, gradient_t *grad); static void grad_sel_rename_all(gint n, gradient_t *grad);
static void grad_sel_new_all(gint n, gradient_t *grad);
static void grad_sel_copy_all(gint n, gradient_t *grad);
static void grad_sel_delete_all(gint n);
/* Procedural database functions */ /* Procedural database functions */
...@@ -1487,6 +1490,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca ...@@ -1487,6 +1490,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca
curr_gradient = grad; curr_gradient = grad;
ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL); ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);
grad_sel_new_all(pos,grad);
} /* ed_do_new_gradient_callback */ } /* ed_do_new_gradient_callback */
/*****/ /*****/
...@@ -1494,7 +1499,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca ...@@ -1494,7 +1499,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca
static void static void
ed_do_rename_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer call_data) ed_do_rename_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer call_data)
{ {
gradient_t *grad = NULL; gradient_t *grad = (gradient_t *)client_data;
gradient_t *grad_list = NULL;
char *gradient_name; char *gradient_name;
GSList *tmp; GSList *tmp;
int n; int n;
...@@ -1510,25 +1516,26 @@ ed_do_rename_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ...@@ -1510,25 +1516,26 @@ ed_do_rename_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer
tmp = gradients_list; tmp = gradients_list;
while (tmp) { while (tmp) {
grad = tmp->data; grad_list = tmp->data;
if (strcmp(gradient_name, grad->name) <= 0) if(grad_list == grad)
break; /* We found the one we want */ break;
n++; n++;
tmp = g_slist_next(tmp); tmp = g_slist_next(tmp);
} /* while */ } /* while */
if (!grad) { if (!grad || !grad_list) {
g_message ("ed_do_rename_gradient_callback(): oops, can't find gradient to delete"); g_message ("ed_do_rename_gradient_callback(): oops, can't find gradient to rename");
return; return;
} /* if */ } /* if */
/* leak? */
grad->name = gradient_name; /* We don't need to copy since this memory is ours */ grad->name = gradient_name; /* We don't need to copy since this memory is ours */
grad->dirty = 1; grad->dirty = 1;
/* Delete file and free gradient */ /* Delete file and free gradient */
unlink(curr_gradient->filename); unlink(grad->filename);
grad->filename = build_user_filename(grad->name, gradient_path); grad->filename = build_user_filename(grad->name, gradient_path);
...@@ -1621,6 +1628,8 @@ ed_do_copy_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer c ...@@ -1621,6 +1628,8 @@ ed_do_copy_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer c
curr_gradient = grad; curr_gradient = grad;
ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL); ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);
grad_sel_copy_all(pos,grad);
} /* ed_do_copy_gradient_callback */ } /* ed_do_copy_gradient_callback */
...@@ -1750,6 +1759,9 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data) ...@@ -1750,6 +1759,9 @@ ed_do_delete_gradient_callback(GtkWidget *widget, gpointer client_data)
/* Update! */ /* Update! */
ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL); ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);
grad_sel_delete_all(real_pos);
} /* ed_do_delete_gradient_callback */ } /* ed_do_delete_gradient_callback */
...@@ -1782,7 +1794,7 @@ ed_rename_grads_callback(GtkWidget *widget, gpointer client_data) ...@@ -1782,7 +1794,7 @@ ed_rename_grads_callback(GtkWidget *widget, gpointer client_data)
query_string_box("Rename gradient", query_string_box("Rename gradient",
"Enter a new name for the gradient", "Enter a new name for the gradient",
curr_gradient->name, curr_gradient->name,
ed_do_rename_gradient_callback, NULL); ed_do_rename_gradient_callback, curr_gradient);
} }
/*****/ /*****/
...@@ -6676,6 +6688,71 @@ grad_sel_rename_all(gint n, gradient_t *grad) ...@@ -6676,6 +6688,71 @@ grad_sel_rename_all(gint n, gradient_t *grad)
} }
} }
static void
grad_sel_new_all(gint pos, gradient_t *grad)
{
GSList *list = active_dialogs;
GradSelectP gsp;
while(list)
{
gsp = (GradSelectP)list->data;
gtk_clist_freeze(GTK_CLIST(gsp->clist));
ed_insert_in_gradients_listbox(gsp->gc,gsp->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gsp->clist));
list = g_slist_next(list);
}
if(gradient_select_dialog)
{
gtk_clist_freeze(GTK_CLIST(gradient_select_dialog->clist));
ed_insert_in_gradients_listbox(gradient_select_dialog->gc,gradient_select_dialog->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gradient_select_dialog->clist));
}
}
static void
grad_sel_copy_all(gint pos, gradient_t *grad)
{
GSList *list = active_dialogs;
GradSelectP gsp;
while(list)
{
gsp = (GradSelectP)list->data;
gtk_clist_freeze(GTK_CLIST(gsp->clist));
ed_insert_in_gradients_listbox(gsp->gc,gsp->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gsp->clist));
list = g_slist_next(list);
}
if(gradient_select_dialog)
{
gtk_clist_freeze(GTK_CLIST(gradient_select_dialog->clist));
ed_insert_in_gradients_listbox(gradient_select_dialog->gc,gradient_select_dialog->clist,grad, pos, 1);
gtk_clist_thaw(GTK_CLIST(gradient_select_dialog->clist));
}
}
static void
grad_sel_delete_all(gint n)
{
GSList *list = active_dialogs;
GradSelectP gsp;
while(list)
{
gsp = (GradSelectP)list->data;
gtk_clist_remove(GTK_CLIST(gsp->clist), n);
list = g_slist_next(list);
}
if(gradient_select_dialog)
{
gtk_clist_remove(GTK_CLIST(gradient_select_dialog->clist), n);
}
}
static void static void
grad_sel_free_all() grad_sel_free_all()
{ {
...@@ -7286,7 +7363,7 @@ gradients_set_popup_invoker (Argument *args) ...@@ -7286,7 +7363,7 @@ gradients_set_popup_invoker (Argument *args)
while (tmp) { while (tmp) {
active = tmp->data; active = tmp->data;
if (strcmp(gradient_name, active->name) <= 0) if (strcmp(gradient_name, active->name) == 0)
break; /* We found the one we want */ break; /* We found the one we want */
pos++; pos++;
......
...@@ -576,6 +576,9 @@ static void sel_update_dialogs(gint row, gradient_t *grad); ...@@ -576,6 +576,9 @@ static void sel_update_dialogs(gint row, gradient_t *grad);
static void grad_sel_free_all(); static void grad_sel_free_all();
static void grad_sel_refill_all(); static void grad_sel_refill_all();
static void grad_sel_rename_all(gint n, gradient_t *grad); static void grad_sel_rename_all(gint n, gradient_t *grad);
static void grad_sel_new_all(gint n, gradient_t *grad);
static void grad_sel_copy_all(gint n, gradient_t *grad);
static void grad_sel_delete_all(gint n);
/* Procedural database functions */ /* Procedural database functions */
...@@ -1487,6 +1490,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca ...@@ -1487,6 +1490,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca
curr_gradient = grad; curr_gradient = grad;
ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL); ed_update_editor(GRAD_UPDATE_PREVIEW | GRAD_RESET_CONTROL);
grad_sel_new_all(pos,grad);
} /* ed_do_new_gradient_callback */ } /* ed_do_new_gradient_callback */
/*****/ /*****/
...@@ -1494,7 +1499,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca ...@@ -1494,7 +1499,8 @@ ed_do_new_gradient_callback(GtkWidget *widget, gpointer client_data, gpointer ca