use static fsfuncs. remove all unimplemented filesystem functions.
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@8633 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
@@ -786,45 +786,6 @@ get_file_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
put_file_func (CameraFilesystem *fs, const char *folder, CameraFile *file,
|
||||
void *data, GPContext *context)
|
||||
{
|
||||
/* Camera *camera; */
|
||||
|
||||
/*
|
||||
* Upload the file to the camera. Use gp_file_get_data_and_size,
|
||||
* gp_file_get_name, etc.
|
||||
*/
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
delete_file_func (CameraFilesystem *fs, const char *folder,
|
||||
const char *filename, void *data, GPContext *context)
|
||||
{
|
||||
/* Camera *camera = data; */
|
||||
|
||||
/* Delete the file from the camera. */
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
delete_all_func (CameraFilesystem *fs, const char *folder, void *data,
|
||||
GPContext *context)
|
||||
{
|
||||
/* Camera *camera = data; */
|
||||
|
||||
/*
|
||||
* Delete all files in the given folder. If your camera doesn't have
|
||||
* such a functionality, just don't implement this function.
|
||||
*/
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
camera_config_get (Camera *camera, CameraWidget **window, GPContext *context)
|
||||
{
|
||||
@@ -916,39 +877,6 @@ camera_about (Camera *camera, CameraText *about, GPContext *context)
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
get_info_func (CameraFilesystem *fs, const char *folder, const char *filename,
|
||||
CameraFileInfo *info, void *data, GPContext *context)
|
||||
{
|
||||
/* Camera *camera = data; */
|
||||
|
||||
/* Get the file info here and write it into <info> */
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
static int
|
||||
set_info_func (CameraFilesystem *fs, const char *folder, const char *file,
|
||||
CameraFileInfo info, void *data, GPContext *context)
|
||||
{
|
||||
/* Camera *camera = data; */
|
||||
|
||||
/* Set the file info here from <info> */
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
folder_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
void *data, GPContext *context)
|
||||
{
|
||||
/* Camera *camera = data; */
|
||||
|
||||
/* List your folders here */
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
void *data, GPContext *context)
|
||||
@@ -1020,6 +948,11 @@ file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list,
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
static CameraFilesystemFuncs fsfuncs = {
|
||||
.file_list_func = file_list_func,
|
||||
.get_file_func = get_file_func,
|
||||
};
|
||||
|
||||
int
|
||||
camera_init (Camera *camera, GPContext *context)
|
||||
{
|
||||
@@ -1039,15 +972,7 @@ camera_init (Camera *camera, GPContext *context)
|
||||
camera->functions->about = camera_about;
|
||||
|
||||
/* Now, tell the filesystem where to get lists, files and info */
|
||||
gp_filesystem_set_list_funcs (camera->fs, file_list_func,
|
||||
folder_list_func, camera);
|
||||
gp_filesystem_set_info_funcs (camera->fs, get_info_func, set_info_func,
|
||||
camera);
|
||||
gp_filesystem_set_file_funcs (camera->fs, get_file_func,
|
||||
delete_file_func, camera);
|
||||
gp_filesystem_set_folder_funcs (camera->fs, put_file_func,
|
||||
delete_all_func, NULL, NULL, camera);
|
||||
|
||||
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
|
||||
/*
|
||||
* The port is already provided with camera->port (and
|
||||
* already open). You just have to use functions like
|
||||
|
||||
Reference in New Issue
Block a user