static void tree_view_weak_notify (gpointer user_data, GObject *object) { NemoTreeViewDragDest *dest; dest = NEMO_TREE_VIEW_DRAG_DEST (user_data); remove_scroll_timeout (dest); remove_expand_timeout (dest); dest->details->tree_view = NULL; }
static gboolean rb_tree_dnd_drag_drop_cb (GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time) { GtkTreeView *tree_view; GtkTreePath *path; GtkTreeModel *model; GtkTreeViewDropPosition pos; RbTreeDndData *priv_data; tree_view = GTK_TREE_VIEW (widget); model = gtk_tree_view_get_model (tree_view); priv_data = g_object_get_data (G_OBJECT (widget), RB_TREE_DND_STRING); gtk_tree_view_get_dest_row_at_pos (tree_view, x, y, &path, &pos); remove_scroll_timeout (tree_view); /* Unset this thing */ gtk_tree_view_set_drag_dest_row (tree_view, NULL, GTK_TREE_VIEW_DROP_BEFORE); if (path || priv_data->dest_flags & RB_TREE_DEST_EMPTY_VIEW_DROP) { GdkAtom target; RbTreeDragDestIface *iface = RB_TREE_DRAG_DEST_GET_IFACE (model); if (iface->rb_get_drag_target) { RbTreeDragDest *dest = RB_TREE_DRAG_DEST (model); target = (* iface->rb_get_drag_target) (dest, widget, context, path, priv_data->dest_target_list); } else { target = gtk_drag_dest_find_target (widget, context, priv_data->dest_target_list); } if (path) gtk_tree_path_free (path); if (target != GDK_NONE) { gtk_drag_get_data (widget, context, target, time); return TRUE; } } return FALSE; }
static gboolean drag_drop_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint32 time, EphyNodeView *view) { view->priv->drop_occurred = TRUE; get_drag_data (view, context, time); remove_scroll_timeout (view); clear_drag_dest_row (view); return TRUE; }
static void drag_leave_callback (GtkWidget *widget, GdkDragContext *context, guint32 time, gpointer data) { NautilusTreeViewDragDest *dest; dest = NAUTILUS_TREE_VIEW_DRAG_DEST (data); clear_drag_dest_row (dest); free_drag_data (dest); remove_scroll_timeout (dest); }
static void nautilus_tree_view_drag_dest_dispose (GObject *object) { NautilusTreeViewDragDest *dest; dest = NAUTILUS_TREE_VIEW_DRAG_DEST (object); if (dest->details->tree_view) { g_object_weak_unref (G_OBJECT (dest->details->tree_view), tree_view_weak_notify, dest); } remove_scroll_timeout (dest); G_OBJECT_CLASS (nautilus_tree_view_drag_dest_parent_class)->dispose (object); }
static gboolean drag_drop_callback (GtkWidget *widget, GdkDragContext *context, int x, int y, guint32 time, gpointer data) { NemoTreeViewDragDest *dest; guint info; GdkAtom target; dest = NEMO_TREE_VIEW_DRAG_DEST (data); target = gtk_drag_dest_find_target (GTK_WIDGET (dest->details->tree_view), context, NULL); if (target == GDK_NONE) { return FALSE; } info = dest->details->drag_type; if (info == NEMO_ICON_DND_XDNDDIRECTSAVE) { /* We need to set this or get_drop_path will fail, and it was unset by drag_leave_callback */ dest->details->have_drag_data = TRUE; if (!set_direct_save_uri (dest, context, x, y)) { return FALSE; } dest->details->have_drag_data = FALSE; } dest->details->drop_occurred = TRUE; get_drag_data (dest, context, time); remove_scroll_timeout (dest); remove_expand_timeout (dest); clear_drag_dest_row (dest); return TRUE; }