File Manager / inc / model /

fs-operation.h

  1. /*
  2. * Copyright 2014 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17.  
  18. #ifndef _FS_OPERATION_H_
  19. #define _FS_OPERATION_H_
  20.  
  21. #include "model/fs-manager.h"
  22. #include "utils/app-types.h"
  23.  
  24. #include <Eina.h>
  25.  
  26. /* Forward declaration: */
  27. typedef struct _fs_operation fs_operation;
  28.  
  29. /**
  30. * @brief File system operation callback data
  31. */
  32. typedef struct _fs_operation_cb_data {
  33. struct _fs_manager *manager; /**< file system manager structure pointer */
  34. int result; /**< result of operation */
  35. } fs_operation_cb_data;
  36.  
  37. /**
  38. * @brief Prototype of file system operation complete callback function
  39. */
  40. typedef void (*fs_operation_cb_func)(void *data);
  41.  
  42. /**
  43. * @brief Create file system operation instance
  44. * @return File system operation instance on success, otherwise NULL
  45. */
  46. fs_operation *fs_operation_create();
  47.  
  48. /**
  49. * @brief Destroy file system operation instance
  50. * @param[in] operation File system operation instance
  51. */
  52. void fs_operation_destroy(fs_operation *operation);
  53.  
  54. /**
  55. * @brief Set data to file system operation
  56. * @param[in] operation File system operation instance
  57. * @param[in] file_list List of files to process
  58. * @param[in] dst_path Path to dir to copy/move files
  59. * @param[in] operation Type of operation to perform
  60. * @return Error code. RESULT_TYPE_OK if operation success.
  61. */
  62. int fs_operation_set_data(fs_operation *operation,
  63. Eina_List *file_list,
  64. const char *dst_path,
  65. operation_type type);
  66.  
  67. /**
  68. * @brief Execute file system operation
  69. * @remark Operation will be executed asynchronously.
  70. * @remark On operation complete callback function will be called.
  71. * @param[in] operation File system operation instance
  72. * @param[in] cb_func Callback function to notify when operation is complete
  73. * @param[in] cb_data Callback function data
  74. * @return Error code. RESULT_TYPE_OK if operation success.
  75. */
  76. int fs_operation_execute(fs_operation *operation,
  77. fs_operation_cb_func cb_func,
  78. fs_operation_cb_data *cb_data);
  79.  
  80. #endif /* _FS_OPERATION_H_ */