mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
6067afb1fc
* gdesktop.c (desktop_icon_info_new): Connect the signals for DnD so that we can drag icons from the desktop. (drag_begin): New function to set the drag cursor for icons on the desktop. (button_press): New function that stores the hot spot position for DnD cursors. (drag_data_get): New function to fetch the URI-list of selected icons. * gdialogs.c: Fixed some includes. * gdesktop.h: Removed the DnD target enum from here, since it is specific to each submodule. * gdnd.h: Moved the DnD target enums to here. Added a new TARGET_MC_DESKTOP_ICON. * gdesktop.c (get_icon_snap_pos): Fixed icon snapping; the coordinates not being updated correctly. * gscreen.c (panel_drag_data_get): Free the uri list; it was being leaked.
132 lines
3.2 KiB
C
132 lines
3.2 KiB
C
/* Desktop management 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 GDESKTOP_H
|
|
#define GDESKTOP_H
|
|
|
|
#if 1
|
|
|
|
|
|
/* Snap granularity for desktop icons -- maybe these should be calculated in terms of the font size? */
|
|
#define DESKTOP_SNAP_X 80
|
|
#define DESKTOP_SNAP_Y 80
|
|
|
|
|
|
/* Configuration options for the desktop */
|
|
|
|
extern int desktop_use_shaped_icons; /* Whether to use shaped icons or not (for slow X servers) */
|
|
extern int desktop_auto_placement; /* Whether to auto-place icons or not (user placement) */
|
|
extern int desktop_snap_icons; /* Whether to snap icons to the grid or not */
|
|
|
|
extern int want_transparent_icons;
|
|
extern int want_transparent_text;
|
|
|
|
/* Initializes the desktop -- init DnD, load the default desktop icons, etc. */
|
|
void desktop_init (void);
|
|
|
|
/* Shuts the desktop down by destroying the desktop icons. */
|
|
void desktop_destroy (void);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
application,
|
|
directory,
|
|
file
|
|
} icon_t;
|
|
/* A structure that describes each icon on the desktop */
|
|
typedef struct {
|
|
GnomeDesktopEntry *dentry;
|
|
GtkWidget *widget;
|
|
icon_t type;
|
|
int x, y;
|
|
int grid_x, grid_y;
|
|
char *pathname;
|
|
} desktop_icon_t;
|
|
|
|
#else
|
|
|
|
#define MC_LIB_DESKTOP "mc.desktop"
|
|
|
|
/* Drag and drop types recognized by us */
|
|
enum {
|
|
TARGET_URI_LIST,
|
|
TARGET_TEXT_PLAIN,
|
|
};
|
|
|
|
|
|
/* Types of desktop icons:
|
|
*
|
|
* o Application: Double click: start up application;
|
|
* Dropping: start up program with arguments.
|
|
*
|
|
* o Directory: Double click: opens the directory in a panel.
|
|
* Double click: copies/moves files.
|
|
*
|
|
* o File: Opens the application according to regex_command
|
|
*/
|
|
|
|
typedef enum {
|
|
application,
|
|
directory,
|
|
file
|
|
} icon_t;
|
|
|
|
/* A structure that describes each icon on the desktop */
|
|
typedef struct {
|
|
GnomeDesktopEntry *dentry;
|
|
GtkWidget *widget;
|
|
icon_t type;
|
|
int x, y;
|
|
int grid_x, grid_y;
|
|
char *pathname;
|
|
} desktop_icon_t;
|
|
|
|
/* size of the snap to grid size */
|
|
#define SNAP_X 80
|
|
#define SNAP_Y 80
|
|
|
|
/* gtrans.c */
|
|
|
|
extern int want_transparent_icons;
|
|
extern int want_transparent_text;
|
|
|
|
GtkWidget *make_transparent_window (char *file);
|
|
|
|
/* gdesktop.c */
|
|
void drop_on_directory (GtkSelectionData *sel_data, GdkDragContext *context,
|
|
GdkDragAction action, char *dest, int force_manually);
|
|
#if 0
|
|
void drop_on_directory (GdkEventDropDataAvailable *event, char *dest, int force_manually);
|
|
void artificial_drag_start (GdkWindow *source_window, int x, int y);
|
|
#endif
|
|
|
|
void gnome_arrange_icons (void);
|
|
void start_desktop (void);
|
|
void stop_desktop (void);
|
|
|
|
/* These get invoked by the context sensitive popup menu in gscreen.c */
|
|
void desktop_icon_properties (GtkWidget *widget, desktop_icon_t *di);
|
|
void desktop_icon_execute (GtkWidget *widget, desktop_icon_t *di);
|
|
void desktop_icon_delete (GtkWidget *widget, desktop_icon_t *di);
|
|
|
|
/* Pops up the context sensitive menu for a WPanel or a desktop_icon_t */
|
|
void file_popup (GdkEventButton *event, void *WPanel_pointer, void *desktop_icon_t_pointer, int row, char *filename);
|
|
|
|
#endif
|
|
|
|
#endif
|