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 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; }
static gboolean drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint32 time, EphyNodeView *view) { EphyNode *node; GdkAtom target; GtkTreePath *path; GtkTreeViewDropPosition pos; guint action = 0; int priority; gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget), x, y, &path, &pos); if (!view->priv->have_drag_data) { get_drag_data (view, context, time); } target = gtk_drag_dest_find_target (widget, context, NULL); node = get_node_from_path (view, path); if (target != GDK_NONE && node != NULL) { priority = ephy_node_get_property_int (node, view->priv->priority_prop_id); if (priority != EPHY_NODE_VIEW_ALL_PRIORITY && priority != EPHY_NODE_VIEW_SPECIAL_PRIORITY && ephy_node_get_is_drag_source (node)) { action = gdk_drag_context_get_suggested_action (context); } } if (action) { set_drag_dest_row (view, path); } else { clear_drag_dest_row (view); } if (path) { gtk_tree_path_free (path); } if (view->priv->scroll_id == 0) { view->priv->scroll_id = g_timeout_add (150, scroll_timeout, GTK_TREE_VIEW (view)); } gdk_drag_status (context, action, time); return TRUE; }
static gboolean drag_motion_callback (GtkWidget *widget, GdkDragContext *context, int x, int y, guint32 time, gpointer data) { NautilusTreeViewDragDest *dest; GtkTreePath *path; GtkTreePath *drop_path, *old_drop_path; GtkTreeViewDropPosition pos; GdkWindow *bin_window; guint action; gboolean res = TRUE; dest = NAUTILUS_TREE_VIEW_DRAG_DEST (data); gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget), x, y, &path, &pos); if (pos == GTK_TREE_VIEW_DROP_BEFORE || pos == GTK_TREE_VIEW_DROP_AFTER) { gtk_tree_path_free (path); path = NULL; } if (!dest->details->have_drag_data) { res = get_drag_data (dest, context, time); } if (!res) { return FALSE; } drop_path = get_drop_path (dest, path); action = 0; bin_window = gtk_tree_view_get_bin_window (GTK_TREE_VIEW (widget)); if (bin_window != NULL) { int bin_x, bin_y; gdk_window_get_position (bin_window, &bin_x, &bin_y); if (bin_y <= y) { /* ignore drags on the header */ action = get_drop_action (dest, context, drop_path); } } gtk_tree_view_get_drag_dest_row (GTK_TREE_VIEW (widget), &old_drop_path, NULL); if (action) { set_drag_dest_row (dest, drop_path); check_hover_expand_timer (dest, path, drop_path, old_drop_path); } else { clear_drag_dest_row (dest); remove_hover_timer (dest); remove_expand_timer (dest); } if (path) { gtk_tree_path_free (path); } if (drop_path) { gtk_tree_path_free (drop_path); } if (old_drop_path) { gtk_tree_path_free (old_drop_path); } if (dest->details->scroll_id == 0) { dest->details->scroll_id = g_timeout_add (150, scroll_timeout, dest->details->tree_view); } gdk_drag_status (context, action, time); return TRUE; }
static gboolean drag_motion_callback (GtkWidget *widget, GdkDragContext *context, int x, int y, guint32 time, gpointer data) { NemoTreeViewDragDest *dest; GtkTreePath *path; GtkTreePath *drop_path, *old_drop_path; GtkTreeModel *model; GtkTreeIter drop_iter; GtkTreeViewDropPosition pos; GdkWindow *bin_window; guint action; gboolean res = TRUE; dest = NEMO_TREE_VIEW_DRAG_DEST (data); gtk_tree_view_get_dest_row_at_pos (GTK_TREE_VIEW (widget), x, y, &path, &pos); if (!dest->details->have_drag_data) { res = get_drag_data (dest, context, time); } if (!res) { return FALSE; } drop_path = get_drop_path (dest, path); action = 0; bin_window = gtk_tree_view_get_bin_window (GTK_TREE_VIEW (widget)); if (bin_window != NULL) { int bin_x, bin_y; gdk_window_get_position (bin_window, &bin_x, &bin_y); if (bin_y <= y) { /* ignore drags on the header */ action = get_drop_action (dest, context, drop_path); } } gtk_tree_view_get_drag_dest_row (GTK_TREE_VIEW (widget), &old_drop_path, NULL); if (action) { set_drag_dest_row (dest, drop_path); model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); if (drop_path == NULL || (old_drop_path != NULL && gtk_tree_path_compare (old_drop_path, drop_path) != 0)) { remove_expand_timeout (dest); } if (dest->details->expand_id == 0 && drop_path != NULL) { gtk_tree_model_get_iter (model, &drop_iter, drop_path); if (gtk_tree_model_iter_has_child (model, &drop_iter)) { dest->details->expand_id = g_timeout_add_seconds (HOVER_EXPAND_TIMEOUT, expand_timeout, dest->details->tree_view); } } } else { clear_drag_dest_row (dest); remove_expand_timeout (dest); } if (path) { gtk_tree_path_free (path); } if (drop_path) { gtk_tree_path_free (drop_path); } if (old_drop_path) { gtk_tree_path_free (old_drop_path); } if (dest->details->scroll_id == 0) { dest->details->scroll_id = g_timeout_add (150, scroll_timeout, dest->details->tree_view); } gdk_drag_status (context, action, time); return TRUE; }