FmDndDest

FmDndDest — Libfm support for drag&drop target.

Synopsis

                    FmDndDest;
struct              FmDndDestClass;
enum                FmDndDestTargetType;
gboolean            fm_dnd_dest_drag_data_received      (FmDndDest *dd,
                                                         GdkDragContext *drag_context,
                                                         gint x,
                                                         gint y,
                                                         GtkSelectionData *sel_data,
                                                         guint info,
                                                         guint time);
gboolean            fm_dnd_dest_drag_drop               (FmDndDest *dd,
                                                         GdkDragContext *drag_context,
                                                         GdkAtom target,
                                                         int x,
                                                         int y,
                                                         guint time);
void                fm_dnd_dest_drag_leave              (FmDndDest *dd,
                                                         GdkDragContext *drag_context,
                                                         guint time);
GdkAtom             fm_dnd_dest_find_target             (FmDndDest *dd,
                                                         GdkDragContext *drag_context);
GdkDragAction       fm_dnd_dest_get_default_action      (FmDndDest *dd,
                                                         GdkDragContext *drag_context,
                                                         GdkAtom target);
FmFileInfo *        fm_dnd_dest_get_dest_file           (FmDndDest *dd);
FmPath *            fm_dnd_dest_get_dest_path           (FmDndDest *dd);
gboolean            fm_dnd_dest_is_target_supported     (FmDndDest *dd,
                                                         GdkAtom target);
FmDndDest *         fm_dnd_dest_new                     (GtkWidget *w);
void                fm_dnd_dest_set_dest_file           (FmDndDest *dd,
                                                         FmFileInfo *dest_file);
void                fm_dnd_dest_set_widget              (FmDndDest *dd,
                                                         GtkWidget *w);
#define             fm_drag_context_has_target          (ctx,
                                                         target)
#define             fm_drag_context_has_target_name     (ctx,
                                                         name)

Object Hierarchy

  GObject
   +----FmDndDest

Signals

  "files-dropped"                                  : Run Last

Description

include: libfm/fm-dnd-dest.h

Details

FmDndDest

typedef struct _FmDndDest FmDndDest;

struct FmDndDestClass

struct FmDndDestClass {
    GObjectClass parent_class;
    gboolean (*files_dropped)(FmDndDest* dd, int x, int y, guint action, guint info_type, FmPathList* files);
};

GObjectClass parent_class;

the parent class

files_dropped ()

the class closure for the "files-dropped" signal

enum FmDndDestTargetType

typedef enum {
    FM_DND_DEST_TARGET_FM_LIST,
    FM_DND_DEST_TARGET_URI_LIST,
    FM_DND_DEST_TARGET_XDS,
} FmDndDestTargetType;

default droppable targets supported by FmDndDest

FM_DND_DEST_TARGET_FM_LIST

direct pointer of FmList

FM_DND_DEST_TARGET_URI_LIST

"text/uri-list"

FM_DND_DEST_TARGET_XDS

X direct save

fm_dnd_dest_drag_data_received ()

gboolean            fm_dnd_dest_drag_data_received      (FmDndDest *dd,
                                                         GdkDragContext *drag_context,
                                                         gint x,
                                                         gint y,
                                                         GtkSelectionData *sel_data,
                                                         guint info,
                                                         guint time);

A common handler for signals that emitted when information about dragged data is received, such as "drag-data-received".

dd :

a drag target descriptor

drag_context :

the drag context

x :

horisontal position of drop

y :

vertical position of drop

sel_data :

selection data that are dragged

info :

(FmDndDestTargetType) type of data that are dragged

time :

timestamp of operation

Returns :

TRUE if dropping data is accepted for processing.

Since 0.1.17


fm_dnd_dest_drag_drop ()

gboolean            fm_dnd_dest_drag_drop               (FmDndDest *dd,
                                                         GdkDragContext *drag_context,
                                                         GdkAtom target,
                                                         int x,
                                                         int y,
                                                         guint time);

A common handler for signals that emitted when dragged data are dropped onto target, "drag-drop". Prepares data and emits the "files-dropped" signal if drop is supported.

dd :

