Adapt to GtkTreeSelection changes
2001-01-01 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c: Adapt to GtkTreeSelection changes
* gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view):
don't fill in tree_view->priv->selection, kind of an unexpected
side effect
* gtk/gtkcellrenderertext.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderer.c: Remove definition of _ and include
gtkintl.h
(gtk_cell_renderer_get_property): remove calls to g_value_init
* gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro
and include gtkintl.h
(gtk_cell_renderer_text_pixbuf_class_init): remove spaces from
property names
* gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return
GtkTreeSelection
(_gtk_tree_selection_new_from_with_view): rename, return
GtkTreeSelection
(_gtk_tree_selection_set_tree_view): rename with uscore
(gtk_tree_selection_get_selected): fill in the "model" out param
first, so it gets filled in even if we return at the top of the
function
(gtk_tree_selection_real_select_all): add a comment and an else{}
to clarify this a bit
(gtk_tree_selection_real_unselect_all): add the same else{}
* gtk/gtktreeselection.h: Rename new, new_with_tree_view, and
set_tree_view to have underscore prefixes, move them to the
private header, fix return type of new_with_tree_view
(struct _GtkTreeSelection): mark struct
fields private
* gtk/gtktreemodel.c (gtk_tree_model_get_flags): return
GtkTreeModelFlags, not a guint
(gtk_tree_path_prev): return gboolean not gint
(gtk_tree_path_up): return gboolean not gint
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags
return GtkTreeModelFlags, not a guint
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check
that child model is non-null before unrefing it
(g_value_int_compare_func): make this a qsort compare func, not
a boolean predicate
* gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column,
(add -umn to the end), and mark it unimplemented
(gtk_tree_model_sort_resort): remove, this wasn't implemented, and
I don't see what it's for - doesn't the model always sort itself?
(gtk_tree_model_sort_set_compare): this had the wrong signature
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes):
Fix the docs to say that it destructively replaces existing
attributes (previously said that it added attributes).
(gtk_tree_view_column_set_visible): canonicalize bool before
equality testing. Also, check for realization before
hiding/showing the tree_column->window; if this window could exist
before realization, then it's busted and needs fixing, we can't
create GDK resources pre-realization. Also, remove
superfluous queue_resize(), since set_size() does that for us.
(gtk_tree_view_column_set_col_type): check realization before
using tree_column->window
* gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
|
|
|
/* gtktreedatalist.c
|
2000-10-05 01:04:57 +00:00
|
|
|
* Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
2001-03-23 00:35:19 +00:00
|
|
|
*
|
|
|
|
* This file contains code shared between GtkTreeStore and GtkListStore. Please
|
|
|
|
* do not use it.
|
2000-10-05 01:04:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gtktreedatalist.h"
|
2001-03-23 00:35:19 +00:00
|
|
|
#include <string.h>
|
2001-03-13 02:00:37 +00:00
|
|
|
static GMemChunk *tree_chunk = NULL;
|
|
|
|
#define TREE_CHUNK_PREALLOCS 64
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
/* node allocation
|
|
|
|
*/
|
|
|
|
GtkTreeDataList *
|
2000-10-27 23:34:58 +00:00
|
|
|
_gtk_tree_data_list_alloc (void)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
GtkTreeDataList *list;
|
|
|
|
|
2001-03-13 02:00:37 +00:00
|
|
|
if (tree_chunk == NULL)
|
|
|
|
tree_chunk = g_mem_chunk_new ("treedatalist mem chunk",
|
|
|
|
sizeof (GtkTreeDataList),
|
|
|
|
sizeof (GtkTreeDataList) * TREE_CHUNK_PREALLOCS,
|
|
|
|
G_ALLOC_AND_FREE);
|
|
|
|
|
|
|
|
list = g_chunk_new (GtkTreeDataList, tree_chunk);
|
2001-10-31 18:54:20 +00:00
|
|
|
memset (list, 0, sizeof (GtkTreeDataList));
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-10-27 23:34:58 +00:00
|
|
|
_gtk_tree_data_list_free (GtkTreeDataList *list,
|
|
|
|
GType *column_headers)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2001-03-13 02:00:37 +00:00
|
|
|
GtkTreeDataList *tmp, *next;
|
2000-10-27 23:34:58 +00:00
|
|
|
gint i = 0;
|
|
|
|
|
2001-03-13 02:00:37 +00:00
|
|
|
tmp = list;
|
|
|
|
|
|
|
|
while (tmp)
|
2000-10-27 23:34:58 +00:00
|
|
|
{
|
2001-03-13 02:00:37 +00:00
|
|
|
next = tmp->next;
|
2001-03-10 01:34:48 +00:00
|
|
|
if (g_type_is_a (column_headers [i], G_TYPE_STRING))
|
|
|
|
g_free ((gchar *) tmp->data.v_pointer);
|
2001-11-15 23:46:05 +00:00
|
|
|
else if (g_type_is_a (column_headers [i], G_TYPE_OBJECT) && tmp->data.v_pointer != NULL)
|
2002-10-07 19:10:39 +00:00
|
|
|
g_object_unref (tmp->data.v_pointer);
|
2001-11-15 23:46:05 +00:00
|
|
|
else if (g_type_is_a (column_headers [i], G_TYPE_BOXED) && tmp->data.v_pointer != NULL)
|
2001-03-10 01:34:48 +00:00
|
|
|
g_boxed_free (column_headers [i], (gpointer) tmp->data.v_pointer);
|
2001-03-13 02:00:37 +00:00
|
|
|
|
|
|
|
g_mem_chunk_free (tree_chunk, tmp);
|
2000-10-27 23:34:58 +00:00
|
|
|
i++;
|
2001-03-13 02:00:37 +00:00
|
|
|
tmp = next;
|
2000-10-27 23:34:58 +00:00
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2001-03-10 01:34:48 +00:00
|
|
|
gboolean
|
|
|
|
_gtk_tree_data_list_check_type (GType type)
|
|
|
|
{
|
|
|
|
gint i = 0;
|
|
|
|
static GType type_list[] =
|
|
|
|
{
|
|
|
|
G_TYPE_BOOLEAN,
|
|
|
|
G_TYPE_CHAR,
|
|
|
|
G_TYPE_UCHAR,
|
|
|
|
G_TYPE_INT,
|
|
|
|
G_TYPE_UINT,
|
2002-04-09 19:48:32 +00:00
|
|
|
G_TYPE_LONG,
|
|
|
|
G_TYPE_ULONG,
|
|
|
|
G_TYPE_INT64,
|
|
|
|
G_TYPE_UINT64,
|
2001-03-10 01:34:48 +00:00
|
|
|
G_TYPE_ENUM,
|
|
|
|
G_TYPE_FLAGS,
|
|
|
|
G_TYPE_FLOAT,
|
|
|
|
G_TYPE_DOUBLE,
|
|
|
|
G_TYPE_STRING,
|
|
|
|
G_TYPE_POINTER,
|
|
|
|
G_TYPE_BOXED,
|
|
|
|
G_TYPE_OBJECT,
|
|
|
|
G_TYPE_INVALID
|
|
|
|
};
|
|
|
|
|
2001-03-13 02:00:37 +00:00
|
|
|
if (! G_TYPE_IS_VALUE_TYPE (type))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
2001-03-10 01:34:48 +00:00
|
|
|
while (type_list[i] != G_TYPE_INVALID)
|
|
|
|
{
|
|
|
|
if (g_type_is_a (type, type_list[i]))
|
|
|
|
return TRUE;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2001-04-23 23:03:53 +00:00
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
2000-10-27 23:34:58 +00:00
|
|
|
_gtk_tree_data_list_node_to_value (GtkTreeDataList *list,
|
|
|
|
GType type,
|
|
|
|
GValue *value)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
g_value_init (value, type);
|
|
|
|
|
2001-03-13 02:00:37 +00:00
|
|
|
switch (G_TYPE_FUNDAMENTAL (type))
|
|
|
|
{
|
|
|
|
case G_TYPE_BOOLEAN:
|
|
|
|
g_value_set_boolean (value, (gboolean) list->data.v_int);
|
|
|
|
break;
|
|
|
|
case G_TYPE_CHAR:
|
|
|
|
g_value_set_char (value, (gchar) list->data.v_char);
|
|
|
|
break;
|
|
|
|
case G_TYPE_UCHAR:
|
|
|
|
g_value_set_uchar (value, (guchar) list->data.v_uchar);
|
|
|
|
break;
|
|
|
|
case G_TYPE_INT:
|
|
|
|
g_value_set_int (value, (gint) list->data.v_int);
|
|
|
|
break;
|
|
|
|
case G_TYPE_UINT:
|
|
|
|
g_value_set_uint (value, (guint) list->data.v_uint);
|
|
|
|
break;
|
[ 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.
2002-05-27 22:42:08 +00:00
|
|
|
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;
|
2001-03-13 02:00:37 +00:00
|
|
|
case G_TYPE_ENUM:
|
|
|
|
g_value_set_enum (value, list->data.v_int);
|
|
|
|
break;
|
|
|
|
case G_TYPE_FLAGS:
|
[ 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.
2002-05-27 22:42:08 +00:00
|
|
|
g_value_set_flags (value, list->data.v_uint);
|
2001-03-13 02:00:37 +00:00
|
|
|
break;
|
|
|
|
case G_TYPE_FLOAT:
|
|
|
|
g_value_set_float (value, (gfloat) list->data.v_float);
|
|
|
|
break;
|
|
|
|
case G_TYPE_DOUBLE:
|
|
|
|
g_value_set_double (value, (gdouble) list->data.v_double);
|
|
|
|
break;
|
|
|
|
case G_TYPE_STRING:
|
|
|
|
g_value_set_string (value, (gchar *) list->data.v_pointer);
|
|
|
|
break;
|
|
|
|
case G_TYPE_POINTER:
|
|
|
|
g_value_set_pointer (value, (gpointer) list->data.v_pointer);
|
|
|
|
break;
|
|
|
|
case G_TYPE_BOXED:
|
|
|
|
g_value_set_boxed (value, (gpointer) list->data.v_pointer);
|
|
|
|
break;
|
|
|
|
case G_TYPE_OBJECT:
|
|
|
|
g_value_set_object (value, (GObject *) list->data.v_pointer);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_warning ("%s: Unsupported type (%s) retrieved.", G_STRLOC, g_type_name (value->g_type));
|
|
|
|
break;
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-10-27 23:34:58 +00:00
|
|
|
_gtk_tree_data_list_value_to_node (GtkTreeDataList *list,
|
|
|
|
GValue *value)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2001-03-13 02:00:37 +00:00
|
|
|
switch (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (value)))
|
|
|
|
{
|
|
|
|
case G_TYPE_BOOLEAN:
|
|
|
|
list->data.v_int = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case G_TYPE_CHAR:
|
|
|
|
list->data.v_char = g_value_get_char (value);
|
|
|
|
break;
|
|
|
|
case G_TYPE_UCHAR:
|
|
|
|
list->data.v_uchar = g_value_get_uchar (value);
|
|
|
|
break;
|
|
|
|
case G_TYPE_INT:
|
|
|
|
list->data.v_int = g_value_get_int (value);
|
|
|
|
break;
|
[ 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.
2002-05-27 22:42:08 +00:00
|
|
|
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;
|
2001-03-13 02:00:37 +00:00
|
|
|
case G_TYPE_ENUM:
|
|
|
|
list->data.v_int = g_value_get_enum (value);
|
|
|
|
break;
|
|
|
|
case G_TYPE_FLAGS:
|
[ 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.
2002-05-27 22:42:08 +00:00
|
|
|
list->data.v_uint = g_value_get_flags (value);
|
2001-03-13 02:00:37 +00:00
|
|
|
break;
|
|
|
|
case G_TYPE_POINTER:
|
|
|
|
list->data.v_pointer = g_value_get_pointer (value);
|
|
|
|
break;
|
|
|
|
case G_TYPE_FLOAT:
|
|
|
|
list->data.v_float = g_value_get_float (value);
|
|
|
|
break;
|
|
|
|
case G_TYPE_DOUBLE:
|
|
|
|
list->data.v_double = g_value_get_double (value);
|
|
|
|
break;
|
|
|
|
case G_TYPE_STRING:
|
2001-12-03 21:20:12 +00:00
|
|
|
if (list->data.v_pointer)
|
|
|
|
g_free (list->data.v_pointer);
|
2001-03-13 02:00:37 +00:00
|
|
|
list->data.v_pointer = g_value_dup_string (value);
|
|
|
|
break;
|
|
|
|
case G_TYPE_OBJECT:
|
2001-12-03 21:20:12 +00:00
|
|
|
if (list->data.v_pointer)
|
|
|
|
g_object_unref (list->data.v_pointer);
|
2001-03-13 02:00:37 +00:00
|
|
|
list->data.v_pointer = g_value_dup_object (value);
|
|
|
|
break;
|
|
|
|
case G_TYPE_BOXED:
|
2001-12-03 21:20:12 +00:00
|
|
|
if (list->data.v_pointer)
|
|
|
|
g_boxed_free (G_VALUE_TYPE (value), list->data.v_pointer);
|
2001-03-13 02:00:37 +00:00
|
|
|
list->data.v_pointer = g_value_dup_boxed (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_warning ("%s: Unsupported type (%s) stored.", G_STRLOC, g_type_name (G_VALUE_TYPE (value)));
|
|
|
|
break;
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2001-03-13 02:00:37 +00:00
|
|
|
GtkTreeDataList *
|
adapt to handle PangoColor
2001-01-26 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor
* gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to
not offset by TREE_VIEW_HEADER_HEIGHT
(gtk_tree_view_tree_to_widget_coords): fix to not offset by
TREE_VIEW_HEADER_HEIGHT
* configure.in (included_loaders): for me, --with-included-loaders
generates the error "the specified loader yes does not exist",
i.e. the arg defaults to "yes", so change test for value ""
to test for value "yes", and include all loaders in that case.
* gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function
* gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly
handle TREE_VIEW_VERTICAL_SEPARATOR
(gtk_tree_view_bin_expose): fix to consider the row offset as
pointing halfway into vertical separator.
(gtk_tree_view_draw_node_focus_rect): ditto
* gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add
--gtk-debug=updates, which causes gdk_window_set_debug_updates
(TRUE) to be called.
* gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a
debug mode where the invalid region is colored in on invalidate,
so you can see the flicker and know whether your redraw code is
doing a good job.
* gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in
tree window coordinates (clip rect is in tree window coords)
* gtk/Makefile.am: add gtktreednd.[hc]
* gtk/gtkliststore.c: implement gtktreednd interfaces.
* gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support
drag-and-drop data operations on a model (so we can set up tree
drag-and-drop automatically)
* gtk/testgtk.c: Add a window to change sensitivity in the
GtkLabel test; add a way to change the entry frame in GtkEntry
test
* gtk/gtkentry.c (gtk_entry_set_has_frame):
(gtk_entry_get_has_frame): new functions to remove the frame
around an entry
(gtk_entry_size_request): shrink requisition if no frame
(gtk_entry_draw_focus): don't draw frame if no frame
* gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for
checks inside a cell renderer
(gtk_default_draw_option): ditto for options
* gtk/gtktreeviewcolumn.c (update_button_contents): add/remove
children from the alignment, not the button
(gtk_tree_view_column_init): ref/sink the column, to emulate
GObject refcounting.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render):
Use theme functions to draw the toggles
* gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors
* gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and
GdkPangoAttrEmbossed to use in rendering insensitive text
* gdk/gdkpango.c (gdk_draw_layout_line): render new properties
* gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity
using new GDK features
2001-01-26 21:12:05 +00:00
|
|
|
_gtk_tree_data_list_node_copy (GtkTreeDataList *list,
|
|
|
|
GType type)
|
|
|
|
{
|
|
|
|
GtkTreeDataList *new_list;
|
2001-01-31 00:57:49 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (list != NULL, NULL);
|
adapt to handle PangoColor
2001-01-26 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor
* gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to
not offset by TREE_VIEW_HEADER_HEIGHT
(gtk_tree_view_tree_to_widget_coords): fix to not offset by
TREE_VIEW_HEADER_HEIGHT
* configure.in (included_loaders): for me, --with-included-loaders
generates the error "the specified loader yes does not exist",
i.e. the arg defaults to "yes", so change test for value ""
to test for value "yes", and include all loaders in that case.
* gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function
* gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly
handle TREE_VIEW_VERTICAL_SEPARATOR
(gtk_tree_view_bin_expose): fix to consider the row offset as
pointing halfway into vertical separator.
(gtk_tree_view_draw_node_focus_rect): ditto
* gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add
--gtk-debug=updates, which causes gdk_window_set_debug_updates
(TRUE) to be called.
* gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a
debug mode where the invalid region is colored in on invalidate,
so you can see the flicker and know whether your redraw code is
doing a good job.
* gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in
tree window coordinates (clip rect is in tree window coords)
* gtk/Makefile.am: add gtktreednd.[hc]
* gtk/gtkliststore.c: implement gtktreednd interfaces.
* gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support
drag-and-drop data operations on a model (so we can set up tree
drag-and-drop automatically)
* gtk/testgtk.c: Add a window to change sensitivity in the
GtkLabel test; add a way to change the entry frame in GtkEntry
test
* gtk/gtkentry.c (gtk_entry_set_has_frame):
(gtk_entry_get_has_frame): new functions to remove the frame
around an entry
(gtk_entry_size_request): shrink requisition if no frame
(gtk_entry_draw_focus): don't draw frame if no frame
* gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for
checks inside a cell renderer
(gtk_default_draw_option): ditto for options
* gtk/gtktreeviewcolumn.c (update_button_contents): add/remove
children from the alignment, not the button
(gtk_tree_view_column_init): ref/sink the column, to emulate
GObject refcounting.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render):
Use theme functions to draw the toggles
* gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors
* gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and
GdkPangoAttrEmbossed to use in rendering insensitive text
* gdk/gdkpango.c (gdk_draw_layout_line): render new properties
* gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity
using new GDK features
2001-01-26 21:12:05 +00:00
|
|
|
|
|
|
|
new_list = _gtk_tree_data_list_alloc ();
|
2001-01-31 00:57:49 +00:00
|
|
|
new_list->next = NULL;
|
2000-10-13 00:34:38 +00:00
|
|
|
|
2001-03-13 02:00:37 +00:00
|
|
|
switch (G_TYPE_FUNDAMENTAL (type))
|
2001-03-10 01:34:48 +00:00
|
|
|
{
|
2001-03-13 02:00:37 +00:00
|
|
|
case G_TYPE_BOOLEAN:
|
[ 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.
2002-05-27 22:42:08 +00:00
|
|
|
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:
|
2001-03-13 02:00:37 +00:00
|
|
|
case G_TYPE_POINTER:
|
|
|
|
case G_TYPE_FLOAT:
|
|
|
|
case G_TYPE_DOUBLE:
|
|
|
|
new_list->data = list->data;
|
|
|
|
break;
|
|
|
|
case G_TYPE_STRING:
|
|
|
|
new_list->data.v_pointer = g_strdup (list->data.v_pointer);
|
|
|
|
break;
|
|
|
|
case G_TYPE_OBJECT:
|
2001-03-10 01:34:48 +00:00
|
|
|
new_list->data.v_pointer = list->data.v_pointer;
|
|
|
|
if (new_list->data.v_pointer)
|
2002-10-07 19:10:39 +00:00
|
|
|
g_object_ref (new_list->data.v_pointer);
|
2001-03-13 02:00:37 +00:00
|
|
|
break;
|
|
|
|
case G_TYPE_BOXED:
|
2001-03-10 01:34:48 +00:00
|
|
|
if (list->data.v_pointer)
|
|
|
|
new_list->data.v_pointer = g_boxed_copy (type, list->data.v_pointer);
|
adapt to handle PangoColor
2001-01-26 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor
* gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to
not offset by TREE_VIEW_HEADER_HEIGHT
(gtk_tree_view_tree_to_widget_coords): fix to not offset by
TREE_VIEW_HEADER_HEIGHT
* configure.in (included_loaders): for me, --with-included-loaders
generates the error "the specified loader yes does not exist",
i.e. the arg defaults to "yes", so change test for value ""
to test for value "yes", and include all loaders in that case.
* gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function
* gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly
handle TREE_VIEW_VERTICAL_SEPARATOR
(gtk_tree_view_bin_expose): fix to consider the row offset as
pointing halfway into vertical separator.
(gtk_tree_view_draw_node_focus_rect): ditto
* gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add
--gtk-debug=updates, which causes gdk_window_set_debug_updates
(TRUE) to be called.
* gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a
debug mode where the invalid region is colored in on invalidate,
so you can see the flicker and know whether your redraw code is
doing a good job.
* gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in
tree window coordinates (clip rect is in tree window coords)
* gtk/Makefile.am: add gtktreednd.[hc]
* gtk/gtkliststore.c: implement gtktreednd interfaces.
* gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support
drag-and-drop data operations on a model (so we can set up tree
drag-and-drop automatically)
* gtk/testgtk.c: Add a window to change sensitivity in the
GtkLabel test; add a way to change the entry frame in GtkEntry
test
* gtk/gtkentry.c (gtk_entry_set_has_frame):
(gtk_entry_get_has_frame): new functions to remove the frame
around an entry
(gtk_entry_size_request): shrink requisition if no frame
(gtk_entry_draw_focus): don't draw frame if no frame
* gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for
checks inside a cell renderer
(gtk_default_draw_option): ditto for options
* gtk/gtktreeviewcolumn.c (update_button_contents): add/remove
children from the alignment, not the button
(gtk_tree_view_column_init): ref/sink the column, to emulate
GObject refcounting.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render):
Use theme functions to draw the toggles
* gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors
* gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and
GdkPangoAttrEmbossed to use in rendering insensitive text
* gdk/gdkpango.c (gdk_draw_layout_line): render new properties
* gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity
using new GDK features
2001-01-26 21:12:05 +00:00
|
|
|
else
|
2001-03-10 01:34:48 +00:00
|
|
|
new_list->data.v_pointer = NULL;
|
2001-03-13 02:00:37 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_warning ("Unsupported node type (%s) copied.", g_type_name (type));
|
|
|
|
break;
|
adapt to handle PangoColor
2001-01-26 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor
* gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to
not offset by TREE_VIEW_HEADER_HEIGHT
(gtk_tree_view_tree_to_widget_coords): fix to not offset by
TREE_VIEW_HEADER_HEIGHT
* configure.in (included_loaders): for me, --with-included-loaders
generates the error "the specified loader yes does not exist",
i.e. the arg defaults to "yes", so change test for value ""
to test for value "yes", and include all loaders in that case.
* gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function
* gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly
handle TREE_VIEW_VERTICAL_SEPARATOR
(gtk_tree_view_bin_expose): fix to consider the row offset as
pointing halfway into vertical separator.
(gtk_tree_view_draw_node_focus_rect): ditto
* gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add
--gtk-debug=updates, which causes gdk_window_set_debug_updates
(TRUE) to be called.
* gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a
debug mode where the invalid region is colored in on invalidate,
so you can see the flicker and know whether your redraw code is
doing a good job.
* gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in
tree window coordinates (clip rect is in tree window coords)
* gtk/Makefile.am: add gtktreednd.[hc]
* gtk/gtkliststore.c: implement gtktreednd interfaces.
* gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support
drag-and-drop data operations on a model (so we can set up tree
drag-and-drop automatically)
* gtk/testgtk.c: Add a window to change sensitivity in the
GtkLabel test; add a way to change the entry frame in GtkEntry
test
* gtk/gtkentry.c (gtk_entry_set_has_frame):
(gtk_entry_get_has_frame): new functions to remove the frame
around an entry
(gtk_entry_size_request): shrink requisition if no frame
(gtk_entry_draw_focus): don't draw frame if no frame
* gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for
checks inside a cell renderer
(gtk_default_draw_option): ditto for options
* gtk/gtktreeviewcolumn.c (update_button_contents): add/remove
children from the alignment, not the button
(gtk_tree_view_column_init): ref/sink the column, to emulate
GObject refcounting.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render):
Use theme functions to draw the toggles
* gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors
* gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and
GdkPangoAttrEmbossed to use in rendering insensitive text
* gdk/gdkpango.c (gdk_draw_layout_line): render new properties
* gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity
using new GDK features
2001-01-26 21:12:05 +00:00
|
|
|
}
|
2001-03-10 01:34:48 +00:00
|
|
|
|
adapt to handle PangoColor
2001-01-26 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor
* gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to
not offset by TREE_VIEW_HEADER_HEIGHT
(gtk_tree_view_tree_to_widget_coords): fix to not offset by
TREE_VIEW_HEADER_HEIGHT
* configure.in (included_loaders): for me, --with-included-loaders
generates the error "the specified loader yes does not exist",
i.e. the arg defaults to "yes", so change test for value ""
to test for value "yes", and include all loaders in that case.
* gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function
* gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly
handle TREE_VIEW_VERTICAL_SEPARATOR
(gtk_tree_view_bin_expose): fix to consider the row offset as
pointing halfway into vertical separator.
(gtk_tree_view_draw_node_focus_rect): ditto
* gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add
--gtk-debug=updates, which causes gdk_window_set_debug_updates
(TRUE) to be called.
* gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a
debug mode where the invalid region is colored in on invalidate,
so you can see the flicker and know whether your redraw code is
doing a good job.
* gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in
tree window coordinates (clip rect is in tree window coords)
* gtk/Makefile.am: add gtktreednd.[hc]
* gtk/gtkliststore.c: implement gtktreednd interfaces.
* gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support
drag-and-drop data operations on a model (so we can set up tree
drag-and-drop automatically)
* gtk/testgtk.c: Add a window to change sensitivity in the
GtkLabel test; add a way to change the entry frame in GtkEntry
test
* gtk/gtkentry.c (gtk_entry_set_has_frame):
(gtk_entry_get_has_frame): new functions to remove the frame
around an entry
(gtk_entry_size_request): shrink requisition if no frame
(gtk_entry_draw_focus): don't draw frame if no frame
* gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for
checks inside a cell renderer
(gtk_default_draw_option): ditto for options
* gtk/gtktreeviewcolumn.c (update_button_contents): add/remove
children from the alignment, not the button
(gtk_tree_view_column_init): ref/sink the column, to emulate
GObject refcounting.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render):
Use theme functions to draw the toggles
* gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors
* gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and
GdkPangoAttrEmbossed to use in rendering insensitive text
* gdk/gdkpango.c (gdk_draw_layout_line): render new properties
* gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity
using new GDK features
2001-01-26 21:12:05 +00:00
|
|
|
return new_list;
|
|
|
|
}
|
2001-01-31 00:57:49 +00:00
|
|
|
|
2001-04-01 05:52:23 +00:00
|
|
|
gint
|
2001-03-23 00:35:19 +00:00
|
|
|
gtk_tree_data_list_compare_func (GtkTreeModel *model,
|
|
|
|
GtkTreeIter *a,
|
|
|
|
GtkTreeIter *b,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
gint column = GPOINTER_TO_INT (user_data);
|
|
|
|
GType type = gtk_tree_model_get_column_type (model, column);
|
|
|
|
GValue a_value = {0, };
|
|
|
|
GValue b_value = {0, };
|
|
|
|
gint retval;
|
2001-10-23 16:02:23 +00:00
|
|
|
const gchar *stra, *strb;
|
2001-03-28 01:54:14 +00:00
|
|
|
|
2001-03-23 00:35:19 +00:00
|
|
|
gtk_tree_model_get_value (model, a, column, &a_value);
|
|
|
|
gtk_tree_model_get_value (model, b, column, &b_value);
|
|
|
|
|
|
|
|
switch (G_TYPE_FUNDAMENTAL (type))
|
|
|
|
{
|
|
|
|
case G_TYPE_BOOLEAN:
|
2003-11-20 20:14:22 +00:00
|
|
|
if (g_value_get_boolean (&a_value) < g_value_get_boolean (&b_value))
|
2002-01-08 23:48:30 +00:00
|
|
|
retval = -1;
|
2003-11-20 20:14:22 +00:00
|
|
|
else if (g_value_get_boolean (&a_value) == g_value_get_boolean (&b_value))
|
2002-01-08 23:48:30 +00:00
|
|
|
retval = 0;
|
|
|
|
else
|
|
|
|
retval = 1;
|
2001-03-23 00:35:19 +00:00
|
|
|
break;
|
|
|
|
case G_TYPE_CHAR:
|
2002-01-08 23:48:30 +00:00
|
|
|
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;
|
2001-03-23 00:35:19 +00:00
|
|
|
break;
|
|
|
|
case G_TYPE_UCHAR:
|
2002-01-08 23:48:30 +00:00
|
|
|
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;
|
2001-03-23 00:35:19 +00:00
|
|
|
break;
|
|
|
|
case G_TYPE_INT:
|
2002-01-08 23:48:30 +00:00
|
|
|
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;
|
2001-03-23 00:35:19 +00:00
|
|
|
break;
|
|
|
|
case G_TYPE_UINT:
|
2002-01-08 23:48:30 +00:00
|
|
|
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;
|
2001-03-23 00:35:19 +00:00
|
|
|
break;
|
[ 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.
2002-05-27 22:42:08 +00:00
|
|
|
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;
|
2001-03-23 00:35:19 +00:00
|
|
|
case G_TYPE_ENUM:
|
|
|
|
/* this is somewhat bogus. */
|
[ 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.
2002-05-27 22:42:08 +00:00
|
|
|
if (g_value_get_enum (&a_value) < g_value_get_enum (&b_value))
|
2002-01-08 23:48:30 +00:00
|
|
|
retval = -1;
|
[ 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.
2002-05-27 22:42:08 +00:00
|
|
|
else if (g_value_get_enum (&a_value) == g_value_get_enum (&b_value))
|
2002-01-08 23:48:30 +00:00
|
|
|
retval = 0;
|
|
|
|
else
|
|
|
|
retval = 1;
|
2001-03-23 00:35:19 +00:00
|
|
|
break;
|
|
|
|
case G_TYPE_FLAGS:
|
2002-01-08 23:48:30 +00:00
|
|
|
/* this is even more bogus. */
|
[ 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.
2002-05-27 22:42:08 +00:00
|
|
|
if (g_value_get_flags (&a_value) < g_value_get_flags (&b_value))
|
2002-01-08 23:48:30 +00:00
|
|
|
retval = -1;
|
[ 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.
2002-05-27 22:42:08 +00:00
|
|
|
else if (g_value_get_flags (&a_value) == g_value_get_flags (&b_value))
|
2002-01-08 23:48:30 +00:00
|
|
|
retval = 0;
|
|
|
|
else
|
|
|
|
retval = 1;
|
2001-03-23 00:35:19 +00:00
|
|
|
break;
|
|
|
|
case G_TYPE_FLOAT:
|
2002-01-08 23:48:30 +00:00
|
|
|
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;
|
2001-03-23 00:35:19 +00:00
|
|
|
break;
|
|
|
|
case G_TYPE_DOUBLE:
|
2002-01-08 23:48:30 +00:00
|
|
|
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;
|
2001-03-23 00:35:19 +00:00
|
|
|
break;
|
|
|
|
case G_TYPE_STRING:
|
2001-03-28 01:54:14 +00:00
|
|
|
stra = g_value_get_string (&a_value);
|
|
|
|
strb = g_value_get_string (&b_value);
|
2001-10-01 18:12:34 +00:00
|
|
|
if (stra == NULL) stra = "";
|
|
|
|
if (strb == NULL) strb = "";
|
|
|
|
retval = g_utf8_collate (stra, strb);
|
2001-03-23 00:35:19 +00:00
|
|
|
break;
|
|
|
|
case G_TYPE_POINTER:
|
|
|
|
case G_TYPE_BOXED:
|
|
|
|
case G_TYPE_OBJECT:
|
|
|
|
default:
|
|
|
|
g_warning ("Attempting to sort on invalid type %s\n", g_type_name (type));
|
|
|
|
retval = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_value_unset (&a_value);
|
|
|
|
g_value_unset (&b_value);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GList *
|
|
|
|
_gtk_tree_data_list_header_new (gint n_columns,
|
|
|
|
GType *types)
|
|
|
|
{
|
|
|
|
GList *retval = NULL;
|
|
|
|
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < n_columns; i ++)
|
|
|
|
{
|
|
|
|
GtkTreeDataSortHeader *header;
|
|
|
|
|
|
|
|
header = g_new (GtkTreeDataSortHeader, 1);
|
|
|
|
|
|
|
|
retval = g_list_prepend (retval, header);
|
|
|
|
header->sort_column_id = i;
|
|
|
|
header->func = gtk_tree_data_list_compare_func;
|
|
|
|
header->destroy = NULL;
|
|
|
|
header->data = GINT_TO_POINTER (i);
|
|
|
|
}
|
|
|
|
return g_list_reverse (retval);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gtk_tree_data_list_header_free (GList *list)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
for (tmp = list; tmp; tmp = tmp->next)
|
|
|
|
{
|
|
|
|
GtkTreeDataSortHeader *header = (GtkTreeDataSortHeader *) tmp->data;
|
|
|
|
|
|
|
|
if (header->destroy)
|
2002-03-03 05:41:28 +00:00
|
|
|
{
|
|
|
|
GtkDestroyNotify d = header->destroy;
|
|
|
|
|
|
|
|
header->destroy = NULL;
|
|
|
|
d (header->data);
|
|
|
|
}
|
2001-03-23 00:35:19 +00:00
|
|
|
|
|
|
|
g_free (header);
|
|
|
|
}
|
|
|
|
g_list_free (list);
|
|
|
|
}
|
2001-03-28 01:54:14 +00:00
|
|
|
|
|
|
|
GtkTreeDataSortHeader *
|
|
|
|
_gtk_tree_data_list_get_header (GList *header_list,
|
|
|
|
gint sort_column_id)
|
|
|
|
{
|
|
|
|
GtkTreeDataSortHeader *header = NULL;
|
|
|
|
|
|
|
|
for (; header_list; header_list = header_list->next)
|
|
|
|
{
|
|
|
|
header = (GtkTreeDataSortHeader*) header_list->data;
|
|
|
|
if (header->sort_column_id == sort_column_id)
|
|
|
|
return header;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|