Add a "collate" sort callback that uses the new g_collate_compare().
2002-12-05 Jeffrey Stedfast <fejj@ximian.com> * e-table-extras.c (ete_init): Add a "collate" sort callback that uses the new g_collate_compare(). 2002-12-05 Jeffrey Stedfast <fejj@ximian.com> * gal/util/e-util.c (g_str_compare): Revert back to using just strcmp - this fixes bug #33933 but reopens bug #26355. (g_collate_compare): New function meant to address the sorting required by bug #26335. svn path=/trunk/; revision=19014
This commit is contained in:
committed by
Jeffrey Stedfast
parent
31002ecdfa
commit
1d8a9f2443
@ -45,27 +45,40 @@
|
||||
#endif
|
||||
|
||||
int
|
||||
g_str_compare(const void *x, const void *y)
|
||||
g_str_compare (const void *x, const void *y)
|
||||
{
|
||||
if (x == NULL || y == NULL) {
|
||||
if (x == y)
|
||||
return 0;
|
||||
else
|
||||
return x ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
return strcmp (x, y);
|
||||
}
|
||||
|
||||
int
|
||||
g_collate_compare (const void *x, const void *y)
|
||||
{
|
||||
if (x == NULL || y == NULL) {
|
||||
if (x == y)
|
||||
return 0;
|
||||
else
|
||||
return x ? -1 : 1;
|
||||
}
|
||||
|
||||
return g_utf8_collate (x, y);
|
||||
}
|
||||
|
||||
int
|
||||
g_int_compare(const void *x, const void *y)
|
||||
g_int_compare (const void *x, const void *y)
|
||||
{
|
||||
if ( GPOINTER_TO_INT(x) < GPOINTER_TO_INT(y) )
|
||||
return -1;
|
||||
else if ( GPOINTER_TO_INT(x) == GPOINTER_TO_INT(y) )
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
if (GPOINTER_TO_INT (x) < GPOINTER_TO_INT (y))
|
||||
return -1;
|
||||
else if (GPOINTER_TO_INT (x) == GPOINTER_TO_INT (y))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *
|
||||
|
||||
@ -139,6 +139,8 @@ typedef enum {
|
||||
} EFocus;
|
||||
int g_str_compare (const void *x,
|
||||
const void *y);
|
||||
int g_collate_compare (const void *x,
|
||||
const void *y);
|
||||
int g_int_compare (const void *x,
|
||||
const void *y);
|
||||
char *e_strdup_strip (const char *string);
|
||||
|
||||
@ -164,6 +164,7 @@ ete_init (ETableExtras *extras)
|
||||
extras->pixbufs = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
|
||||
e_table_extras_add_compare(extras, "string", g_str_compare);
|
||||
e_table_extras_add_compare(extras, "collate", g_collate_compare);
|
||||
e_table_extras_add_compare(extras, "integer", g_int_compare);
|
||||
e_table_extras_add_compare(extras, "string-integer", e_strint_compare);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user