|
Packit Service |
fb6fa5 |
/* gtktreednd.c
|
|
Packit Service |
fb6fa5 |
* Copyright (C) 2001 Red Hat, Inc.
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
fb6fa5 |
* modify it under the terms of the GNU Library General Public
|
|
Packit Service |
fb6fa5 |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
fb6fa5 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
fb6fa5 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
fb6fa5 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
fb6fa5 |
* Library General Public License for more details.
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* You should have received a copy of the GNU Library General Public
|
|
Packit Service |
fb6fa5 |
* License along with this library; if not, write to the
|
|
Packit Service |
fb6fa5 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Packit Service |
fb6fa5 |
* Boston, MA 02111-1307, USA.
|
|
Packit Service |
fb6fa5 |
*/
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
#include "config.h"
|
|
Packit Service |
fb6fa5 |
#include <string.h>
|
|
Packit Service |
fb6fa5 |
#include "gtktreednd.h"
|
|
Packit Service |
fb6fa5 |
#include "gtkintl.h"
|
|
Packit Service |
fb6fa5 |
#include "gtkalias.h"
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
GType
|
|
Packit Service |
fb6fa5 |
gtk_tree_drag_source_get_type (void)
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
static GType our_type = 0;
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
if (!our_type)
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
const GTypeInfo our_info =
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
sizeof (GtkTreeDragSourceIface), /* class_size */
|
|
Packit Service |
fb6fa5 |
NULL, /* base_init */
|
|
Packit Service |
fb6fa5 |
NULL, /* base_finalize */
|
|
Packit Service |
fb6fa5 |
NULL,
|
|
Packit Service |
fb6fa5 |
NULL, /* class_finalize */
|
|
Packit Service |
fb6fa5 |
NULL, /* class_data */
|
|
Packit Service |
fb6fa5 |
0,
|
|
Packit Service |
fb6fa5 |
0, /* n_preallocs */
|
|
Packit Service |
fb6fa5 |
NULL
|
|
Packit Service |
fb6fa5 |
};
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
our_type = g_type_register_static (G_TYPE_INTERFACE,
|
|
Packit Service |
fb6fa5 |
I_("GtkTreeDragSource"),
|
|
Packit Service |
fb6fa5 |
&our_info, 0);
|
|
Packit Service |
fb6fa5 |
}
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
return our_type;
|
|
Packit Service |
fb6fa5 |
}
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
GType
|
|
Packit Service |
fb6fa5 |
gtk_tree_drag_dest_get_type (void)
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
static GType our_type = 0;
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
if (!our_type)
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
const GTypeInfo our_info =
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
sizeof (GtkTreeDragDestIface), /* class_size */
|
|
Packit Service |
fb6fa5 |
NULL, /* base_init */
|
|
Packit Service |
fb6fa5 |
NULL, /* base_finalize */
|
|
Packit Service |
fb6fa5 |
NULL,
|
|
Packit Service |
fb6fa5 |
NULL, /* class_finalize */
|
|
Packit Service |
fb6fa5 |
NULL, /* class_data */
|
|
Packit Service |
fb6fa5 |
0,
|
|
Packit Service |
fb6fa5 |
0, /* n_preallocs */
|
|
Packit Service |
fb6fa5 |
NULL
|
|
Packit Service |
fb6fa5 |
};
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
our_type = g_type_register_static (G_TYPE_INTERFACE, I_("GtkTreeDragDest"), &our_info, 0);
|
|
Packit Service |
fb6fa5 |
}
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
return our_type;
|
|
Packit Service |
fb6fa5 |
}
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
/**
|
|
Packit Service |
fb6fa5 |
* gtk_tree_drag_source_row_draggable:
|
|
Packit Service |
fb6fa5 |
* @drag_source: a #GtkTreeDragSource
|
|
Packit Service |
fb6fa5 |
* @path: row on which user is initiating a drag
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* Asks the #GtkTreeDragSource whether a particular row can be used as
|
|
Packit Service |
fb6fa5 |
* the source of a DND operation. If the source doesn't implement
|
|
Packit Service |
fb6fa5 |
* this interface, the row is assumed draggable.
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* Return value: %TRUE if the row can be dragged
|
|
Packit Service |
fb6fa5 |
**/
|
|
Packit Service |
fb6fa5 |
gboolean
|
|
Packit Service |
fb6fa5 |
gtk_tree_drag_source_row_draggable (GtkTreeDragSource *drag_source,
|
|
Packit Service |
fb6fa5 |
GtkTreePath *path)
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
GtkTreeDragSourceIface *iface = GTK_TREE_DRAG_SOURCE_GET_IFACE (drag_source);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (path != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
if (iface->row_draggable)
|
|
Packit Service |
fb6fa5 |
return (* iface->row_draggable) (drag_source, path);
|
|
Packit Service |
fb6fa5 |
else
|
|
Packit Service |
fb6fa5 |
return TRUE;
|
|
Packit Service |
fb6fa5 |
/* Returning TRUE if row_draggable is not implemented is a fallback.
|
|
Packit Service |
fb6fa5 |
Interface implementations such as GtkTreeStore and GtkListStore really should
|
|
Packit Service |
fb6fa5 |
implement row_draggable. */
|
|
Packit Service |
fb6fa5 |
}
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
/**
|
|
Packit Service |
fb6fa5 |
* gtk_tree_drag_source_drag_data_delete:
|
|
Packit Service |
fb6fa5 |
* @drag_source: a #GtkTreeDragSource
|
|
Packit Service |
fb6fa5 |
* @path: row that was being dragged
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* Asks the #GtkTreeDragSource to delete the row at @path, because
|
|
Packit Service |
fb6fa5 |
* it was moved somewhere else via drag-and-drop. Returns %FALSE
|
|
Packit Service |
fb6fa5 |
* if the deletion fails because @path no longer exists, or for
|
|
Packit Service |
fb6fa5 |
* some model-specific reason. Should robustly handle a @path no
|
|
Packit Service |
fb6fa5 |
* longer found in the model!
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* Return value: %TRUE if the row was successfully deleted
|
|
Packit Service |
fb6fa5 |
**/
|
|
Packit Service |
fb6fa5 |
gboolean
|
|
Packit Service |
fb6fa5 |
gtk_tree_drag_source_drag_data_delete (GtkTreeDragSource *drag_source,
|
|
Packit Service |
fb6fa5 |
GtkTreePath *path)
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
GtkTreeDragSourceIface *iface = GTK_TREE_DRAG_SOURCE_GET_IFACE (drag_source);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (iface->drag_data_delete != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (path != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
return (* iface->drag_data_delete) (drag_source, path);
|
|
Packit Service |
fb6fa5 |
}
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
/**
|
|
Packit Service |
fb6fa5 |
* gtk_tree_drag_source_drag_data_get:
|
|
Packit Service |
fb6fa5 |
* @drag_source: a #GtkTreeDragSource
|
|
Packit Service |
fb6fa5 |
* @path: row that was dragged
|
|
Packit Service |
fb6fa5 |
* @selection_data: (out): a #GtkSelectionData to fill with data
|
|
Packit Service |
fb6fa5 |
* from the dragged row
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* Asks the #GtkTreeDragSource to fill in @selection_data with a
|
|
Packit Service |
fb6fa5 |
* representation of the row at @path. @selection_data->target gives
|
|
Packit Service |
fb6fa5 |
* the required type of the data. Should robustly handle a @path no
|
|
Packit Service |
fb6fa5 |
* longer found in the model!
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* Return value: %TRUE if data of the required type was provided
|
|
Packit Service |
fb6fa5 |
**/
|
|
Packit Service |
fb6fa5 |
gboolean
|
|
Packit Service |
fb6fa5 |
gtk_tree_drag_source_drag_data_get (GtkTreeDragSource *drag_source,
|
|
Packit Service |
fb6fa5 |
GtkTreePath *path,
|
|
Packit Service |
fb6fa5 |
GtkSelectionData *selection_data)
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
GtkTreeDragSourceIface *iface = GTK_TREE_DRAG_SOURCE_GET_IFACE (drag_source);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (iface->drag_data_get != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (path != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (selection_data != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
return (* iface->drag_data_get) (drag_source, path, selection_data);
|
|
Packit Service |
fb6fa5 |
}
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
/**
|
|
Packit Service |
fb6fa5 |
* gtk_tree_drag_dest_drag_data_received:
|
|
Packit Service |
fb6fa5 |
* @drag_dest: a #GtkTreeDragDest
|
|
Packit Service |
fb6fa5 |
* @dest: row to drop in front of
|
|
Packit Service |
fb6fa5 |
* @selection_data: data to drop
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* Asks the #GtkTreeDragDest to insert a row before the path @dest,
|
|
Packit Service |
fb6fa5 |
* deriving the contents of the row from @selection_data. If @dest is
|
|
Packit Service |
fb6fa5 |
* outside the tree so that inserting before it is impossible, %FALSE
|
|
Packit Service |
fb6fa5 |
* will be returned. Also, %FALSE may be returned if the new row is
|
|
Packit Service |
fb6fa5 |
* not created for some model-specific reason. Should robustly handle
|
|
Packit Service |
fb6fa5 |
* a @dest no longer found in the model!
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* Return value: whether a new row was created before position @dest
|
|
Packit Service |
fb6fa5 |
**/
|
|
Packit Service |
fb6fa5 |
gboolean
|
|
Packit Service |
fb6fa5 |
gtk_tree_drag_dest_drag_data_received (GtkTreeDragDest *drag_dest,
|
|
Packit Service |
fb6fa5 |
GtkTreePath *dest,
|
|
Packit Service |
fb6fa5 |
GtkSelectionData *selection_data)
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
GtkTreeDragDestIface *iface = GTK_TREE_DRAG_DEST_GET_IFACE (drag_dest);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (iface->drag_data_received != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (dest != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (selection_data != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
return (* iface->drag_data_received) (drag_dest, dest, selection_data);
|
|
Packit Service |
fb6fa5 |
}
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
/**
|
|
Packit Service |
fb6fa5 |
* gtk_tree_drag_dest_row_drop_possible:
|
|
Packit Service |
fb6fa5 |
* @drag_dest: a #GtkTreeDragDest
|
|
Packit Service |
fb6fa5 |
* @dest_path: destination row
|
|
Packit Service |
fb6fa5 |
* @selection_data: the data being dragged
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* Determines whether a drop is possible before the given @dest_path,
|
|
Packit Service |
fb6fa5 |
* at the same depth as @dest_path. i.e., can we drop the data in
|
|
Packit Service |
fb6fa5 |
* @selection_data at that location. @dest_path does not have to
|
|
Packit Service |
fb6fa5 |
* exist; the return value will almost certainly be %FALSE if the
|
|
Packit Service |
fb6fa5 |
* parent of @dest_path doesn't exist, though.
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* Return value: %TRUE if a drop is possible before @dest_path
|
|
Packit Service |
fb6fa5 |
**/
|
|
Packit Service |
fb6fa5 |
gboolean
|
|
Packit Service |
fb6fa5 |
gtk_tree_drag_dest_row_drop_possible (GtkTreeDragDest *drag_dest,
|
|
Packit Service |
fb6fa5 |
GtkTreePath *dest_path,
|
|
Packit Service |
fb6fa5 |
GtkSelectionData *selection_data)
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
GtkTreeDragDestIface *iface = GTK_TREE_DRAG_DEST_GET_IFACE (drag_dest);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (iface->row_drop_possible != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (selection_data != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (dest_path != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
return (* iface->row_drop_possible) (drag_dest, dest_path, selection_data);
|
|
Packit Service |
fb6fa5 |
}
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
typedef struct _TreeRowData TreeRowData;
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
struct _TreeRowData
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
GtkTreeModel *model;
|
|
Packit Service |
fb6fa5 |
gchar path[4];
|
|
Packit Service |
fb6fa5 |
};
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
/**
|
|
Packit Service |
fb6fa5 |
* gtk_tree_set_row_drag_data:
|
|
Packit Service |
fb6fa5 |
* @selection_data: some #GtkSelectionData
|
|
Packit Service |
fb6fa5 |
* @tree_model: a #GtkTreeModel
|
|
Packit Service |
fb6fa5 |
* @path: a row in @tree_model
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* Sets selection data of target type %GTK_TREE_MODEL_ROW. Normally used
|
|
Packit Service |
fb6fa5 |
* in a drag_data_get handler.
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* Return value: %TRUE if the #GtkSelectionData had the proper target type to allow us to set a tree row
|
|
Packit Service |
fb6fa5 |
**/
|
|
Packit Service |
fb6fa5 |
gboolean
|
|
Packit Service |
fb6fa5 |
gtk_tree_set_row_drag_data (GtkSelectionData *selection_data,
|
|
Packit Service |
fb6fa5 |
GtkTreeModel *tree_model,
|
|
Packit Service |
fb6fa5 |
GtkTreePath *path)
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
TreeRowData *trd;
|
|
Packit Service |
fb6fa5 |
gchar *path_str;
|
|
Packit Service |
fb6fa5 |
gint len;
|
|
Packit Service |
fb6fa5 |
gint struct_size;
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (selection_data != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (path != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
if (selection_data->target != gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
|
|
Packit Service |
fb6fa5 |
return FALSE;
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
path_str = gtk_tree_path_to_string (path);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
len = strlen (path_str);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
/* the old allocate-end-of-struct-to-hold-string trick */
|
|
Packit Service |
fb6fa5 |
struct_size = sizeof (TreeRowData) + len + 1 -
|
|
Packit Service |
fb6fa5 |
(sizeof (TreeRowData) - G_STRUCT_OFFSET (TreeRowData, path));
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
trd = g_malloc (struct_size);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
strcpy (trd->path, path_str);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
g_free (path_str);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
trd->model = tree_model;
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
gtk_selection_data_set (selection_data,
|
|
Packit Service |
fb6fa5 |
gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"),
|
|
Packit Service |
fb6fa5 |
8, /* bytes */
|
|
Packit Service |
fb6fa5 |
(void*)trd,
|
|
Packit Service |
fb6fa5 |
struct_size);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
g_free (trd);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
return TRUE;
|
|
Packit Service |
fb6fa5 |
}
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
/**
|
|
Packit Service |
fb6fa5 |
* gtk_tree_get_row_drag_data:
|
|
Packit Service |
fb6fa5 |
* @selection_data: a #GtkSelectionData
|
|
Packit Service |
fb6fa5 |
* @tree_model: (out): a #GtkTreeModel
|
|
Packit Service |
fb6fa5 |
* @path: (out): row in @tree_model
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* Obtains a @tree_model and @path from selection data of target type
|
|
Packit Service |
fb6fa5 |
* %GTK_TREE_MODEL_ROW. Normally called from a drag_data_received handler.
|
|
Packit Service |
fb6fa5 |
* This function can only be used if @selection_data originates from the same
|
|
Packit Service |
fb6fa5 |
* process that's calling this function, because a pointer to the tree model
|
|
Packit Service |
fb6fa5 |
* is being passed around. If you aren't in the same process, then you'll
|
|
Packit Service |
fb6fa5 |
* get memory corruption. In the #GtkTreeDragDest drag_data_received handler,
|
|
Packit Service |
fb6fa5 |
* you can assume that selection data of type %GTK_TREE_MODEL_ROW is
|
|
Packit Service |
fb6fa5 |
* in from the current process. The returned path must be freed with
|
|
Packit Service |
fb6fa5 |
* gtk_tree_path_free().
|
|
Packit Service |
fb6fa5 |
*
|
|
Packit Service |
fb6fa5 |
* Return value: %TRUE if @selection_data had target type %GTK_TREE_MODEL_ROW and
|
|
Packit Service |
fb6fa5 |
* is otherwise valid
|
|
Packit Service |
fb6fa5 |
**/
|
|
Packit Service |
fb6fa5 |
gboolean
|
|
Packit Service |
fb6fa5 |
gtk_tree_get_row_drag_data (GtkSelectionData *selection_data,
|
|
Packit Service |
fb6fa5 |
GtkTreeModel **tree_model,
|
|
Packit Service |
fb6fa5 |
GtkTreePath **path)
|
|
Packit Service |
fb6fa5 |
{
|
|
Packit Service |
fb6fa5 |
TreeRowData *trd;
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
g_return_val_if_fail (selection_data != NULL, FALSE);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
if (tree_model)
|
|
Packit Service |
fb6fa5 |
*tree_model = NULL;
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
if (path)
|
|
Packit Service |
fb6fa5 |
*path = NULL;
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
if (selection_data->target != gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
|
|
Packit Service |
fb6fa5 |
return FALSE;
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
if (selection_data->length < 0)
|
|
Packit Service |
fb6fa5 |
return FALSE;
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
trd = (void*) selection_data->data;
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
if (tree_model)
|
|
Packit Service |
fb6fa5 |
*tree_model = trd->model;
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
if (path)
|
|
Packit Service |
fb6fa5 |
*path = gtk_tree_path_new_from_string (trd->path);
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
return TRUE;
|
|
Packit Service |
fb6fa5 |
}
|
|
Packit Service |
fb6fa5 |
|
|
Packit Service |
fb6fa5 |
#define __GTK_TREE_DND_C__
|
|
Packit Service |
fb6fa5 |
#include "gtkaliasdef.c"
|