mc/gnome/gdnd.h
Miguel de Icaza 04c4abd818 1999-02-03 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gdnd.c (gdnd_validate_action): Added an "on_desktop" argument;
	this specifies that the user is dragging over the desktop.  Added
	cases for drags of desktop icons and URLs.
	(gdnd_perform_drop): New public function to handle drops.  This is
	now the master function to handle drops -- use this to make all of
	MC consistent.
	(drop_on_directory): Made static and renamed from
	gdnd_drop_on_directory().  Made it fit for use by
	gdnd_perform_drop().
	(drop_url_on_directory): New function to drop an url on a
	directory, moved over from gdesktop.c.
	(drop_uri_list_on_directory): New function to handle drops of URI
	lists on a directory.
	(drop_on_file): New function to handle drops on a non-directory
	file entry.  This is moved over from gdesktop.c,
	desktop_icon_drop_uri_list().  This is yet to be finished.

	* gdesktop.c (desktop_icon_drop_uri_list): Fix memory leak.
	(desktop_drag_motion): Use gdnd_validate_action().
	(dnd_icon_targets): Allow dropping URLs on icons.
	(icon_drag_motion): Use gdnd_validate_action().
	(desktop_drag_data_received): Use gdnd_perform_drop().
	(icon_drag_data_received): Use gdnd_perform_drop().

	* gscreen.c (panel_icon_list_drag_data_received): Use
	gdnd_perform_drop().
	(panel_clist_drag_data_received): Use gdnd_perform_drop().
	(panel_tree_drag_data_received): Use gdnd_perform_drop().

	* gcmd.c (gnome_about_cmd): Fixed Foundation typo, and updated the
	copyright date.
1999-02-03 11:46:01 +00:00

60 lines
1.8 KiB
C

/* Drag and Drop functionality for the Midnight Commander
*
* Copyright (C) 1998 The Free Software Foundation
*
* Authors: Federico Mena <federico@nuclecu.unam.mx>
* Miguel de Icaza <miguel@nuclecu.unam.mx>
*/
#ifndef GDND_H
#define GDND_H
#include <gtk/gtk.h>
#include "panel.h"
/* Standard DnD types */
typedef enum {
TARGET_MC_DESKTOP_ICON,
TARGET_URI_LIST,
TARGET_TEXT_PLAIN,
TARGET_URL,
TARGET_NTARGETS
} TargetType;
/* DnD target names */
#define TARGET_MC_DESKTOP_ICON_TYPE "application/x-mc-desktop-icon"
#define TARGET_URI_LIST_TYPE "text/uri-list"
#define TARGET_TEXT_PLAIN_TYPE "text/plain"
#define TARGET_URL_TYPE "_NETSCAPE_URL"
/* Atoms for the DnD types, indexed per the enum above */
extern GdkAtom dnd_target_atoms[];
/* Initializes drag and drop by interning the target convenience atoms */
void gdnd_init (void);
/* Perform a drop on the specified file entry. This function takes care of
* determining how to drop the stuff epending on the type of the file entry.
* Returns TRUE if an action was performed, FALSE otherwise (i.e. invalid drop).
*/
int gdnd_perform_drop (GdkDragContext *context, GtkSelectionData *selection_data,
file_entry *dest_fe, char *dest_name);
/* Test whether the specified context has a certain target type */
int gdnd_drag_context_has_target (GdkDragContext *context, TargetType type);
/* Look for a panel that corresponds to the specified drag context */
WPanel *gdnd_find_panel_by_drag_context (GdkDragContext *context, GtkWidget **source_widget);
/* Computes the final drag action based on the suggested actions and the
* specified conditions.
*/
GdkDragAction gdnd_validate_action (GdkDragContext *context,
int on_desktop, int same_process, int same_source,
file_entry *dest_fe, int dest_selected);
#endif