aboutsummaryrefslogtreecommitdiffstats
path: root/lib/widgets
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-09-05 06:19:43 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-09-05 06:19:43 +0800
commit77db4ea08456e83c504ca83209bf20512a60e07b (patch)
treec03b1b60583be0fe760b8928845d16b2881e5baf /lib/widgets
parent8955d02ab687c2b605f106aa5dd802a8ec75e274 (diff)
downloadgsoc2013-epiphany-77db4ea08456e83c504ca83209bf20512a60e07b.tar
gsoc2013-epiphany-77db4ea08456e83c504ca83209bf20512a60e07b.tar.gz
gsoc2013-epiphany-77db4ea08456e83c504ca83209bf20512a60e07b.tar.bz2
gsoc2013-epiphany-77db4ea08456e83c504ca83209bf20512a60e07b.tar.lz
gsoc2013-epiphany-77db4ea08456e83c504ca83209bf20512a60e07b.tar.xz
gsoc2013-epiphany-77db4ea08456e83c504ca83209bf20512a60e07b.tar.zst
gsoc2013-epiphany-77db4ea08456e83c504ca83209bf20512a60e07b.zip
Make sure that only valid dnd types are accepted on thecostum drag and
2003-09-05 Marco Pesenti Gritti <marco@gnome.org> * lib/widgets/ephy-node-view.c: (drag_motion_cb), (drag_data_received_cb): Make sure that only valid dnd types are accepted on thecostum drag and drop implementation of the bookmarks topics treeview. Use x and y in drag_data_received only when a drop is occurred.
Diffstat (limited to 'lib/widgets')
-rw-r--r--lib/widgets/ephy-node-view.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c
index 8b1f09e0c..a78f9e2b0 100644
--- a/lib/widgets/ephy-node-view.c
+++ b/lib/widgets/ephy-node-view.c
@@ -358,6 +358,7 @@ drag_motion_cb (GtkWidget *widget,
EphyNodeView *view)
{
EphyNode *node;
+ GdkAtom target;
GtkTreePath *path;
GtkTreeViewDropPosition pos;
guint action = 0;
@@ -371,9 +372,10 @@ drag_motion_cb (GtkWidget *widget,
get_drag_data (view, context, time);
}
+ target = gtk_drag_dest_find_target (widget, context, NULL);
node = get_node_from_path (view, path);
- if (node)
+ if (target != GDK_NONE && node != NULL)
{
priority = ephy_node_get_property_int
(node, view->priv->priority_prop_id);
@@ -435,17 +437,14 @@ drag_data_received_cb (GtkWidget *widget,
guint32 time,
EphyNodeView *view)
{
- GtkTreePath *path;
GtkTreeViewDropPosition pos;
- gboolean on_row;
+
+ /* x and y here are valid only on drop ! */
if (selection_data->length <= 0 || selection_data->data == NULL)
{
return;
- }
-
- on_row = gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget),
- x, y, &path, &pos);
+ }
if (!view->priv->have_drag_data)
{
@@ -459,8 +458,12 @@ drag_data_received_cb (GtkWidget *widget,
EphyNode *node;
GList *uris;
gboolean success = FALSE;
+ GtkTreePath *path;
+
+ gtk_tree_view_get_dest_row_at_pos
+ (GTK_TREE_VIEW (widget), x, y, &path, &pos);
- g_return_if_fail (on_row && path != NULL);
+ g_return_if_fail (path != NULL);
node = get_node_from_path (view, path);
@@ -478,13 +481,14 @@ drag_data_received_cb (GtkWidget *widget,
view->priv->drop_occurred = FALSE;
free_drag_data (view);
gtk_drag_finish (context, success, FALSE, time);
- }
- if (path)
- {
- gtk_tree_path_free (path);
+ if (path)
+ {
+ gtk_tree_path_free (path);
+ }
}
+
/* appease GtkTreeView by preventing its drag_data_receive
* from being called */
g_signal_stop_emission_by_name (GTK_TREE_VIEW (view),