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-icons.h"
25
#include "cairo-dock-struct.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.
34
/// Type of available Desktop Environments.
36
CAIRO_DOCK_UNKNOWN_ENV=0,
40
CAIRO_DOCK_NB_DESKTOPS
41
} CairoDockDesktopEnv;
43
/// Type of events that can occur to a file.
45
CAIRO_DOCK_FILE_MODIFIED=0,
46
CAIRO_DOCK_FILE_DELETED,
47
CAIRO_DOCK_FILE_CREATED,
48
CAIRO_DOCK_NB_EVENT_ON_FILES
49
} CairoDockFMEventType;
51
/// Type of sorting available on files.
53
CAIRO_DOCK_FM_SORT_BY_NAME=0,
54
CAIRO_DOCK_FM_SORT_BY_DATE,
55
CAIRO_DOCK_FM_SORT_BY_SIZE,
56
CAIRO_DOCK_FM_SORT_BY_TYPE,
57
CAIRO_DOCK_NB_SORT_ON_FILE
58
} CairoDockFMSortType;
60
#define CAIRO_DOCK_FM_VFS_ROOT "_vfsroot_"
61
#define CAIRO_DOCK_FM_NETWORK "_network_"
62
#define CAIRO_DOCK_FM_TRASH "_trash_"
63
#define CAIRO_DOCK_FM_DESKTOP "_desktop_"
65
typedef void (*CairoDockFMGetFileInfoFunc) (const gchar *cBaseURI, gchar **cName, gchar **cURI, gchar **cIconName, gboolean *bIsDirectory, int *iVolumeID, double *fOrder, CairoDockFMSortType iSortType);
66
typedef void (*CairoDockFMFilePropertiesFunc) (const gchar *cURI, guint64 *iSize, time_t *iLastModificationTime, gchar **cMimeType, int *iUID, int *iGID, int *iPermissionsMask);
67
typedef GList * (*CairoDockFMListDirectoryFunc) (const gchar *cURI, CairoDockFMSortType g_fm_iSortType, int iNewIconsType, gboolean bListHiddenFiles, int iNbMaxFiles, gchar **cFullURI);
68
typedef gsize (*CairoDockFMMeasureDirectoryFunc) (const gchar *cURI, gint iCountType, gboolean bRecursive, gint *pCancel);
69
typedef void (*CairoDockFMLaunchUriFunc) (const gchar *cURI);
71
typedef gchar * (*CairoDockFMIsMountedFunc) (const gchar *cURI, gboolean *bIsMounted);
72
typedef gboolean (*CairoDockFMCanEjectFunc) (const gchar *cURI);
73
typedef gboolean (*CairoDockFMEjectDriveFunc) (const gchar *cURI);
75
typedef void (*CairoDockFMMountCallback) (gboolean bMounting, gboolean bSuccess, const gchar *cName, const gchar *cUri, gpointer data);
76
typedef void (*CairoDockFMMountFunc) (const gchar *cURI, int iVolumeID, CairoDockFMMountCallback pCallback, gpointer user_data);
77
typedef void (*CairoDockFMUnmountFunc) (const gchar *cURI, int iVolumeID, CairoDockFMMountCallback pCallback, gpointer user_data);
79
typedef void (*CairoDockFMMonitorCallback) (CairoDockFMEventType iEventType, const gchar *cURI, gpointer data);
80
typedef void (*CairoDockFMAddMonitorFunc) (const gchar *cURI, gboolean bDirectory, CairoDockFMMonitorCallback pCallback, gpointer data);
81
typedef void (*CairoDockFMRemoveMonitorFunc) (const gchar *cURI);
83
typedef gboolean (*CairoDockFMDeleteFileFunc) (const gchar *cURI, gboolean bNoTrash);
84
typedef gboolean (*CairoDockFMRenameFileFunc) (const gchar *cOldURI, const gchar *cNewName);
85
typedef gboolean (*CairoDockFMMoveFileFunc) (const gchar *cURI, const gchar *cDirectoryURI);
86
typedef gboolean (*CairoDockFMCreateFileFunc) (const gchar *cURI, gboolean bDirectory);
87
typedef GList * (*CairoDockFMListAppsForFileFunc) (const gchar *cURI);
89
typedef gchar * (*CairoDockFMGetTrashFunc) (const gchar *cNearURI, gchar **cFileInfoPath);
90
typedef void (*CairoDockFMEmptyTrashFunc) (void);
91
typedef gchar * (*CairoDockFMGetDesktopFunc) (void);
92
typedef void (*CairoDockFMUserActionFunc) (void);
94
/// Definition of the Desktop Environment backend.
95
struct _CairoDockDesktopEnvBackend {
96
CairoDockFMGetFileInfoFunc get_file_info;
97
CairoDockFMFilePropertiesFunc get_file_properties;
98
CairoDockFMListDirectoryFunc list_directory;
99
CairoDockFMMeasureDirectoryFunc measure_directory;
100
CairoDockFMLaunchUriFunc launch_uri;
101
CairoDockFMIsMountedFunc is_mounted;
102
CairoDockFMCanEjectFunc can_eject;
103
CairoDockFMEjectDriveFunc eject;
104
CairoDockFMMountFunc mount;
105
CairoDockFMUnmountFunc unmount;
106
CairoDockFMAddMonitorFunc add_monitor;
107
CairoDockFMRemoveMonitorFunc remove_monitor;
108
CairoDockFMDeleteFileFunc delete_file;
109
CairoDockFMRenameFileFunc rename;
110
CairoDockFMMoveFileFunc move;
111
CairoDockFMCreateFileFunc create;
112
CairoDockFMListAppsForFileFunc list_apps_for_file;
113
CairoDockFMEmptyTrashFunc empty_trash;
114
CairoDockFMGetTrashFunc get_trash_path;
115
CairoDockFMGetDesktopFunc get_desktop_path;
116
CairoDockFMUserActionFunc logout;
117
CairoDockFMUserActionFunc lock_screen;
118
CairoDockFMUserActionFunc shutdown;
119
CairoDockFMUserActionFunc setup_time;
120
CairoDockFMUserActionFunc show_system_monitor;
123
/** Register a environment backend, overwriting any previous backend.
125
void cairo_dock_fm_register_vfs_backend (CairoDockDesktopEnvBackend *pVFSBackend);
127
/** List the content of a directory and turn it into a list of icons.
129
GList * cairo_dock_fm_list_directory (const gchar *cURI, CairoDockFMSortType g_fm_iSortType, int iNewIconsType, gboolean bListHiddenFiles, int iNbMaxFiles, gchar **cFullURI);
131
/** Measure a directory (number of files or total size).
133
gsize cairo_dock_fm_measure_diretory (const gchar *cBaseURI, gint iCountType, gboolean bRecursive, gint *pCancel);
135
/** Get the main info to represent a file.
137
gboolean cairo_dock_fm_get_file_info (const gchar *cBaseURI, gchar **cName, gchar **cURI, gchar **cIconName, gboolean *bIsDirectory, int *iVolumeID, double *fOrder, CairoDockFMSortType iSortType);
139
/** Get some properties about a file.
141
gboolean cairo_dock_fm_get_file_properties (const gchar *cURI, guint64 *iSize, time_t *iLastModificationTime, gchar **cMimeType, int *iUID, int *iGID, int *iPermissionsMask);
143
/** Open a file with the default application.
145
gboolean cairo_dock_fm_launch_uri (const gchar *cURI);
147
/** Add a monitor on an URI. It will be called each time a modification occurs on the file.
149
gboolean cairo_dock_fm_add_monitor_full (const gchar *cURI, gboolean bDirectory, const gchar *cMountedURI, CairoDockFMMonitorCallback pCallback, gpointer data);
151
/** Remove a monitor on an URI.
153
gboolean cairo_dock_fm_remove_monitor_full (const gchar *cURI, gboolean bDirectory, const gchar *cMountedURI);
157
gboolean cairo_dock_fm_mount_full (const gchar *cURI, int iVolumeID, CairoDockFMMountCallback pCallback, gpointer user_data);
161
gboolean cairo_dock_fm_unmount_full (const gchar *cURI, int iVolumeID, CairoDockFMMountCallback pCallback, gpointer user_data);
163
/** Say if a point is currently mounted.
165
gchar *cairo_dock_fm_is_mounted (const gchar *cURI, gboolean *bIsMounted);
167
/** Say if a point can be ejected (like a CD player).
169
gboolean cairo_dock_fm_can_eject (const gchar *cURI);
171
/** Eject a drive, like a CD player.
173
gboolean cairo_dock_fm_eject_drive (const gchar *cURI);
178
gboolean cairo_dock_fm_delete_file (const gchar *cURI, gboolean bNoTrash);
182
gboolean cairo_dock_fm_rename_file (const gchar *cOldURI, const gchar *cNewName);
186
gboolean cairo_dock_fm_move_file (const gchar *cURI, const gchar *cDirectoryURI);
188
/** Create a new file.
190
gboolean cairo_dock_fm_create_file (const gchar *cURI, gboolean bDirectory);
192
/** Get the list of applications that can open a given file. Returns a list of strings arrays : {name, command, icon}.
194
GList *cairo_dock_fm_list_apps_for_file (const gchar *cURI);
198
gboolean cairo_dock_fm_empty_trash (void);
200
/** Get the path to the Trash.
202
gchar *cairo_dock_fm_get_trash_path (const gchar *cNearURI, gchar **cFileInfoPath);
203
/** Get the path to the Desktop.
205
gchar *cairo_dock_fm_get_desktop_path (void);
207
/** Raise the logout panel.
209
gboolean cairo_dock_fm_logout (void);
210
/** Raise the shutdown panel.
212
gboolean cairo_dock_fm_shutdown (void);
216
gboolean cairo_dock_fm_lock_screen (void);
218
/** Raise the panel to configure the time.
220
gboolean cairo_dock_fm_setup_time (void);
222
/** Raise the default system monitor.
224
gboolean cairo_dock_fm_show_system_monitor (void);
226
/** Create an Icon representing a given URI.
228
Icon *cairo_dock_fm_create_icon_from_URI (const gchar *cURI, CairoContainer *pContainer, CairoDockFMSortType iFileSortType);
231
gboolean cairo_dock_fm_move_into_directory (const gchar *cURI, Icon *icon, CairoContainer *pContainer);
234
CairoDockDesktopEnv cairo_dock_guess_environment (void);
236
/** Get the size of a local file.
237
*@param cFilePath path of a file on the hard disk.
238
*@return the size of the file, or 0 if it doesn't exist.
240
int cairo_dock_get_file_size (const gchar *cFilePath);