436638f2bd
* gdesktop.c (setup_icon_dnd_dest): Always specify ACTION_MOVE, since we want to be able to move the icons around. Connect to the drag_motion signal. (dnd_icon_targets): List desktop icons as a target to be able to move them just a notch in the desktop. (icon_drag_motion): Decide which action we can use for dropping stuff on a desktop icon. (setup_icon_dnd_dest): Always specify all the actions. (icon_drag_data_received): Allow for icons to be moved just a notch by accepting drops from icons. * gdnd.h: Added #defines for the DnD target type names. * gdnd.c (gdnd_init): New public function to intern the target atom names. (gdnd_drag_context_has_target): New public function to see if a drag context has a certain target type. * gdesktop.c (setup_desktop_dnd): Do not use GTK_DEST_DEFAULT_MOVE, and connect to drag_motion. (desktop_drag_motion): If we are dragging from a desktop icon, indicate the action as MOVE. Otherwise, force the action to be LINK unless the user explicitly requested ASK. (setup_desktop_dnd): Intern the atoms for the drop targets.
44 строки
1.2 KiB
C
44 строки
1.2 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>
|
|
|
|
|
|
/* 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);
|
|
|
|
/* Drop the list of URIs in the selection data to the specified directory */
|
|
int gdnd_drop_on_directory (GdkDragContext *context, GtkSelectionData *selection_data, char *dirname);
|
|
|
|
/* Test whether the specified context has a certain target type */
|
|
int gdnd_drag_context_has_target (GdkDragContext *context, TargetType type);
|
|
|
|
#endif
|