diff options
author | Daniel Elstner <daniel.elstner@gmx.net> | 2002-05-27 22:42:08 +0000 |
---|---|---|
committer | Daniel Elstner <daniel@src.gnome.org> | 2002-05-27 22:42:08 +0000 |
commit | 810e488074871976be56df86aeb7f44f167de596 (patch) | |
tree | 3ed8e209c88cfbce32af3342526b19dab00e8f1a /gtk/gtktreedatalist.c | |
parent | cffb8ea32dade7798962fd9b150c13fb793be070 (diff) | |
download | gtk+-810e488074871976be56df86aeb7f44f167de596.tar.gz |
[ merge from stable ]
2002-05-27 Daniel Elstner <daniel.elstner@gmx.net>
[ merge from stable ]
Fixes for #83190
* gtk/gtktreedatalist.h (_GtkTreeDataList::data): Add missing fields to anonymous union: glong, gulong, gint64 and guint64. This is an internal header file, so it should not affect ABI or API compatibility.
* gtk/gtktreedatalist.c (_gtk_tree_data_list_node_to_value): Implement missing support for glong, gulong, gint64 and guint64 fundamental types. Use data.v_uint instead of data.v_int for G_TYPE_FLAGS, as GValue does.
(_gtk_tree_data_list_value_to_node): ditto
(_gtk_tree_data_list_node_copy): Add case labels for missing fundamental types, and reorder them to match the other functions.
(gtk_tree_data_list_compare_func): Implement comparison for glong, gulong, gint64 and guint64. Use g_value_get_enum() for G_TYPE_ENUM and g_value_get_flags() for G_TYPE_FLAGS, rather than accessing them as gint/guint. The G_VALUE_HOLDS() check probably won't like this.
Diffstat (limited to 'gtk/gtktreedatalist.c')
-rw-r--r-- | gtk/gtktreedatalist.c | 88 |
1 files changed, 75 insertions, 13 deletions
diff --git a/gtk/gtktreedatalist.c b/gtk/gtktreedatalist.c index 137de3e27a..301022ebc9 100644 --- a/gtk/gtktreedatalist.c +++ b/gtk/gtktreedatalist.c @@ -133,11 +133,23 @@ _gtk_tree_data_list_node_to_value (GtkTreeDataList *list, case G_TYPE_UINT: g_value_set_uint (value, (guint) list->data.v_uint); break; + case G_TYPE_LONG: + g_value_set_long (value, list->data.v_long); + break; + case G_TYPE_ULONG: + g_value_set_ulong (value, list->data.v_ulong); + break; + case G_TYPE_INT64: + g_value_set_int64 (value, list->data.v_int64); + break; + case G_TYPE_UINT64: + g_value_set_uint64 (value, list->data.v_uint64); + break; case G_TYPE_ENUM: g_value_set_enum (value, list->data.v_int); break; case G_TYPE_FLAGS: - g_value_set_flags (value, (int) list->data.v_int); + g_value_set_flags (value, list->data.v_uint); break; case G_TYPE_FLOAT: g_value_set_float (value, (gfloat) list->data.v_float); @@ -181,14 +193,26 @@ _gtk_tree_data_list_value_to_node (GtkTreeDataList *list, case G_TYPE_INT: list->data.v_int = g_value_get_int (value); break; + case G_TYPE_UINT: + list->data.v_uint = g_value_get_uint (value); + break; + case G_TYPE_LONG: + list->data.v_long = g_value_get_long (value); + break; + case G_TYPE_ULONG: + list->data.v_ulong = g_value_get_ulong (value); + break; + case G_TYPE_INT64: + list->data.v_int64 = g_value_get_int64 (value); + break; + case G_TYPE_UINT64: + list->data.v_uint64 = g_value_get_uint64 (value); + break; case G_TYPE_ENUM: list->data.v_int = g_value_get_enum (value); break; case G_TYPE_FLAGS: - list->data.v_int = g_value_get_flags (value); - break; - case G_TYPE_UINT: - list->data.v_uint = g_value_get_uint (value); + list->data.v_uint = g_value_get_flags (value); break; case G_TYPE_POINTER: list->data.v_pointer = g_value_get_pointer (value); @@ -233,11 +257,17 @@ _gtk_tree_data_list_node_copy (GtkTreeDataList *list, switch (G_TYPE_FUNDAMENTAL (type)) { - case G_TYPE_UINT: - case G_TYPE_INT: - case G_TYPE_UCHAR: - case G_TYPE_CHAR: case G_TYPE_BOOLEAN: + case G_TYPE_CHAR: + case G_TYPE_UCHAR: + case G_TYPE_INT: + case G_TYPE_UINT: + case G_TYPE_LONG: + case G_TYPE_ULONG: + case G_TYPE_INT64: + case G_TYPE_UINT64: + case G_TYPE_ENUM: + case G_TYPE_FLAGS: case G_TYPE_POINTER: case G_TYPE_FLOAT: case G_TYPE_DOUBLE: @@ -323,20 +353,52 @@ gtk_tree_data_list_compare_func (GtkTreeModel *model, else retval = 1; break; + case G_TYPE_LONG: + if (g_value_get_long (&a_value) < g_value_get_long (&b_value)) + retval = -1; + else if (g_value_get_long (&a_value) == g_value_get_long (&b_value)) + retval = 0; + else + retval = 1; + break; + case G_TYPE_ULONG: + if (g_value_get_ulong (&a_value) < g_value_get_ulong (&b_value)) + retval = -1; + else if (g_value_get_ulong (&a_value) == g_value_get_ulong (&b_value)) + retval = 0; + else + retval = 1; + break; + case G_TYPE_INT64: + if (g_value_get_int64 (&a_value) < g_value_get_int64 (&b_value)) + retval = -1; + else if (g_value_get_int64 (&a_value) == g_value_get_int64 (&b_value)) + retval = 0; + else + retval = 1; + break; + case G_TYPE_UINT64: + if (g_value_get_uint64 (&a_value) < g_value_get_uint64 (&b_value)) + retval = -1; + else if (g_value_get_uint64 (&a_value) == g_value_get_uint64 (&b_value)) + retval = 0; + else + retval = 1; + break; case G_TYPE_ENUM: /* this is somewhat bogus. */ - if (g_value_get_int (&a_value) < g_value_get_int (&b_value)) + if (g_value_get_enum (&a_value) < g_value_get_enum (&b_value)) retval = -1; - else if (g_value_get_int (&a_value) == g_value_get_int (&b_value)) + else if (g_value_get_enum (&a_value) == g_value_get_enum (&b_value)) retval = 0; else retval = 1; break; case G_TYPE_FLAGS: /* this is even more bogus. */ - if (g_value_get_uint (&a_value) < g_value_get_uint (&b_value)) + if (g_value_get_flags (&a_value) < g_value_get_flags (&b_value)) retval = -1; - else if (g_value_get_uint (&a_value) == g_value_get_uint (&b_value)) + else if (g_value_get_flags (&a_value) == g_value_get_flags (&b_value)) retval = 0; else retval = 1; |