Commit ae7184b6 authored by Manish Singh's avatar Manish Singh

Use our own sort function, because the glib sort doesn't work for us

anymore.

-Yosh
parent 3905c694
Sun Feb 22 02:43:12 PST 1998 Manish Singh <yosh@gimp.org>
* app/text_tool.c: use our own sort function to appease
the gtk gods
Sat Feb 21 16:40:47 EST 1998 Adrian Likins <adrian@gimp.org>
* plugins/destripe/detripe: updated destripe
......
......@@ -1218,13 +1218,55 @@ text_insert_field (GSList *list,
char *fontname,
int field_num)
{
GSList *tmp_list = list;
GSList *prev_list = NULL;
GSList *new_list;
gint cmp;
char *field;
field = text_get_field (fontname, field_num);
if (!field)
return list;
return g_slist_insert_sorted (list, field, font_compare_func);
if (!list)
{
new_list = g_slist_alloc();
new_list->data = field;
return new_list;
}
cmp = font_compare_func (field, tmp_list->data);
while ((tmp_list->next) && (cmp > 0))
{
prev_list = tmp_list;
tmp_list = tmp_list->next;
cmp = font_compare_func (field, tmp_list->data);
}
if (cmp == 0)
return list;
new_list = g_slist_alloc();
new_list->data = field;
if ((!tmp_list->next) && (cmp > 0))
{
tmp_list->next = new_list;
return list;
}
if (prev_list)
{
prev_list->next = new_list;
new_list->next = tmp_list;
return list;
}
else
{
new_list->next = list;
return new_list;
}
}
static char*
......
......@@ -1218,13 +1218,55 @@ text_insert_field (GSList *list,
char *fontname,
int field_num)
{
GSList *tmp_list = list;
GSList *prev_list = NULL;
GSList *new_list;
gint cmp;
char *field;
field = text_get_field (fontname, field_num);
if (!field)
return list;
return g_slist_insert_sorted (list, field, font_compare_func);
if (!list)
{
new_list = g_slist_alloc();
new_list->data = field;
return new_list;
}
cmp = font_compare_func (field, tmp_list->data);
while ((tmp_list->next) && (cmp > 0))
{
prev_list = tmp_list;
tmp_list = tmp_list->next;
cmp = font_compare_func (field, tmp_list->data);
}
if (cmp == 0)
return list;
new_list = g_slist_alloc();
new_list->data = field;
if ((!tmp_list->next) && (cmp > 0))
{
tmp_list->next = new_list;
return list;
}
if (prev_list)
{
prev_list->next = new_list;
new_list->next = tmp_list;
return list;
}
else
{
new_list->next = list;
return new_list;
}
}
static char*
......
......@@ -1218,13 +1218,55 @@ text_insert_field (GSList *list,
char *fontname,
int field_num)
{
GSList *tmp_list = list;
GSList *prev_list = NULL;
GSList *new_list;
gint cmp;
char *field;
field = text_get_field (fontname, field_num);
if (!field)
return list;
return g_slist_insert_sorted (list, field, font_compare_func);
if (!list)
{
new_list = g_slist_alloc();
new_list->data = field;
return new_list;
}
cmp = font_compare_func (field, tmp_list->data);
while ((tmp_list->next) && (cmp > 0))
{
prev_list = tmp_list;
tmp_list = tmp_list->next;
cmp = font_compare_func (field, tmp_list->data);
}
if (cmp == 0)
return list;
new_list = g_slist_alloc();
new_list->data = field;
if ((!tmp_list->next) && (cmp > 0))
{
tmp_list->next = new_list;
return list;
}
if (prev_list)
{
prev_list->next = new_list;
new_list->next = tmp_list;
return list;
}
else
{
new_list->next = list;
return new_list;
}
}
static char*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment