Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #304 from eyelash/linux-delete-trash
Browse files Browse the repository at this point in the history
implement MoveFileOrDirectoryToTrash on Linux
  • Loading branch information
jasonsanjose committed Aug 23, 2013
2 parents e275dab + 2b54100 commit 6c28945
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion appshell/appshell_extensions_gtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,20 @@ int DeleteFileOrDirectory(ExtensionString filename)

void MoveFileOrDirectoryToTrash(ExtensionString filename, CefRefPtr<CefBrowser> browser, CefRefPtr<CefProcessMessage> response)
{
// TOdO
int error = NO_ERROR;
GFile *file = g_file_new_for_path(filename.c_str());
GError *gerror = NULL;
if (!g_file_trash(file, NULL, &gerror)) {
if (gerror->code == G_IO_ERROR_NOT_FOUND)
error = ERR_NOT_FOUND;
else
error = ERR_UNKNOWN;
g_error_free(gerror);
}
g_object_unref(file);

response->GetArgumentList()->SetInt(1, error);
browser->SendProcessMessage(PID_RENDERER, response);
}

void CloseWindow(CefRefPtr<CefBrowser> browser)
Expand Down

0 comments on commit 6c28945

Please sign in to comment.