This commit is contained in:
Kovid Goyal 2010-04-26 16:58:56 -06:00
parent 99f4004aa2
commit df1dd67cd1
2 changed files with 24 additions and 1 deletions

View File

@ -25,6 +25,7 @@
#include <stdio.h> #include <stdio.h>
#include <CoreFoundation/CFNumber.h> #include <CoreFoundation/CFNumber.h>
#include <CoreServices/CoreServices.h>
#include <IOKit/usb/IOUSBLib.h> #include <IOKit/usb/IOUSBLib.h>
#include <IOKit/IOCFPlugIn.h> #include <IOKit/IOCFPlugIn.h>
#include <IOKit/IOKitLib.h> #include <IOKit/IOKitLib.h>
@ -52,6 +53,28 @@
#define NUKE(x) Py_XDECREF(x); x = NULL; #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* static PyObject*
usbobserver_get_iokit_string_property(io_service_t dev, CFStringRef prop) { usbobserver_get_iokit_string_property(io_service_t dev, CFStringRef prop) {
CFTypeRef PropRef; CFTypeRef PropRef;

View File

@ -1684,7 +1684,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
src_ids.append(id_) src_ids.append(id_)
dbfmts = m.db.formats(id_, index_is_id=True) dbfmts = m.db.formats(id_, index_is_id=True)
if dbfmts: if dbfmts:
for fmt in dbfmts: for fmt in dbfmts.split(','):
src_books.append(m.db.format_abspath(id_, fmt, src_books.append(m.db.format_abspath(id_, fmt,
index_is_id=True)) index_is_id=True))
return [dest_id, src_books, src_ids] return [dest_id, src_books, src_ids]