mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
Fixes #110249, reworked patch from Joshua N Pritikin.
Thu Dec 18 19:13:12 2003 Kristian Rietveld <kris@gtk.org> Fixes #110249, reworked patch from Joshua N Pritikin. * gtk/gtktreemodelsort.c (gtk_tree_model_sort_get_type), (gtk_tree_model_sort_tree_drag_source_init), (gtk_tree_model_sort_row_draggable), (gtk_tree_model_sort_drag_data_get), (gtk_tree_model_sort_drag_data_delete): implement GtkTreeDragSource. * gtk/gtktreemodelfilter.c (gtk_tree_model_filter_get_type), (gtk_tree_model_filter_tree_drag_source_init), (gtk_tree_model_filter_row_draggable), (gtk_tree_model_filter_drag_data_get), (gtk_tree_model_filter_drag_data_delete): ditto.
This commit is contained in:
parent
c5dd510d3f
commit
4d9e9afdc1
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
||||
Thu Dec 18 19:13:12 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Fixes #110249, reworked patch from Joshua N Pritikin.
|
||||
|
||||
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_get_type),
|
||||
(gtk_tree_model_sort_tree_drag_source_init),
|
||||
(gtk_tree_model_sort_row_draggable),
|
||||
(gtk_tree_model_sort_drag_data_get),
|
||||
(gtk_tree_model_sort_drag_data_delete): implement GtkTreeDragSource.
|
||||
|
||||
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_get_type),
|
||||
(gtk_tree_model_filter_tree_drag_source_init),
|
||||
(gtk_tree_model_filter_row_draggable),
|
||||
(gtk_tree_model_filter_drag_data_get),
|
||||
(gtk_tree_model_filter_drag_data_delete): ditto.
|
||||
|
||||
Thu Dec 18 18:01:01 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_class_init): add key bindings
|
||||
|
@ -1,3 +1,19 @@
|
||||
Thu Dec 18 19:13:12 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Fixes #110249, reworked patch from Joshua N Pritikin.
|
||||
|
||||
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_get_type),
|
||||
(gtk_tree_model_sort_tree_drag_source_init),
|
||||
(gtk_tree_model_sort_row_draggable),
|
||||
(gtk_tree_model_sort_drag_data_get),
|
||||
(gtk_tree_model_sort_drag_data_delete): implement GtkTreeDragSource.
|
||||
|
||||
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_get_type),
|
||||
(gtk_tree_model_filter_tree_drag_source_init),
|
||||
(gtk_tree_model_filter_row_draggable),
|
||||
(gtk_tree_model_filter_drag_data_get),
|
||||
(gtk_tree_model_filter_drag_data_delete): ditto.
|
||||
|
||||
Thu Dec 18 18:01:01 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_class_init): add key bindings
|
||||
|
@ -1,3 +1,19 @@
|
||||
Thu Dec 18 19:13:12 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Fixes #110249, reworked patch from Joshua N Pritikin.
|
||||
|
||||
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_get_type),
|
||||
(gtk_tree_model_sort_tree_drag_source_init),
|
||||
(gtk_tree_model_sort_row_draggable),
|
||||
(gtk_tree_model_sort_drag_data_get),
|
||||
(gtk_tree_model_sort_drag_data_delete): implement GtkTreeDragSource.
|
||||
|
||||
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_get_type),
|
||||
(gtk_tree_model_filter_tree_drag_source_init),
|
||||
(gtk_tree_model_filter_row_draggable),
|
||||
(gtk_tree_model_filter_drag_data_get),
|
||||
(gtk_tree_model_filter_drag_data_delete): ditto.
|
||||
|
||||
Thu Dec 18 18:01:01 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_class_init): add key bindings
|
||||
|
@ -1,3 +1,19 @@
|
||||
Thu Dec 18 19:13:12 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Fixes #110249, reworked patch from Joshua N Pritikin.
|
||||
|
||||
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_get_type),
|
||||
(gtk_tree_model_sort_tree_drag_source_init),
|
||||
(gtk_tree_model_sort_row_draggable),
|
||||
(gtk_tree_model_sort_drag_data_get),
|
||||
(gtk_tree_model_sort_drag_data_delete): implement GtkTreeDragSource.
|
||||
|
||||
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_get_type),
|
||||
(gtk_tree_model_filter_tree_drag_source_init),
|
||||
(gtk_tree_model_filter_row_draggable),
|
||||
(gtk_tree_model_filter_drag_data_get),
|
||||
(gtk_tree_model_filter_drag_data_delete): ditto.
|
||||
|
||||
Thu Dec 18 18:01:01 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_class_init): add key bindings
|
||||
|
@ -1,3 +1,19 @@
|
||||
Thu Dec 18 19:13:12 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Fixes #110249, reworked patch from Joshua N Pritikin.
|
||||
|
||||
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_get_type),
|
||||
(gtk_tree_model_sort_tree_drag_source_init),
|
||||
(gtk_tree_model_sort_row_draggable),
|
||||
(gtk_tree_model_sort_drag_data_get),
|
||||
(gtk_tree_model_sort_drag_data_delete): implement GtkTreeDragSource.
|
||||
|
||||
* gtk/gtktreemodelfilter.c (gtk_tree_model_filter_get_type),
|
||||
(gtk_tree_model_filter_tree_drag_source_init),
|
||||
(gtk_tree_model_filter_row_draggable),
|
||||
(gtk_tree_model_filter_drag_data_get),
|
||||
(gtk_tree_model_filter_drag_data_delete): ditto.
|
||||
|
||||
Thu Dec 18 18:01:01 2003 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_class_init): add key bindings
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "gtktreemodelfilter.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtktreednd.h"
|
||||
#include <string.h>
|
||||
|
||||
/* ITER FORMAT:
|
||||
@ -110,6 +111,7 @@ enum
|
||||
static void gtk_tree_model_filter_init (GtkTreeModelFilter *filter);
|
||||
static void gtk_tree_model_filter_class_init (GtkTreeModelFilterClass *filter_class);
|
||||
static void gtk_tree_model_filter_tree_model_init (GtkTreeModelIface *iface);
|
||||
static void gtk_tree_model_filter_drag_source_init (GtkTreeDragSourceIface *iface);
|
||||
static void gtk_tree_model_filter_finalize (GObject *object);
|
||||
static void gtk_tree_model_filter_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@ -177,6 +179,14 @@ static void gtk_tree_model_filter_ref_node (GtkTr
|
||||
static void gtk_tree_model_filter_unref_node (GtkTreeModel *model,
|
||||
GtkTreeIter *iter);
|
||||
|
||||
/* TreeDragSource interface */
|
||||
static gboolean gtk_tree_model_filter_row_draggable (GtkTreeDragSource *drag_source,
|
||||
GtkTreePath *path);
|
||||
static gboolean gtk_tree_model_filter_drag_data_get (GtkTreeDragSource *drag_source,
|
||||
GtkTreePath *path,
|
||||
GtkSelectionData *selection_data);
|
||||
static gboolean gtk_tree_model_filter_drag_data_delete (GtkTreeDragSource *drag_source,
|
||||
GtkTreePath *path);
|
||||
|
||||
/* private functions */
|
||||
static void gtk_tree_model_filter_build_level (GtkTreeModelFilter *filter,
|
||||
@ -259,6 +269,13 @@ gtk_tree_model_filter_get_type (void)
|
||||
NULL
|
||||
};
|
||||
|
||||
static const GInterfaceInfo drag_source_info =
|
||||
{
|
||||
(GInterfaceInitFunc) gtk_tree_model_filter_drag_source_init,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
tree_model_filter_type = g_type_register_static (G_TYPE_OBJECT,
|
||||
"GtkTreeModelFilter",
|
||||
&tree_model_filter_info, 0);
|
||||
@ -266,6 +283,10 @@ gtk_tree_model_filter_get_type (void)
|
||||
g_type_add_interface_static (tree_model_filter_type,
|
||||
GTK_TYPE_TREE_MODEL,
|
||||
&tree_model_info);
|
||||
|
||||
g_type_add_interface_static (tree_model_filter_type,
|
||||
GTK_TYPE_TREE_DRAG_SOURCE,
|
||||
&drag_source_info);
|
||||
}
|
||||
|
||||
return tree_model_filter_type;
|
||||
@ -336,6 +357,14 @@ gtk_tree_model_filter_tree_model_init (GtkTreeModelIface *iface)
|
||||
iface->unref_node = gtk_tree_model_filter_unref_node;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_filter_drag_source_init (GtkTreeDragSourceIface *iface)
|
||||
{
|
||||
iface->row_draggable = gtk_tree_model_filter_row_draggable;
|
||||
iface->drag_data_delete = gtk_tree_model_filter_drag_data_delete;
|
||||
iface->drag_data_get = gtk_tree_model_filter_drag_data_get;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_tree_model_filter_finalize (GObject *object)
|
||||
@ -2230,6 +2259,62 @@ gtk_tree_model_filter_real_unref_node (GtkTreeModel *model,
|
||||
}
|
||||
}
|
||||
|
||||
/* TreeDragSource interface implementation */
|
||||
static gboolean
|
||||
gtk_tree_model_filter_row_draggable (GtkTreeDragSource *drag_source,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
GtkTreeModelFilter *tree_model_filter = (GtkTreeModelFilter *)drag_source;
|
||||
GtkTreePath *child_path;
|
||||
gboolean draggable;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_FILTER (drag_source), FALSE);
|
||||
g_return_val_if_fail (path != NULL, FALSE);
|
||||
|
||||
child_path = gtk_tree_model_filter_convert_path_to_child_path (tree_model_filter, path);
|
||||
draggable = gtk_tree_drag_source_row_draggable (GTK_TREE_DRAG_SOURCE (tree_model_filter->priv->child_model), child_path);
|
||||
gtk_tree_path_free (child_path);
|
||||
|
||||
return draggable;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tree_model_filter_drag_data_get (GtkTreeDragSource *drag_source,
|
||||
GtkTreePath *path,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkTreeModelFilter *tree_model_filter = (GtkTreeModelFilter *)drag_source;
|
||||
GtkTreePath *child_path;
|
||||
gboolean gotten;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_FILTER (drag_source), FALSE);
|
||||
g_return_val_if_fail (path != NULL, FALSE);
|
||||
|
||||
child_path = gtk_tree_model_filter_convert_path_to_child_path (tree_model_filter, path);
|
||||
gotten = gtk_tree_drag_source_drag_data_get (GTK_TREE_DRAG_SOURCE (tree_model_filter->priv->child_model), child_path, selection_data);
|
||||
gtk_tree_path_free (child_path);
|
||||
|
||||
return gotten;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tree_model_filter_drag_data_delete (GtkTreeDragSource *drag_source,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
GtkTreeModelFilter *tree_model_filter = (GtkTreeModelFilter *)drag_source;
|
||||
GtkTreePath *child_path;
|
||||
gboolean deleted;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_FILTER (drag_source), FALSE);
|
||||
g_return_val_if_fail (path != NULL, FALSE);
|
||||
|
||||
child_path = gtk_tree_model_filter_convert_path_to_child_path (tree_model_filter, path);
|
||||
deleted = gtk_tree_drag_source_drag_data_delete (GTK_TREE_DRAG_SOURCE (tree_model_filter->priv->child_model), child_path);
|
||||
gtk_tree_path_free (child_path);
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/* bits and pieces */
|
||||
static void
|
||||
gtk_tree_model_filter_set_model (GtkTreeModelFilter *filter,
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "gtktreestore.h"
|
||||
#include "gtktreedatalist.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtktreednd.h"
|
||||
|
||||
typedef struct _SortElt SortElt;
|
||||
typedef struct _SortLevel SortLevel;
|
||||
@ -108,6 +109,7 @@ static void gtk_tree_model_sort_init (GtkTreeModelSort *tr
|
||||
static void gtk_tree_model_sort_class_init (GtkTreeModelSortClass *tree_model_sort_class);
|
||||
static void gtk_tree_model_sort_tree_model_init (GtkTreeModelIface *iface);
|
||||
static void gtk_tree_model_sort_tree_sortable_init (GtkTreeSortableIface *iface);
|
||||
static void gtk_tree_model_sort_drag_source_init (GtkTreeDragSourceIface*iface);
|
||||
static void gtk_tree_model_sort_finalize (GObject *object);
|
||||
static void gtk_tree_model_sort_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@ -178,6 +180,15 @@ static void gtk_tree_model_sort_real_unref_node (GtkTreeModel
|
||||
static void gtk_tree_model_sort_unref_node (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter);
|
||||
|
||||
/* TreeDragSource interface */
|
||||
static gboolean gtk_tree_model_sort_row_draggable (GtkTreeDragSource *drag_source,
|
||||
GtkTreePath *path);
|
||||
static gboolean gtk_tree_model_sort_drag_data_get (GtkTreeDragSource *drag_source,
|
||||
GtkTreePath *path,
|
||||
GtkSelectionData *selection_data);
|
||||
static gboolean gtk_tree_model_sort_drag_data_delete (GtkTreeDragSource *drag_source,
|
||||
GtkTreePath *path);
|
||||
|
||||
/* TreeSortable interface */
|
||||
static gboolean gtk_tree_model_sort_get_sort_column_id (GtkTreeSortable *sortable,
|
||||
gint *sort_column_id,
|
||||
@ -260,6 +271,13 @@ gtk_tree_model_sort_get_type (void)
|
||||
NULL
|
||||
};
|
||||
|
||||
static const GInterfaceInfo drag_source_info =
|
||||
{
|
||||
(GInterfaceInitFunc) gtk_tree_model_sort_drag_source_init,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
tree_model_sort_type =
|
||||
g_type_register_static (G_TYPE_OBJECT, "GtkTreeModelSort",
|
||||
&tree_model_sort_info, 0);
|
||||
@ -271,6 +289,10 @@ gtk_tree_model_sort_get_type (void)
|
||||
g_type_add_interface_static (tree_model_sort_type,
|
||||
GTK_TYPE_TREE_SORTABLE,
|
||||
&sortable_info);
|
||||
|
||||
g_type_add_interface_static (tree_model_sort_type,
|
||||
GTK_TYPE_TREE_DRAG_SOURCE,
|
||||
&drag_source_info);
|
||||
}
|
||||
|
||||
return tree_model_sort_type;
|
||||
@ -338,6 +360,14 @@ gtk_tree_model_sort_tree_sortable_init (GtkTreeSortableIface *iface)
|
||||
iface->has_default_sort_func = gtk_tree_model_sort_has_default_sort_func;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_sort_drag_source_init (GtkTreeDragSourceIface *iface)
|
||||
{
|
||||
iface->row_draggable = gtk_tree_model_sort_row_draggable;
|
||||
iface->drag_data_delete = gtk_tree_model_sort_drag_data_delete;
|
||||
iface->drag_data_get = gtk_tree_model_sort_drag_data_get;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tree_model_sort_new_with_model:
|
||||
* @child_model: A #GtkTreeModel
|
||||
@ -1427,6 +1457,65 @@ gtk_tree_model_sort_has_default_sort_func (GtkTreeSortable *sortable)
|
||||
return (tree_model_sort->default_sort_func != NULL);
|
||||
}
|
||||
|
||||
/* DragSource interface */
|
||||
static gboolean
|
||||
gtk_tree_model_sort_row_draggable (GtkTreeDragSource *drag_source,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *)drag_source;
|
||||
GtkTreePath *child_path;
|
||||
gboolean draggable;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT (drag_source), FALSE);
|
||||
g_return_val_if_fail (path != NULL, FALSE);
|
||||
|
||||
child_path = gtk_tree_model_sort_convert_path_to_child_path (tree_model_sort,
|
||||
path);
|
||||
draggable = gtk_tree_drag_source_row_draggable (GTK_TREE_DRAG_SOURCE (tree_model_sort->child_model), child_path);
|
||||
gtk_tree_path_free (child_path);
|
||||
|
||||
return draggable;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tree_model_sort_drag_data_get (GtkTreeDragSource *drag_source,
|
||||
GtkTreePath *path,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *)drag_source;
|
||||
GtkTreePath *child_path;
|
||||
gboolean gotten;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT (drag_source), FALSE);
|
||||
g_return_val_if_fail (path != NULL, FALSE);
|
||||
|
||||
child_path = gtk_tree_model_sort_convert_path_to_child_path (tree_model_sort,
|
||||
path);
|
||||
gotten = gtk_tree_drag_source_drag_data_get (GTK_TREE_DRAG_SOURCE (tree_model_sort->child_model), child_path, selection_data);
|
||||
gtk_tree_path_free (child_path);
|
||||
|
||||
return gotten;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tree_model_sort_drag_data_delete (GtkTreeDragSource *drag_source,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
GtkTreeModelSort *tree_model_sort = (GtkTreeModelSort *)drag_source;
|
||||
GtkTreePath *child_path;
|
||||
gboolean deleted;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT (drag_source), FALSE);
|
||||
g_return_val_if_fail (path != NULL, FALSE);
|
||||
|
||||
child_path = gtk_tree_model_sort_convert_path_to_child_path (tree_model_sort,
|
||||
path);
|
||||
deleted = gtk_tree_drag_source_drag_data_delete (GTK_TREE_DRAG_SOURCE (tree_model_sort->child_model), child_path);
|
||||
gtk_tree_path_free (child_path);
|
||||
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/* sorting code - private */
|
||||
static gint
|
||||
gtk_tree_model_sort_compare_func (gconstpointer a,
|
||||
|
Loading…
Reference in New Issue
Block a user