2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 3
10
* of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#ifndef __CAIRO_DOCK_FILE_MANAGER__
22
#define __CAIRO_DOCK_FILE_MANAGER__
24
#include "cairo-dock-struct.h"
25
#include "cairo-dock-icons.h"
29
*@file cairo-dock-file-manager.h This class handles the integration into the desktop environment, which includes :
30
* - the VFS (Virtual File System)
31
* - the various desktop-related tools.
35
CAIRO_DOCK_UNKNOWN_ENV=0,
39
CAIRO_DOCK_NB_DESKTOPS
40
} CairoDockDesktopEnv;
42
/// type of events that can occur to a file.
44
CAIRO_DOCK_FILE_MODIFIED=0,
45
CAIRO_DOCK_FILE_DELETED,
46
CAIRO_DOCK_FILE_CREATED,
47
CAIRO_DOCK_NB_EVENT_ON_FILES
48
} CairoDockFMEventType;
50
/// Type of sorting available on files.
52
CAIRO_DOCK_FM_SORT_BY_NAME=0,
53
CAIRO_DOCK_FM_SORT_BY_DATE,
54
CAIRO_DOCK_FM_SORT_BY_SIZE,
55
CAIRO_DOCK_FM_SORT_BY_TYPE,
56
CAIRO_DOCK_NB_SORT_ON_FILE
57
} CairoDockFMSortType;
59
#define CAIRO_DOCK_FM_VFS_ROOT "_vfsroot_"
60
#define CAIRO_DOCK_FM_NETWORK "_network_"
61
#define CAIRO_DOCK_FM_TRASH "_trash_"
62
#define CAIRO_DOCK_FM_DESKTOP "_desktop_"
64
typedef void (*CairoDockFMGetFileInfoFunc) (const gchar *cBaseURI, gchar **cName, gchar **cURI, gchar **cIconName, gboolean *bIsDirectory, int *iVolumeID, double *fOrder, CairoDockFMSortType iSortType);
65
typedef void (*CairoDockFMFilePropertiesFunc) (const gchar *cURI, guint64 *iSize, time_t *iLastModificationTime, gchar **cMimeType, int *iUID, int *iGID, int *iPermissionsMask);
66
typedef GList * (*CairoDockFMListDirectoryFunc) (const gchar *cURI, CairoDockFMSortType g_fm_iSortType, int iNewIconsType, gboolean bListHiddenFiles, gchar **cFullURI);
67
typedef void (*CairoDockFMLaunchUriFunc) (const gchar *cURI);
69
typedef gchar * (*CairoDockFMIsMountedFunc) (const gchar *cURI, gboolean *bIsMounted);
70
typedef gboolean (*CairoDockFMCanEjectFunc) (const gchar *cURI);
71
typedef gboolean (*CairoDockFMEjectDriveFunc) (const gchar *cURI);
73
typedef void (*CairoDockFMMountCallback) (gboolean bMounting, gboolean bSuccess, const gchar *cName, Icon *icon, CairoContainer *pContainer);
74
typedef void (*CairoDockFMMountFunc) (const gchar *cURI, int iVolumeID, CairoDockFMMountCallback pCallback, Icon *icon, CairoContainer *pContainer);
75
typedef void (*CairoDockFMUnmountFunc) (const gchar *cURI, int iVolumeID, CairoDockFMMountCallback pCallback, Icon *icon, CairoContainer *pContainer);
77
typedef void (*CairoDockFMMonitorCallback) (CairoDockFMEventType iEventType, const gchar *cURI, gpointer data);
78
typedef void (*CairoDockFMAddMonitorFunc) (const gchar *cURI, gboolean bDirectory, CairoDockFMMonitorCallback pCallback, gpointer data);
79
typedef void (*CairoDockFMRemoveMonitorFunc) (const gchar *cURI);
81
typedef gboolean (*CairoDockFMDeleteFileFunc) (const gchar *cURI);
82
typedef gboolean (*CairoDockFMRenameFileFunc) (const gchar *cOldURI, const gchar *cNewName);
83
typedef gboolean (*CairoDockFMMoveFileFunc) (const gchar *cURI, const gchar *cDirectoryURI);
85
typedef gchar * (*CairoDockFMGetTrashFunc) (const gchar *cNearURI, gchar **cFileInfoPath);
86
typedef gchar * (*CairoDockFMGetDesktopFunc) (void);
87
typedef void (*CairoDockFMUserActionFunc) (void);
89
/// Definition of the Desktop Environment backend.
90
struct _CairoDockDesktopEnvBackend {
91
CairoDockFMGetFileInfoFunc get_file_info;
92
CairoDockFMFilePropertiesFunc get_file_properties;
93
CairoDockFMListDirectoryFunc list_directory;
94
CairoDockFMLaunchUriFunc launch_uri;
95
CairoDockFMIsMountedFunc is_mounted;
96
CairoDockFMCanEjectFunc can_eject;
97
CairoDockFMEjectDriveFunc eject;
98
CairoDockFMMountFunc mount;
99
CairoDockFMUnmountFunc unmount;
100
CairoDockFMAddMonitorFunc add_monitor;
101
CairoDockFMRemoveMonitorFunc remove_monitor;
102
CairoDockFMDeleteFileFunc delete_file;
103
CairoDockFMRenameFileFunc rename;
104
CairoDockFMMoveFileFunc move;
105
CairoDockFMGetTrashFunc get_trash_path;
106
CairoDockFMGetDesktopFunc get_desktop_path;
107
CairoDockFMUserActionFunc logout;
108
CairoDockFMUserActionFunc shutdown;
109
CairoDockFMUserActionFunc setup_time;
110
CairoDockFMUserActionFunc show_system_monitor;
113
/** Register a environment backend, overwriting any previous backend.
115
void cairo_dock_fm_register_vfs_backend (CairoDockDesktopEnvBackend *pVFSBackend);
117
/** List the content of a directory and turn it into a list of icons.
119
GList * cairo_dock_fm_list_directory (const gchar *cURI, CairoDockFMSortType g_fm_iSortType, int iNewIconsType, gboolean bListHiddenFiles, gchar **cFullURI);
121
/** Get the main info to represent a file.
123
gboolean cairo_dock_fm_get_file_info (const gchar *cBaseURI, gchar **cName, gchar **cURI, gchar **cIconName, gboolean *bIsDirectory, int *iVolumeID, double *fOrder, CairoDockFMSortType iSortType);
125
/** Get some properties about a file.
127
gboolean cairo_dock_fm_get_file_properties (const gchar *cURI, guint64 *iSize, time_t *iLastModificationTime, gchar **cMimeType, int *iUID, int *iGID, int *iPermissionsMask);
129
/** Open a file with the default application.
131
gboolean cairo_dock_fm_launch_uri (const gchar *cURI);
133
/** Add a monitor on an URI. It will be called each time a modification occurs on the file.
135
gboolean cairo_dock_fm_add_monitor_full (const gchar *cURI, gboolean bDirectory, const gchar *cMountedURI, CairoDockFMMonitorCallback pCallback, gpointer data);
136
/** Add a monitor on an icon representing an URI.
138
#define cairo_dock_fm_add_monitor(pIcon) cairo_dock_fm_add_monitor_full (pIcon->cBaseURI, (pIcon->pSubDock != NULL), (pIcon->iVolumeID != 0 ? pIcon->cCommand : NULL), (CairoDockFMMonitorCallback) cairo_dock_fm_action_on_file_event, (gpointer) pIcon)
140
/** Remove a monitor on an URI.
142
gboolean cairo_dock_fm_remove_monitor_full (const gchar *cURI, gboolean bDirectory, const gchar *cMountedURI);
143
/** Remove a monitor on an icon representing an URI.
145
#define cairo_dock_fm_remove_monitor(pIcon) cairo_dock_fm_remove_monitor_full (pIcon->cBaseURI, (pIcon->pSubDock != NULL), (pIcon->iVolumeID != 0 ? pIcon->cCommand : NULL))
150
gboolean cairo_dock_fm_mount_full (const gchar *cURI, int iVolumeID, CairoDockFMMountCallback pCallback, Icon *icon, CairoContainer *pContainer);
151
/** Mount an icon representing an URI.
153
#define cairo_dock_fm_mount(icon, pContainer) cairo_dock_fm_mount_full (icon->cBaseURI, icon->iVolumeID, cairo_dock_fm_action_after_mounting, icon, pContainer)
157
gboolean cairo_dock_fm_unmount_full (const gchar *cURI, int iVolumeID, CairoDockFMMountCallback pCallback, Icon *icon, CairoContainer *pContainer);
158
/** Unmount an icon representing an URI.
160
#define cairo_dock_fm_unmount(icon, pContainer) cairo_dock_fm_unmount_full (icon->cBaseURI, icon->iVolumeID, cairo_dock_fm_action_after_mounting, icon, pContainer)
162
/** Say if a point is currently mounted.
164
gchar *cairo_dock_fm_is_mounted (const gchar *cURI, gboolean *bIsMounted);
166
/** Say if a point can be ejected (like a CD player).
168
gboolean cairo_dock_fm_can_eject (const gchar *cURI);
169
/** Eject a drive, like a CD player.
171
gboolean cairo_dock_fm_eject_drive (const gchar *cURI);
176
gboolean cairo_dock_fm_delete_file (const gchar *cURI);
180
gboolean cairo_dock_fm_rename_file (const gchar *cOldURI, const gchar *cNewName);
184
gboolean cairo_dock_fm_move_file (const gchar *cURI, const gchar *cDirectoryURI);
186
/** Get the path to the Trash.
188
gchar *cairo_dock_fm_get_trash_path (const gchar *cNearURI, gchar **cFileInfoPath);
189
/** Get the path to the Desktop.
191
gchar *cairo_dock_fm_get_desktop_path (void);
193
/** Raise the logout panel.
195
gboolean cairo_dock_fm_logout (void);
196
/** Raise the shutdown panel.
198
gboolean cairo_dock_fm_shutdown (void);
200
/** Raise the panel to configure the time.
202
gboolean cairo_dock_fm_setup_time (void);
204
/** Raise the default system monitor.
206
gboolean cairo_dock_fm_show_system_monitor (void);
208
/** Create an Icon representing a given URI.
210
Icon *cairo_dock_fm_create_icon_from_URI (const gchar *cURI, CairoContainer *pContainer);
212
/** Create a Dock with the list of icons representing a folder.
214
void cairo_dock_fm_create_dock_from_directory (Icon *pIcon, CairoDock *pParentDock);
217
void cairo_dock_fm_manage_event_on_file (CairoDockFMEventType iEventType, const gchar *cURI, Icon *pIcon, CairoDockIconType iTypeOnCreation);
218
void cairo_dock_fm_action_on_file_event (CairoDockFMEventType iEventType, const gchar *cURI, Icon *pIcon);
220
void cairo_dock_fm_action_after_mounting (gboolean bMounting, gboolean bSuccess, const gchar *cName, Icon *icon, CairoContainer *pContainer);
223
gboolean cairo_dock_fm_move_into_directory (const gchar *cURI, Icon *icon, CairoContainer *pContainer);
226
CairoDockDesktopEnv cairo_dock_guess_environment (void);
228
/** Get the size of a local file.
229
*@param cFilePath path of a file on the hard disk.
230
*@return the size of the file, or 0 if it doesn't exist.
232
int cairo_dock_get_file_size (const gchar *cFilePath);