Commit 9f35f366 authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford

wow! Am I a moron or what 0 < 1 is not equivalent to strcmp ("a", "b")

Tue Jan  8 18:39:23 2002  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtktreedatalist.c (gtk_tree_data_list_compare_func): wow!
	Am I a moron or what 0 < 1 is not equivalent to strcmp ("a", "b")
parent 5c71539c
Tue Jan 8 18:39:23 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreedatalist.c (gtk_tree_data_list_compare_func): wow!
Am I a moron or what 0 < 1 is not equivalent to strcmp ("a", "b")
Tue Jan 8 18:04:01 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c (gtk_toolbar_set_icon_size):
......
Tue Jan 8 18:39:23 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreedatalist.c (gtk_tree_data_list_compare_func): wow!
Am I a moron or what 0 < 1 is not equivalent to strcmp ("a", "b")
Tue Jan 8 18:04:01 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c (gtk_toolbar_set_icon_size):
......
Tue Jan 8 18:39:23 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreedatalist.c (gtk_tree_data_list_compare_func): wow!
Am I a moron or what 0 < 1 is not equivalent to strcmp ("a", "b")
Tue Jan 8 18:04:01 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c (gtk_toolbar_set_icon_size):
......
Tue Jan 8 18:39:23 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreedatalist.c (gtk_tree_data_list_compare_func): wow!
Am I a moron or what 0 < 1 is not equivalent to strcmp ("a", "b")
Tue Jan 8 18:04:01 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c (gtk_toolbar_set_icon_size):
......
Tue Jan 8 18:39:23 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreedatalist.c (gtk_tree_data_list_compare_func): wow!
Am I a moron or what 0 < 1 is not equivalent to strcmp ("a", "b")
Tue Jan 8 18:04:01 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c (gtk_toolbar_set_icon_size):
......
Tue Jan 8 18:39:23 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreedatalist.c (gtk_tree_data_list_compare_func): wow!
Am I a moron or what 0 < 1 is not equivalent to strcmp ("a", "b")
Tue Jan 8 18:04:01 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c (gtk_toolbar_set_icon_size):
......
Tue Jan 8 18:39:23 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreedatalist.c (gtk_tree_data_list_compare_func): wow!
Am I a moron or what 0 < 1 is not equivalent to strcmp ("a", "b")
Tue Jan 8 18:04:01 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c (gtk_toolbar_set_icon_size):
......
......@@ -280,32 +280,78 @@ gtk_tree_data_list_compare_func (GtkTreeModel *model,
switch (G_TYPE_FUNDAMENTAL (type))
{
case G_TYPE_BOOLEAN:
retval = (g_value_get_int (&a_value) < g_value_get_int (&b_value));
if (g_value_get_int (&a_value) < g_value_get_int (&b_value))
retval = -1;
else if (g_value_get_int (&a_value) == g_value_get_int (&b_value))
retval = 0;
else
retval = 1;
break;
case G_TYPE_CHAR:
retval = (g_value_get_char (&a_value) < g_value_get_char (&b_value));
if (g_value_get_char (&a_value) < g_value_get_char (&b_value))
retval = -1;
else if (g_value_get_char (&a_value) == g_value_get_char (&b_value))
retval = 0;
else
retval = 1;
break;
case G_TYPE_UCHAR:
retval = (g_value_get_uchar (&a_value) < g_value_get_uchar (&b_value));
if (g_value_get_uchar (&a_value) < g_value_get_uchar (&b_value))
retval = -1;
else if (g_value_get_uchar (&a_value) == g_value_get_uchar (&b_value))
retval = 0;
else
retval = 1;
break;
case G_TYPE_INT:
retval = (g_value_get_int (&a_value) < g_value_get_int (&b_value));
if (g_value_get_int (&a_value) < g_value_get_int (&b_value))
retval = -1;
else if (g_value_get_int (&a_value) == g_value_get_int (&b_value))
retval = 0;
else
retval = 1;
break;
case G_TYPE_UINT:
retval = (g_value_get_uint (&a_value) < g_value_get_uint (&b_value));
if (g_value_get_uint (&a_value) < g_value_get_uint (&b_value))
retval = -1;
else if (g_value_get_uint (&a_value) == g_value_get_uint (&b_value))
retval = 0;
else
retval = 1;
break;
case G_TYPE_ENUM:
/* this is somewhat bogus. */
retval = (g_value_get_int (&a_value) < g_value_get_int (&b_value));
if (g_value_get_int (&a_value) < g_value_get_int (&b_value))
retval = -1;
else if (g_value_get_int (&a_value) == g_value_get_int (&b_value))
retval = 0;
else
retval = 1;
break;
case G_TYPE_FLAGS:
retval = (g_value_get_uint (&a_value) < g_value_get_uint (&b_value));
/* this is even more bogus. */
if (g_value_get_uint (&a_value) < g_value_get_uint (&b_value))
retval = -1;
else if (g_value_get_uint (&a_value) == g_value_get_uint (&b_value))
retval = 0;
else
retval = 1;
break;
case G_TYPE_FLOAT:
retval = (g_value_get_float (&a_value) < g_value_get_float (&b_value));
if (g_value_get_float (&a_value) < g_value_get_float (&b_value))
retval = -1;
else if (g_value_get_float (&a_value) == g_value_get_float (&b_value))
retval = 0;
else
retval = 1;
break;
case G_TYPE_DOUBLE:
retval = (g_value_get_double (&a_value) < g_value_get_double (&b_value));
if (g_value_get_double (&a_value) < g_value_get_double (&b_value))
retval = -1;
else if (g_value_get_double (&a_value) == g_value_get_double (&b_value))
retval = 0;
else
retval = 1;
break;
case G_TYPE_STRING:
stra = g_value_get_string (&a_value);
......
......@@ -1794,6 +1794,7 @@ gtk_tree_store_sort_helper (GtkTreeStore *tree_store,
i++;
}
/* Sort the array */
g_array_sort_with_data (sort_array, gtk_tree_store_compare_func, tree_store);
for (i = 0; i < list_length - 1; i++)
......
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