From df1dd67cd19176b354e271214bab369eb1716d5e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 26 Apr 2010 16:58:56 -0600 Subject: [PATCH] ... --- src/calibre/devices/usbobserver/usbobserver.c | 23 +++++++++++++++++++ src/calibre/gui2/ui.py | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/calibre/devices/usbobserver/usbobserver.c b/src/calibre/devices/usbobserver/usbobserver.c index b58e7416cd..4b9b39d473 100644 --- a/src/calibre/devices/usbobserver/usbobserver.c +++ b/src/calibre/devices/usbobserver/usbobserver.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -52,6 +53,28 @@ #define NUKE(x) Py_XDECREF(x); x = NULL; +/* This function only works on 10.5 and later +static PyObject* send2trash(PyObject *self, PyObject *args) +{ + UInt8 *utf8_chars; + FSRef fp; + OSStatus op_result; + + if (!PyArg_ParseTuple(args, "es", "utf-8", &utf8_chars)) { + return NULL; + } + + FSPathMakeRefWithOptions(utf8_chars, kFSPathMakeRefDoNotFollowLeafSymlink, &fp, NULL); + op_result = FSMoveObjectToTrashSync(&fp, NULL, kFSFileOperationDefaultOptions); + PyMem_Free(utf8_chars); + if (op_result != noErr) { + PyErr_SetString(PyExc_OSError, GetMacOSStatusCommentString(op_result)); + return NULL; + } + Py_RETURN_NONE; +} +*/ + static PyObject* usbobserver_get_iokit_string_property(io_service_t dev, CFStringRef prop) { CFTypeRef PropRef; diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 0bb2c32294..1acfbd7840 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -1684,7 +1684,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): src_ids.append(id_) dbfmts = m.db.formats(id_, index_is_id=True) if dbfmts: - for fmt in dbfmts: + for fmt in dbfmts.split(','): src_books.append(m.db.format_abspath(id_, fmt, index_is_id=True)) return [dest_id, src_books, src_ids]