static void drag_data_get_cb (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data, guint info, guint time) { GtkTreeView *tree_view; GtkTreeModel *model; GList *ref_list; tree_view = GTK_TREE_VIEW (widget); model = gtk_tree_view_get_model (tree_view); g_return_if_fail (model != NULL); ref_list = g_object_get_data (G_OBJECT (context), "drag-info"); if (ref_list == NULL) { return; } if (EGG_IS_TREE_MULTI_DRAG_SOURCE (model)) { egg_tree_multi_drag_source_drag_data_get (EGG_TREE_MULTI_DRAG_SOURCE (model), ref_list, selection_data); } }
static gboolean egg_tree_multi_drag_drag_data_get (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data, guint info, guint time) { GtkTreeView *tree_view; GtkTreeModel *model; GList *path_list; tree_view = GTK_TREE_VIEW (widget); model = gtk_tree_view_get_model (tree_view); if (model == NULL) return FALSE; path_list = get_context_data (context); if (path_list == NULL) return FALSE; /* We can implement the GTK_TREE_MODEL_ROW target generically for * any model; for DragSource models there are some other targets * we also support. */ if (! EGG_IS_TREE_MULTI_DRAG_SOURCE (model)) return FALSE; return egg_tree_multi_drag_source_drag_data_get (EGG_TREE_MULTI_DRAG_SOURCE (model), context, selection_data, path_list); }
static gboolean on_drag_data_get( GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data, guint info, guint time ) { static const gchar *thisfn = "egg_tree_multi_dnd_on_drag_data_get"; GtkTreeView *tree_view; GtkTreeModel *model; GList *path_list; g_debug( "%s: widget=%p, context=%p, selection_data=%p, info=%d, time=%d", thisfn, ( void * ) widget, ( void * ) context, ( void * ) selection_data, info, time ); tree_view = GTK_TREE_VIEW( widget ); model = gtk_tree_view_get_model( tree_view ); g_assert( model ); g_assert( EGG_IS_TREE_MULTI_DRAG_SOURCE( model )); path_list = get_treeview_data( widget ); if( path_list == NULL ){ return( FALSE ); } /* We can implement the GTK_TREE_MODEL_ROW target generically for * any model; for DragSource models there are some other targets * we also support. */ return( egg_tree_multi_drag_source_drag_data_get( EGG_TREE_MULTI_DRAG_SOURCE( model ), context, selection_data, path_list, info )); }
/** * egg_tree_multi_drag_source_drag_data_delete: * @drag_source: a #EggTreeMultiDragSource * @path: row that was being dragged * * Asks the #EggTreeMultiDragSource to delete the row at @path, because * it was moved somewhere else via drag-and-drop. Returns %FALSE * if the deletion fails because @path no longer exists, or for * some model-specific reason. Should robustly handle a @path no * longer found in the model! * * Return value: %TRUE if the row was successfully deleted **/ gboolean egg_tree_multi_drag_source_drag_data_delete( EggTreeMultiDragSource *drag_source, GList *path_list ) { EggTreeMultiDragSourceIface *iface = EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE( drag_source ); g_return_val_if_fail( EGG_IS_TREE_MULTI_DRAG_SOURCE( drag_source ), FALSE ); g_return_val_if_fail( iface->drag_data_delete != NULL, FALSE ); g_return_val_if_fail( path_list != NULL, FALSE ); return(( *iface->drag_data_delete )( drag_source, path_list )); }
/** * egg_tree_multi_drag_source_drag_data_get: * @drag_source: a #EggTreeMultiDragSource * @path: row that was dragged * @selection_data: a #EggSelectionData to fill with data from the dragged row * * Asks the #EggTreeMultiDragSource to fill in @selection_data with a * representation of the row at @path. @selection_data->target gives * the required type of the data. Should robustly handle a @path no * longer found in the model! * * Return value: %TRUE if data of the required type was provided **/ gboolean egg_tree_multi_drag_source_drag_data_get (EggTreeMultiDragSource *drag_source, GList *path_list, GtkSelectionData *selection_data) { EggTreeMultiDragSourceIface *iface = EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE (drag_source); g_return_val_if_fail (EGG_IS_TREE_MULTI_DRAG_SOURCE (drag_source), FALSE); g_return_val_if_fail (iface->drag_data_get != NULL, FALSE); g_return_val_if_fail (path_list != NULL, FALSE); g_return_val_if_fail (selection_data != NULL, FALSE); return (* iface->drag_data_get) (drag_source, path_list, selection_data); }
static void brasero_file_chooser_notify_model (GtkTreeView *treeview, GParamSpec *pspec, gpointer NULL_data) { GtkTreeModel *model; model = gtk_tree_view_get_model (treeview); if (model && !EGG_IS_TREE_MULTI_DRAG_SOURCE (model)) { GType type; type = G_OBJECT_TYPE (model); brasero_enable_multi_DND_for_model_type (type); } }
/** * egg_tree_multi_drag_source_row_draggable: * @drag_source: a #EggTreeMultiDragSource * @path: row on which user is initiating a drag * * Asks the #EggTreeMultiDragSource whether a particular row can be used as * the source of a DND operation. If the source doesn't implement * this interface, the row is assumed draggable. * * Return value: %TRUE if the row can be dragged **/ gboolean egg_tree_multi_drag_source_row_draggable (EggTreeMultiDragSource *drag_source, GList *path_list) { EggTreeMultiDragSourceIface *iface = EGG_TREE_MULTI_DRAG_SOURCE_GET_IFACE (drag_source); g_return_val_if_fail (EGG_IS_TREE_MULTI_DRAG_SOURCE (drag_source), FALSE); g_return_val_if_fail (iface->row_draggable != NULL, FALSE); g_return_val_if_fail (path_list != NULL, FALSE); if (iface->row_draggable) return (* iface->row_draggable) (drag_source, path_list); else return TRUE; }