a drag target descriptor

drag_context :

the drag context

target :

target type

x :

horisontal position of drop

y :

vertical position of drop

time :

timestamp of operation

Returns :

TRUE if drop to target is supported by libfm.

Since 0.1.17


fm_dnd_dest_drag_leave ()

void                fm_dnd_dest_drag_leave              (FmDndDest *dd,
                                                         GdkDragContext *drag_context,
                                                         guint time);

A common handler for signals that emitted when drag leaves the target widget, such as "drag-leave".

dd :

a drag target descriptor

drag_context :

the drag context

time :

timestamp of operation

Since 0.1.17


fm_dnd_dest_find_target ()

GdkAtom             fm_dnd_dest_find_target             (FmDndDest *dd,
                                                         GdkDragContext *drag_context);

Finds target type that is supported for drag_context.

dd :

a drag target descriptor

drag_context :

the drag context

Returns :

supported target type or GDK_NONE if none found.

Since 0.1.17


fm_dnd_dest_get_default_action ()

GdkDragAction       fm_dnd_dest_get_default_action      (FmDndDest *dd,
                                                         GdkDragContext *drag_context,
                                                         GdkAtom target);

dd :

object which will receive data

drag_context :

the drag context

target :

GdkAtom of the target data type

Returns :

the default action to take for the dragged files.

Since 0.1.17


fm_dnd_dest_get_dest_file ()

FmFileInfo *        fm_dnd_dest_get_dest_file           (FmDndDest *dd);

Retrieves file info of drag target. Returned data are owned by dd and should not be freed by caller.

dd :

a drag target descriptor

Returns :

file info of drag target. [transfer none]

Since 0.1.0


fm_dnd_dest_get_dest_path ()

FmPath *            fm_dnd_dest_get_dest_path           (FmDndDest *dd);

Retrieves file path of drag target. Returned data are owned by dd and should not be freed by caller.

dd :

a drag target descriptor

Returns :

file path of drag target. [transfer none]

Since 0.1.0


fm_dnd_dest_is_target_supported ()

gboolean            fm_dnd_dest_is_target_supported     (FmDndDest *dd,
                                                         GdkAtom target);

Checks if target is supported by libfm.

dd :

a drag target descriptor

target :

target type

Returns :

TRUE if drop to target is supported by libfm.

Since 0.1.17


fm_dnd_dest_new ()

FmDndDest *         fm_dnd_dest_new                     (GtkWidget *w);

Creates new drag target descriptor.

w :

a widget that probably is drop target

Returns :

a new FmDndDest object. [transfer full]

Since 0.1.0


fm_dnd_dest_set_dest_file ()

void                fm_dnd_dest_set_dest_file           (FmDndDest *dd,
                                                         FmFileInfo *dest_file);

Sets drag target for dd.

dd :

a drag target descriptor

dest_file :

file info of drag target

Since 0.1.0


fm_dnd_dest_set_widget ()

void                fm_dnd_dest_set_widget              (FmDndDest *dd,
                                                         GtkWidget *w);

Updates link to widget that probably is drop target.

See also: fm_dnd_dest_new()

dd :

a drag target descriptor

w :

a widget that probably is drop target

Since 0.1.0


fm_drag_context_has_target()

#define             fm_drag_context_has_target(ctx, target)

fm_drag_context_has_target_name()

#define             fm_drag_context_has_target_name(ctx, name)

Signal Details

The "files-dropped" signal

gboolean            user_function                      (FmDndDest *dd,
                                                        gint       x,
                                                        gint       y,
                                                        guint      action,
                                                        guint      info_type,
                                                        gpointer   files,
                                                        gpointer   user_data)      : Run Last

The "files-dropped" signal is emitted when files are dropped on the destination widget.

dd :

the object which emitted the signal

x :

horisontal position of drop

y :

vertical position of drop

action :

(GdkDragAction) action requested on drop

info_type :

(FmDndDestTargetType) type of data that are dropped

files :

(FmPathList *) list of files that are dropped

user_data :

user data set when the signal handler was connected.

Returns :

TRUE if action can be performed.

Since 0.1.0