Efreet_Trash: The XDG Trash Specification

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Functions
Efreet_Trash: The XDG Trash Specification
Efreet

Efreet_Trash.h provides all of the necessary headers and includes to work with Efreet_Trash. More...

## Functions
EAPI int | efreet_trash_init (void)
| Initializes the efreet trash system.
EAPI int | efreet_trash_shutdown (void)
| Cleans up the efreet trash system.
EAPI const char * | efreet_trash_dir_get (const char *for_file)
| Retrieves the XDG Trash local directory.
EAPI int | efreet_trash_delete_uri (Efreet_Uri *uri, int force_delete)
| This function try to move the given uri to the trash. Files on different filesystem can't be moved to trash. If force_delete is `0` than non-local files will be ignored and `-1` is returned, if you set force_delete to `1` non-local files will be deleted without asking.
EAPI Eina_List * | efreet_trash_ls (void)
| List all the files and directory currently inside the trash.
EAPI int | efreet_trash_is_empty (void)
| Check if the trash is currently empty.
EAPI int | efreet_trash_empty_trash (void)
| Delete all the files inside the trash.

## Detailed Description

Efreet_Trash.h provides all of the necessary headers and includes to work with Efreet_Trash.

## Function Documentation

## ◆ efreet_trash_init()

EAPI int efreet_trash_init | ( | void |  | ) |

Initializes the efreet trash system.

Returns
  `1` on success or `0` on failure.

Referenced by elm_need_efreet().

## ◆ efreet_trash_shutdown()

EAPI int efreet_trash_shutdown | ( | void |  | ) |

Cleans up the efreet trash system.

Returns
  No value.

## ◆ efreet_trash_dir_get()

EAPI const char * efreet_trash_dir_get | ( | const char * | for_file | ) |

Retrieves the XDG Trash local directory.

Returns
  The XDG Trash local directory or `NULL` on errors. Return value must be freed with eina_stringshare_del.

References ecore_file_exists(), ecore_file_mkpath(), efreet_data_home_get(), eina_stringshare_add(), eina_stringshare_del(), and eina_stringshare_ref().

Referenced by efreet_trash_delete_uri(), efreet_trash_empty_trash(), efreet_trash_is_empty(), and efreet_trash_ls().

## ◆ efreet_trash_delete_uri()

EAPI int efreet_trash_delete_uri | ( | Efreet_Uri * | uri,
|  | int | force_delete
| ) |  |

This function try to move the given uri to the trash. Files on different filesystem can't be moved to trash. If force_delete is `0` than non-local files will be ignored and `-1` is returned, if you set force_delete to `1` non-local files will be deleted without asking.

Parameters

  uri | The local uri to move in the trash
  force_delete | If you set this to `1` than files on different filesystems will be deleted permanently

Returns
  `1` on success, `0` on failure or `-1` in case the uri is not on the same filesystem and force_delete is not set.

References ecore_file_can_write(), ecore_file_exists(), ecore_file_file_get(), ecore_file_recursive_rm(), efreet_trash_dir_get(), efreet_uri_encode(), EINA_SAFETY_ON_FALSE_RETURN_VAL, EINA_SAFETY_ON_NULL_RETURN_VAL, eina_stringshare_del(), and Efreet_Uri::path.

## ◆ efreet_trash_ls()

EAPI Eina_List * efreet_trash_ls | ( | void |  | ) |

List all the files and directory currently inside the trash.

Returns
  A list of strings with filename (remember to free the list when you don't need anymore).

References ecore_file_ls(), efreet_trash_dir_get(), EINA_LIST_FOREACH, eina_log_domain_level_check(), and EINA_LOG_LEVEL_INFO.

## ◆ efreet_trash_is_empty()

EAPI int efreet_trash_is_empty | ( | void |  | ) |

Check if the trash is currently empty.

Returns
  `1` if the trash is empty or `0` if some file are in.

References ecore_file_dir_is_empty(), and efreet_trash_dir_get().

## ◆ efreet_trash_empty_trash()

EAPI int efreet_trash_empty_trash | ( | void |  | ) |

Delete all the files inside the trash.

Returns
  `1` on success or `0` on failure.

References ecore_file_mkdir(), ecore_file_recursive_rm(), and efreet_trash_dir_get().