00001 /* Copyright 2003 gnome-vfsmm Development Team 00002 * 00003 * This library is free software; you can redistribute it and/or 00004 * modify it under the terms of the GNU Library General Public 00005 * License as published by the Free Software Foundation; either 00006 * version 2 of the License, or (at your option) any later version. 00007 * 00008 * This library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Library General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Library General Public 00014 * License along with this library; if not, write to the Free 00015 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00016 */ 00017 00018 00019 #ifndef _LIBGNOMEVFSMM_TRANSFER_H 00020 #define _LIBGNOMEVFSMM_TRANSFER_H 00021 00022 #include <glibmm.h> 00023 00024 #include <libgnomevfsmm/enums.h> 00025 #include <libgnomevfsmm/exception.h> 00026 #include <libgnomevfsmm/uri.h> 00027 #include <libgnomevfsmm/transfer-progress.h> 00028 00029 #include <libgnomevfs/gnome-vfs-xfer.h> //For GnomeVFSXferProgressInfo 00030 00031 namespace Gnome 00032 { 00033 00034 namespace Vfs 00035 { 00036 00037 //TODO: Explain when/how someone might use this stuff. 00038 namespace Transfer 00039 { 00040 00041 typedef Glib::ListHandle<Glib::ustring> ListHandleStrings; 00042 typedef Glib::ListHandle< Glib::RefPtr<Uri> > ListHandleUris; 00043 00044 //typedef gint (* GnomeVFSXferProgressCallback) (GnomeVFSXferProgressInfo *info, 00045 // gpointer data); 00046 00047 00048 //TODO: Find out what the return value is meant to be for. 00050 typedef SigC::Slot1<bool, const ProgressInfo&> SlotProgress; 00051 00052 00053 /*** 00054 * @source_uri_list: A list of uris (ie file;//) 00055 * @target_uri_list: A List of uris 00056 * @options: These are options you wish to set for the transfer. For 00057 * instance by setting the xfer behavior you can either make a copy or a 00058 * move. 00059 * @error_mode: Decide how to behave if the xfer is interrupted. For instance 00060 * you could set your application to return an error code in case of an 00061 * interuption. 00062 * @overwrite_mode: How to react if a file your copying is being overwritten. 00063 * @progress_callback: This is used to monitor the progress of a transfer. 00064 * Common use would be to check to see if the transfer is asking for permission 00065 * to overwrite a file. 00066 * 00067 * This function will transfer multiple files to multiple targets. Given a 00068 * a source uri(s) and a destination uri(s). There are a list of options that 00069 * your application can use to control how the transfer is done. 00070 * 00071 **/ 00072 /* //TOOD: Temporarily commented-out to avoid ambiguity. 00073 void transfer(const ListHandleUris& source_uri_list, const ListHandleUris& target_uri_list, 00074 TransferOptions options = XFER_DEFAULT, //TODO: Does Default do anything useful? 00075 ErrorMode error_mode = XFER_ERROR_MODE_ABORT, 00076 OverwriteMode overwrite_mode = XFER_OVERWRITE_MODE_ABORT, 00077 const SlotProgress& progress_callback = SlotProgress()); 00078 */ 00079 00080 void transfer(const Glib::RefPtr<const Uri>& source_uri, const Glib::RefPtr<const Uri>& target_uri, 00081 TransferOptions options = XFER_DEFAULT, //TODO: Does Default do anything useful? 00082 ErrorMode error_mode = XFER_ERROR_MODE_ABORT, 00083 OverwriteMode overwrite_mode = XFER_OVERWRITE_MODE_ABORT, 00084 const SlotProgress& progress_callback = SlotProgress()); 00085 00086 //TODO: Add a string-based version of gnome_vfs_xfer_delete() to gnome-vfs. 00087 //TODO: Add string-based convenience versions of these methods. 00088 00089 void remove(const Glib::RefPtr<const Uri>& source_uri, 00090 TransferOptions options = XFER_DEFAULT, 00091 ErrorMode error_mode = XFER_ERROR_MODE_ABORT, 00092 const SlotProgress& progress_callback = SlotProgress()); 00093 00094 void remove(const ListHandleUris& source_uri_list, 00095 TransferOptions options = XFER_DEFAULT, 00096 ErrorMode error_mode = XFER_ERROR_MODE_ABORT, 00097 const SlotProgress& progress_callback = SlotProgress()); 00098 00099 } // namespace Transfer 00100 } // namespace Vfs 00101 } // namespace Gnome 00102 00103 #endif /* _LIBGNOMEVFSMM_TRANSFER_H */