logo top
Main Page   Widgets   glibmm Namespaces   Book  

Gio::File Class Reference

File and directory handling. More...

Inheritance diagram for Gio::File:

Inheritance graph
[legend]
List of all members.

Public Types

typedef sigc::slot< void,
goffset, goffset > 
SlotFileProgress
 A signal handler would be, for instance: void on_file_progress(goffset current_num_bytes, goffset total_num_bytes);.
typedef sigc::slot< bool,
const char*, goffset > 
SlotReadMore
 A signal handler would be, for instance: bool on_read_more(const char* file_contents, goffset file_size);.

Public Member Functions

virtual ~File ()
GFile* gobj ()
 Provides access to the underlying C GObject.
const GFile* gobj () const
 Provides access to the underlying C GObject.
Glib::RefPtr<Filedup () const
 Duplicates a File handle.
guint hash () const
 Creates a hash value for a File.
bool equal (const Glib::RefPtr<File>& other) const
 Checks equality of two given File<!-- -->s.
std::string get_basename () const
 Gets the basename (the last component of the path) for a given File.
std::string get_path () const
 Gets the local pathname for File, if one exists.
std::string get_uri () const
 Gets the URI for the file.
Glib::ustring get_parse_name () const
 Gets the parse name of the file.
Glib::RefPtr<Fileget_parent () const
 Gets the parent directory for the file.
Glib::RefPtr<Fileget_child (const std::string& name) const
 Gets a specific child of file with name equal to name.
Glib::RefPtr<Fileget_child_for_display_name (const Glib::ustring& display_name) const
 Gets the child of file for a given display_name (i.e. a UTF8 version of the name).
bool contains_file (const Glib::RefPtr<File>& descendant) const
 Checks whether parent (recursively) contains the specified descendent.
std::string get_relative_path (const Glib::RefPtr<File>& descendant) const
 Gets the path for descendant relative to parent.
Glib::RefPtr<Fileresolve_relative_path (const std::string& relative_path) const
 Resolves a relative path for file to an absolute path.
bool is_native () const
 Checks to see if a file is native to the platform.
bool has_uri_scheme (const std::string& uri_scheme) const
 Checks to see if a File has a given URI scheme.
std::string get_uri_scheme () const
 Gets the URI scheme for a File.
Glib::RefPtr<FileInputStreamread (const Glib::RefPtr<Cancellable>& cancellable)
 Opens a file for reading.
Glib::RefPtr<FileInputStreamread ()
 Opens a file for reading.
void read_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority=Glib::PRIORITY_DEFAULT)
 Asynchronously opens the file for reading.
void read_async (const SlotAsyncReady& slot, int io_priority=Glib::PRIORITY_DEFAULT)
 Asynchronously opens the file for reading.
Glib::RefPtr<FileInputStreamread_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes an asynchronous file read operation started with g_file_read_async().
Glib::RefPtr<FileOutputStreamappend_to (const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags=FILE_CREATE_NONE)
 Gets an output stream for appending data to the file.
Glib::RefPtr<FileOutputStreamappend_to (FileCreateFlags flags=FILE_CREATE_NONE)
 Gets an output stream for appending data to the file.
Glib::RefPtr<FileOutputStreamcreate_file (const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags=FILE_CREATE_NONE)
 Creates a new file and returns an output stream for writing to it.
Glib::RefPtr<FileOutputStreamcreate_file (FileCreateFlags flags=FILE_CREATE_NONE)
 Creates a new file and returns an output stream for writing to it.
Glib::RefPtr<FileOutputStreamreplace (const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag=std::string(), bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE)
 Returns an output stream for overwriting the file, possibly creating a backup copy of the file first.
Glib::RefPtr<FileOutputStreamreplace (const std::string& etag=std::string(), bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE)
 Returns an output stream for overwriting the file, possibly creating a backup copy of the file first.
void append_to_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags=FILE_CREATE_NONE, int io_priority=Glib::PRIORITY_DEFAULT)
 Asynchronously opens the file for appending.
void append_to_async (const SlotAsyncReady& slot, FileCreateFlags flags=FILE_CREATE_NONE, int io_priority=Glib::PRIORITY_DEFAULT)
 Asynchronously opens the file for appending.
Glib::RefPtr<FileOutputStreamappend_to_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes an asynchronous file append operation started with g_file_append_to_async().
void create_file_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags=FILE_CREATE_NONE, int io_priority=Glib::PRIORITY_DEFAULT)
 Asynchronously creates a new file and returns an output stream for writing to it.
void create_file_async (const SlotAsyncReady& slot, FileCreateFlags flags=FILE_CREATE_NONE, int io_priority=Glib::PRIORITY_DEFAULT)
 Asynchronously creates a new file and returns an output stream for writing to it.
Glib::RefPtr<FileOutputStreamcreate_file_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes an asynchronous file create operation started with g_file_create_async().
void replace_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag=std::string(), bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE, int io_priority=Glib::PRIORITY_DEFAULT)
 Asyncronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first.
void replace_async (const SlotAsyncReady& slot, const std::string& etag=std::string(), bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE, int io_priority=Glib::PRIORITY_DEFAULT)
 Asyncronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first.
Glib::RefPtr<FileOutputStreamreplace_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes an asynchronous file replace operation started with g_file_replace_async().
Glib::RefPtr<FileInfoquery_info (const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE) const
 Gets the requested information about the file.
Glib::RefPtr<FileInfoquery_info (const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE) const
 Gets the requested information about the file.
bool query_exists (const Glib::RefPtr<Cancellable>& cancellable) const
bool query_exists () const
 Utility function to check if a particular file exists.
void query_info_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE, int io_priority=Glib::PRIORITY_DEFAULT) const
 Asynchronously gets the requested information about specified file.
void query_info_async (const SlotAsyncReady& slot, const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE, int io_priority=Glib::PRIORITY_DEFAULT) const
 Asynchronously gets the requested information about specified file.
Glib::RefPtr<FileInfoquery_info_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes an asynchronous file info query.
Glib::RefPtr<FileInfoquery_filesystem_info (const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes="*")
 Similar to query_info(), but obtains information about the filesystem the file is on, rather than the file itself.
Glib::RefPtr<FileInfoquery_filesystem_info (const std::string& attributes="*")
 Similar to query_info(), but obtains information about the filesystem the file is on, rather than the file itself.
Glib::RefPtr<Mountfind_enclosing_mount (const Glib::RefPtr<Cancellable>& cancellable)
 Gets a Mount for the File.
Glib::RefPtr<Mountfind_enclosing_mount ()
 Gets a Mount for the File.
void find_enclosing_mount_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority=Glib::PRIORITY_DEFAULT)
 Asynchronously gets the mount for the file.
void find_enclosing_mount_async (const SlotAsyncReady& slot, int io_priority=Glib::PRIORITY_DEFAULT)
 Asynchronously gets the mount for the file.
Glib::RefPtr<Mountfind_enclosing_mount_finish (const Glib::RefPtr<AsyncResult>& result)
Glib::RefPtr<FileEnumeratorenumerate_children (const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE)
 Gets the requested information about the files in a directory.
Glib::RefPtr<FileEnumeratorenumerate_children (const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE)
 Gets the requested information about the files in a directory.
void enumerate_children_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE, int io_priority=Glib::PRIORITY_DEFAULT)
 Asynchronously gets the requested information about the files in a directory.
void enumerate_children_async (const SlotAsyncReady& slot, const std::string& attributes="*", FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE, int io_priority=Glib::PRIORITY_DEFAULT)
 Asynchronously gets the requested information about the files in a directory.
Glib::RefPtr<FileEnumeratorenumerate_children_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes an async enumerate children operation.
Glib::RefPtr<Fileset_display_name (const Glib::ustring& display_name, const Glib::RefPtr<Cancellable>& cancellable)
 Renames file to the specified display name.
Glib::RefPtr<Fileset_display_name (const Glib::ustring& display_name)
 Renames the file to the specified display name.
void set_display_name_async (const Glib::ustring& display_name, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority=Glib::PRIORITY_DEFAULT)
 Asynchronously sets the display name for a given Gio::File.
void set_display_name_async (const Glib::ustring& display_name, const SlotAsyncReady& slot, int io_priority=Glib::PRIORITY_DEFAULT)
 Asynchronously sets the display name for a given Gio::File.
Glib::RefPtr<Fileset_display_name_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes setting a display name started with g_file_set_display_name_async().
bool remove (const Glib::RefPtr<Cancellable>& cancellable)
 Deletes a file.
bool remove ()
 Deletes a file.
bool trash (const Glib::RefPtr<Cancellable>& cancellable)
 Sends file to the "Trashcan", if possible.
bool trash ()
 Sends the file to the "Trashcan", if possible.
bool copy (const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags=FILE_COPY_NONE)
 Copies the file source to the location specified by destination.
bool copy (const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags=FILE_COPY_NONE)
bool copy (const Glib::RefPtr<File>& destination, FileCopyFlags flags=FILE_COPY_NONE)
void copy_async (const Glib::RefPtr<File>& destination, const SlotFileProgress& slot_progress, const SlotAsyncReady& slot_ready, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags=FILE_COPY_NONE, int io_priority=Glib::PRIORITY_DEFAULT)
 Copies the file to the location specified by asynchronously.
void copy_async (const Glib::RefPtr<File>& destination, const SlotAsyncReady& slot_ready, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags=FILE_COPY_NONE, int io_priority=Glib::PRIORITY_DEFAULT)
 Copies the file to the location specified by asynchronously.
void copy_async (const Glib::RefPtr<File>& destination, const SlotFileProgress& slot_progress, const SlotAsyncReady& slot_ready, FileCopyFlags flags=FILE_COPY_NONE, int io_priority=Glib::PRIORITY_DEFAULT)
 Copies the file to the location specified by asynchronously.
void copy_async (const Glib::RefPtr<File>& destination, const SlotAsyncReady& slot_ready, FileCopyFlags flags=FILE_COPY_NONE, int io_priority=Glib::PRIORITY_DEFAULT)
 Copies the file to the location specified by asynchronously.
bool copy_finish (const Glib::RefPtr<AsyncResult>& result)
bool move (const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags=FILE_COPY_NONE)
 Tries to move the file or directory source to the location specified by destination.
bool move (const Glib::RefPtr<File>& destination, const SlotFileProgress& slot, FileCopyFlags flags=FILE_COPY_NONE)
bool move (const Glib::RefPtr<File>& destination, FileCopyFlags flags=FILE_COPY_NONE)
bool make_directory (const Glib::RefPtr<Cancellable>& cancellable)
 Creates a directory.
bool make_directory ()
 Creates a directory.
bool make_symbolic_link (const std::string& symlink_value, const Glib::RefPtr<Cancellable>& cancellable)
 Creates a symbolic link.
bool make_symbolic_link (const std::string& symlink_value)
 Creates a symbolic link.
Glib::RefPtr<FileAttributeInfoListquery_settable_attributes (const Glib::RefPtr<Cancellable>& cancellable)
 Obtain the list of settable attributes for the file.
Glib::RefPtr<FileAttributeInfoListquery_settable_attributes ()
 Obtain the list of settable attributes for the file.
Glib::RefPtr<FileAttributeInfoListquery_writable_namespaces (const Glib::RefPtr<Cancellable>& cancellable)
 Obtain the list of attribute namespaces where new attributes can be created by a user.
Glib::RefPtr<FileAttributeInfoListquery_writable_namespaces ()
 Obtain the list of attribute namespaces where new attributes can be created by a user.
bool set_attributes_from_info (const Glib::RefPtr<FileInfo>& info, const Glib::RefPtr<Cancellable>& cancellable, FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE)
 Tries to set all attributes in the FileInfo on the target values, not stopping on the first error.
bool set_attributes_from_info (const Glib::RefPtr<FileInfo>& info, FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE)
 Tries to set all attributes in the FileInfo on the target values, not stopping on the first error.
void set_attributes_async (const Glib::RefPtr<FileInfo>& info, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE, int io_priority=Glib::PRIORITY_DEFAULT)
 Asynchronously sets the attributes of file with info.
void set_attributes_async (const Glib::RefPtr<FileInfo>& info, const SlotAsyncReady& slot, FileQueryInfoFlags flags=FILE_QUERY_INFO_NONE, int io_priority=Glib::PRIORITY_DEFAULT)
 Asynchronously sets the attributes of file with info.
bool set_attributes_finish (const Glib::RefPtr<AsyncResult>& result, const Glib::RefPtr<FileInfo>& info)
bool set_attribute_string (const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable)
 Sets attribute of type FILE_ATTRIBUTE_TYPE_STRING to value.
bool set_attribute_string (const std::string& attribute, const std::string& value, FileQueryInfoFlags flags)
 Sets attribute of type FILE_ATTRIBUTE_TYPE_STRING to value.
bool set_attribute_byte_string (const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable)
 Sets attribute of type FILE_ATTRIBUTE_TYPE_BYTE_STRING to value.
bool set_attribute_byte_string (const std::string& attribute, const std::string& value, FileQueryInfoFlags flags)
 Sets attribute of type FILE_ATTRIBUTE_TYPE_BYTE_STRING to value.
bool set_attribute_uint32 (const std::string& attribute, guint32 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable)
 Sets attribute of type FILE_ATTRIBUTE_TYPE_UINT32 to value.
bool set_attribute_uint32 (const std::string& attribute, guint32 value, FileQueryInfoFlags flags)
 Sets attribute of type FILE_ATTRIBUTE_TYPE_UINT32 to value.
bool set_attribute_int32 (const std::string& attribute, gint32 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable)
 Sets attribute of type FILE_ATTRIBUTE_TYPE_INT32 to value.
bool set_attribute_int32 (const std::string& attribute, gint32 value, FileQueryInfoFlags flags)
 Sets attribute of type FILE_ATTRIBUTE_TYPE_INT32 to value.
bool set_attribute_uint64 (const std::string& attribute, guint64 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable)
 Sets attribute of type FILE_ATTRIBUTE_TYPE_UINT64 to value.
bool set_attribute_uint64 (const std::string& attribute, guint64 value, FileQueryInfoFlags flags)
 Sets attribute of type FILE_ATTRIBUTE_TYPE_UINT64 to value.
bool set_attribute_int64 (const std::string& attribute, gint64 value, FileQueryInfoFlags flags, const Glib::RefPtr<Cancellable>& cancellable)
 Sets attribute of type FILE_ATTRIBUTE_TYPE_INT64 to value.
bool set_attribute_int64 (const std::string& attribute, gint64 value, FileQueryInfoFlags flags)
 Sets attribute of type FILE_ATTRIBUTE_TYPE_INT64 to value.
void mount_enclosing_volume (const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
 Starts a , mounting the volume that contains the file.
void mount_enclosing_volume (const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot)
 Starts a , mounting the volume that contains the file.
void mount_enclosing_volume (const SlotAsyncReady& slot)
 Starts a , mounting the volume that contains the file.
void mount_enclosing_volume ()
 Starts a , mounting the volume that contains the file.
bool mount_enclosing_volume_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes a mount operation started by g_file_mount_enclosing_volume().
void mount_mountable (const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
 Mounts a file of type FILE_TYPE_MOUNTABLE.
void mount_mountable (const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot)
 Mounts a file of type FILE_TYPE_MOUNTABLE.
void mount_mountable (const SlotAsyncReady& slot)
 Mounts a file of type FILE_TYPE_MOUNTABLE without user interaction.
void mount_mountable ()
 Mounts a file of type FILE_TYPE_MOUNTABLE without user interaction.
Glib::RefPtr<Filemount_mountable_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes a mount operation.
void unmount_mountable (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
 Unmounts a file of type FILE_TYPE_MOUNTABLE.
void unmount_mountable (const SlotAsyncReady& slot, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
 Unmounts a file of type FILE_TYPE_MOUNTABLE.
void unmount_mountable (MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
 Unmounts a file of type FILE_TYPE_MOUNTABLE.
bool unmount_mountable_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes an unmount operation, see g_file_unmount_mountable() for details.
void eject_mountable (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
 Starts an asynchronous eject on a mountable.
void eject_mountable (const SlotAsyncReady& slot, MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
 Starts an asynchronous eject on a mountable.
void eject_mountable (MountUnmountFlags flags=MOUNT_UNMOUNT_NONE)
 Starts an asynchronous eject on a mountable.
bool eject_mountable_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes an asynchronous eject operation started by g_file_eject_mountable().
bool copy_attributes (const Glib::RefPtr<File>& destination, const Glib::RefPtr<Cancellable>& cancellable, FileCopyFlags flags=FILE_COPY_NONE)
 Copies the file attributes from to .
bool copy_attributes (const Glib::RefPtr<File>& destination, FileCopyFlags flags=FILE_COPY_NONE)
 Copies the file attributes from to .
Glib::RefPtr<FileMonitormonitor_directory (const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags=FILE_MONITOR_NONE)
 Obtains a directory monitor for the given file.
Glib::RefPtr<FileMonitormonitor_directory (FileMonitorFlags flags=FILE_MONITOR_NONE)
 Obtains a directory monitor for the given file.
Glib::RefPtr<FileMonitormonitor_file (const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags=FILE_MONITOR_NONE)
 Obtains a file monitor for the given file.
Glib::RefPtr<FileMonitormonitor_file (FileMonitorFlags flags=FILE_MONITOR_NONE)
 Obtains a file monitor for the given file.
Glib::RefPtr<AppInfoquery_default_handler (const Glib::RefPtr<Cancellable>& cancellable)
Glib::RefPtr<AppInfoquery_default_handler ()
 Returns the AppInfo that is registered as the default application to handle the file specified by the file.
bool load_contents (const Glib::RefPtr<Cancellable>& cancellable, char** contents, gsize& length, char** etag_out)
 Loads the content of the file into memory, returning the size of the data.
void load_contents_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
 Starts an asynchronous load of the file's contents.
void load_contents_async (const SlotAsyncReady& slot)
 Starts an asynchronous load of the file's contents.
bool load_contents_finish (const Glib::RefPtr<AsyncResult>& result, char** contents, gsize& length, char** etag_out)
 Finishes an asynchronous load of the file's contents.
void load_partial_contents_async (const SlotReadMore& slot_read_more, const SlotAsyncReady& slot_async_ready, const Glib::RefPtr<Cancellable>& cancellable)
 Reads the partial contents of a file.
void load_partial_contents_async (const SlotReadMore& slot_read_more, const SlotAsyncReady& slot_async_ready)
 Reads the partial contents of a file.
bool load_partial_contents_finish (const Glib::RefPtr<AsyncResult>& result, char** contents, gsize& length, char** etag_out)
 Finishes an asynchronous partial load operation that was started with g_file_load_partial_contents_async().
void replace_contents (const char* contents, gsize length, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE)
 Replaces the contents of the file with contents of length bytes.
void replace_contents (const char* contents, gsize length, const std::string& etag, std::string& new_etag, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE)
 Replaces the contents of the file with contents of length bytes.
void replace_contents (const std::string& contents, const std::string& etag, std::string& new_etag, const Glib::RefPtr<Cancellable>& cancellable, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE)
 Replaces the contents of the file with contents.
void replace_contents (const std::string& contents, const std::string& etag, std::string& new_etag, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE)
 Replaces the contents of the file with contents.
void replace_contents_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const char* contents, gsize length, const std::string& etag, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE)
 Starts an asynchronous replacement of the file with the given of bytes.
void replace_contents_async (const SlotAsyncReady& slot, const char* contents, gsize length, const std::string& etag, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE)
 Starts an asynchronous replacement of the file with the given of bytes.
void replace_contents_async (const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& contents, const std::string& etag, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE)
 Starts an asynchronous replacement of the file with the given of bytes.
void replace_contents_async (const SlotAsyncReady& slot, const std::string& contents, const std::string& etag, bool make_backup=false, FileCreateFlags flags=FILE_CREATE_NONE)
 Starts an asynchronous replacement of the file with the given contents.
void replace_contents_finish (const Glib::RefPtr<AsyncResult>& result, std::string& etag)
 Finishes an asynchronous replace of the given file .
void replace_contents_finish (const Glib::RefPtr<AsyncResult>& result)
 Finishes an asynchronous replace of the given file .
virtual Glib::RefPtr<Filedup_vfunc ()
virtual guint hash_vfunc () const
virtual std::string get_basename_vfunc () const
virtual std::string get_path_vfunc () const
virtual std::string get_uri_vfunc () const
virtual std::string get_parse_name_vfunc () const
virtual bool contains_file_vfunc (const Glib::RefPtr<File>& descendant) const
virtual std::string get_relative_path_vfunc (const Glib::RefPtr<File>& descendant) const
virtual bool is_native_vfunc () const
virtual bool has_uri_scheme_vfunc (const std::string& uri_scheme) const

Static Public Member Functions

static void add_interface (GType gtype_implementer)
static Glib::RefPtr<Filecreate_for_path (const std::string& path)
 Constructs a File for a given path.
static Glib::RefPtr<Filecreate_for_uri (const std::string& uri)
 Constructs a File for a given URI.
static Glib::RefPtr<Filecreate_for_commandline_arg (const std::string& arg)
 Constructs a File for a given argument from the command line.
static Glib::RefPtr<Filecreate_for_parse_name (const Glib::ustring& parse_name)

Related Functions

(Note that these are not member functions.)

Glib::RefPtr<Gio::Filewrap (GFile* object, bool take_copy=false)
 A Glib::wrap() method for this object.

Detailed Description

File and directory handling.

Gio::File is a high level abstraction for manipulating files on a virtual file system. Gio::Files are lightweight, immutable objects that do no I/O upon creation. It is necessary to understand that a Gio::File object does not represent a file, merely a handle to a file. All file I/O is implemented as streaming operations (see Gio::InputStream and Gio::OutputStream).

A GioFile can be constructed from a path, URI, or a command line argument.

You can move through the filesystem with Gio::File handles with get_parent() to get a handle to the parent directory, get_child() to get a handle to a child within a directory, and resolve_relative_path() to resolve a relative path between two Gio::Files.

Many Gio::File operations have both synchronous and asynchronous versions to suit your application. Asynchronous versions of synchronous functions simply have _async() appended to their function names. The asynchronous I/O functions call a SlotAsyncReady callback slot which is then used to finalize the operation, producing a AsyncResult which is then passed to the function's matching _finish() operation.

Some Gio::File operations do not have synchronous analogs, as they may take a very long time to finish, and blocking may leave an application unusable. Notable cases include: mount_mountable() to mount a mountable file, unmount_mountable() to unmount a mountable file, and eject_mountable() to eject a mountable file.

One notable feature of Gio::Files are entity tags, or "etags" for short. Entity tags are somewhat like a more abstract version of the traditional mtime, and can be used to quickly determine if the file has been modified from the version on the file system. See the HTTP 1.1 specification for HTTP Etag headers, which are a very similar concept.

Since glibmm 2.16:


Member Typedef Documentation

typedef sigc::slot<void, goffset, goffset> Gio::File::SlotFileProgress

A signal handler would be, for instance: void on_file_progress(goffset current_num_bytes, goffset total_num_bytes);.

typedef sigc::slot<bool, const char*, goffset> Gio::File::SlotReadMore

A signal handler would be, for instance: bool on_read_more(const char* file_contents, goffset file_size);.


Constructor & Destructor Documentation

virtual Gio::File::~File (  )  [virtual]


Member Function Documentation

static void Gio::File::add_interface ( GType  gtype_implementer  )  [static]

GFile* Gio::File::gobj (  )  [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::Interface.

const GFile* Gio::File::gobj (  )  const [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::Interface.

static Glib::RefPtr<File> Gio::File::create_for_path ( const std::string path  )  [static]

Constructs a File for a given path.

This operation never fails, but the returned object might not support any I/O operation if path is malformed.

Parameters:
path A string containing a relative or absolute path.
Returns:
A new instantiation of an appropriate Gio::File class.

static Glib::RefPtr<File> Gio::File::create_for_uri ( const std::string uri  )  [static]

Constructs a File for a given URI.

This operation never fails, but the returned object might not support any I/O operation if path is malformed.

Parameters:
uri A string containing a URI.
Returns:
A new instantiation of an appropriate Gio::File class.

static Glib::RefPtr<File> Gio::File::create_for_commandline_arg ( const std::string arg  )  [static]

Constructs a File for a given argument from the command line.

The value of arg can be either a URI, an absolute path or a relative path resolved relative to the current working directory. This operation never fails, but the returned object might not support any I/O operation if arg points to a malformed path.

Parameters:
arg A string containing a relative or absolute path.
Returns:
A new instantiation of an appropriate Gio::File class.

static Glib::RefPtr<File> Gio::File::create_for_parse_name ( const Glib::ustring parse_name  )  [static]

Glib::RefPtr<File> Gio::File::dup (  )  const

Duplicates a File handle.

This operation does not duplicate the actual file or directory represented by the File; see g_file_copy() if attempting to copy a file.

This call does no blocking i/o.

Returns:
File that is a duplicate of the given File.

guint Gio::File::hash (  )  const

Creates a hash value for a File.

This call does no blocking i/o.

Parameters:
file gconstpointer to a File.
Returns:
0 if file is not a valid File, otherwise an integer that can be used as hash value for the File. This function is intended for easily hashing a File to add to a HashTable or similar data structure.

bool Gio::File::equal ( const Glib::RefPtr<File>&  other  )  const

Checks equality of two given File<!-- -->s.

This call does no blocking i/o.

Parameters:
file2 The second File.
Returns:
true if file1 and file2 are equal. false if either is not a File.

std::string Gio::File::get_basename (  )  const

Gets the basename (the last component of the path) for a given File.

If called for the toplevel of a system (such as the filesystem root or a uri like sftp://host/ it will return a single directory separator (and on Windows, possibly a drive letter).

This call does no blocking i/o.

Returns:
String containing the File's base name, or 0 if given File is invalid. The returned string should be freed with Glib::free() when no longer needed.

std::string Gio::File::get_path (  )  const

Gets the local pathname for File, if one exists.

This call does no blocking i/o.

Returns:
String containing the File's path, or 0 if no such path exists. The returned string should be freed with Glib::free() when no longer needed.

std::string Gio::File::get_uri (  )  const

Gets the URI for the file.

This call does no blocking i/o.

Returns:
A string containing the File's URI. The returned string should be freed with Glib::free() when no longer needed.

Glib::ustring Gio::File::get_parse_name (  )  const

Gets the parse name of the file.

A parse name is a UTF-8 string that describes the file such that one can get the File back using g_file_parse_name().

This is generally used to show the File as a nice string in a user interface, like in a location entry.

For local files with names that can safely be converted to UTF8 the pathname is used, otherwise the IRI is used (a form of URI that allows UTF8 characters unescaped).

This call does no blocking i/o.

Returns:
A string containing the File's parse name. The returned string should be freed with Glib::free() when no longer needed.

Glib::RefPtr<File> Gio::File::get_parent (  )  const

Gets the parent directory for the file.

If the file represents the root directory of the file system, then 0 will be returned.

This call does no blocking i/o.

Returns:
A File structure to the parent of the given File or 0 if there is no parent.

Glib::RefPtr<File> Gio::File::get_child ( const std::string name  )  const

Gets a specific child of file with name equal to name.

Note that the file with that specific name might not exist, but you can still have a File that points to it. You can use this for instance to create that file.

This call does no blocking i/o.

Parameters:
name String containing the child's name.
Returns:
A File to a child specified by name.

Glib::RefPtr<File> Gio::File::get_child_for_display_name ( const Glib::ustring display_name  )  const

Gets the child of file for a given display_name (i.e. a UTF8 version of the name).

If this function fails, it returns 0 and error will be set. This is very useful when constructing a GFile for a new file and the user entered the filename in the user interface, for instance when you select a directory and type a filename in the file selector.

This call does no blocking i/o.

Parameters:
display_name String to a possible child.
Returns:
A File to the specified child, or 0 if the display name couldn't be converted.

bool Gio::File::contains_file ( const Glib::RefPtr<File>&  descendant  )  const

Checks whether parent (recursively) contains the specified descendent.

This call does no blocking i/o.

Parameters:
descendant Input File.
Returns:
true if the descendent's parent, grandparent, etc is parent. false otherwise.

std::string Gio::File::get_relative_path ( const Glib::RefPtr<File>&  descendant  )  const

Gets the path for descendant relative to parent.

This call does no blocking i/o.

Parameters:
descendant Input File.
Returns:
String with the relative path from descendant to parent, or 0 if descendant is not a descendant of parent. The returned string should be freed with Glib::free() when no longer needed.

Glib::RefPtr<File> Gio::File::resolve_relative_path ( const std::string relative_path  )  const

Resolves a relative path for file to an absolute path.

This call does no blocking i/o.

Parameters:
relative_path A given relative path string.
Returns:
File to the resolved path. 0 if relative_path is 0 or if file is invalid.

bool Gio::File::is_native (  )  const

Checks to see if a file is native to the platform.

A native file s one expressed in the platform-native filename format, e.g. "C:\Windows" or "/usr/bin/". This does not mean the file is local, as it might be on a locally mounted remote filesystem.

On some systems non-native files may be availible using the native filesystem via a userspace filesystem (FUSE), in these cases this call will return false, but g_file_get_path() will still return a native path.

This call does no blocking i/o.

Returns:
true if file is native.

bool Gio::File::has_uri_scheme ( const std::string uri_scheme  )  const

Checks to see if a File has a given URI scheme.

This call does no blocking i/o.

Parameters:
uri_scheme A string containing a URI scheme.
Returns:
true if File's backend supports the given URI scheme, false if URI scheme is 0, not supported, or File is invalid.

std::string Gio::File::get_uri_scheme (  )  const

Gets the URI scheme for a File.

RFC 3986 decodes the scheme as:

URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

Common schemes include "file", "http", "ftp", etc.

This call does no blocking i/o.

Returns:
A string containing the URI scheme for the given File. The returned string should be freed with Glib::free() when no longer needed.

Glib::RefPtr<FileInputStream> Gio::File::read ( const Glib::RefPtr<Cancellable>&  cancellable  ) 

Opens a file for reading.

The result is a FileInputStream that can be used to read the contents of the file.

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. If the file is a directory, the G_IO_ERROR_IS_DIRECTORY error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

Parameters:
cancellable A Cancellable.
Returns:
FileInputStream or 0 on error.

Glib::RefPtr<FileInputStream> Gio::File::read (  ) 

Opens a file for reading.

The result is a FileInputStream that can be used to read the contents of the file.

If the file does not exist, the IO_ERROR_NOT_FOUND error will be returned. If the file is a directory, theIO_ERROR_IS_DIRECTORY error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

Returns:
FileInputStream or an empty RefPtr on error.

void Gio::File::read_async ( const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asynchronously opens the file for reading.

For more details, see read() which is the synchronous version of this call. When the operation is finished, slot will be called. You can then call read_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
cancellable A Cancellable object which can be used to cancel the operation.
io_priority The I/O priority of the request.

void Gio::File::read_async ( const SlotAsyncReady slot,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asynchronously opens the file for reading.

For more details, see read() which is the synchronous version of this call. When the operation is finished, slot will be called. You can then call read_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
io_priority The I/O priority of the request.

Glib::RefPtr<FileInputStream> Gio::File::read_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes an asynchronous file read operation started with g_file_read_async().

Parameters:
res A AsyncResult.
Returns:
A FileInputStream or 0 on error.

Glib::RefPtr<FileOutputStream> Gio::File::append_to ( const Glib::RefPtr<Cancellable>&  cancellable,
FileCreateFlags  flags = FILE_CREATE_NONE 
)

Gets an output stream for appending data to the file.

If the file doesn't already exist it is created.

By default files created are generally readable by everyone, but if you pass FILE_CREATE_PRIVATE in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Some filesystems don't allow all filenames, and may return an G_IO_ERROR_INVALID_FILENAME error. If the file is a directory the G_IO_ERROR_IS_DIRECTORY error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

Parameters:
flags A set of FileCreateFlags.
cancellable Optional Cancellable object.
Returns:
A FileOutputStream.

Glib::RefPtr<FileOutputStream> Gio::File::append_to ( FileCreateFlags  flags = FILE_CREATE_NONE  ) 

Gets an output stream for appending data to the file.

If the file doesn't already exist it is created.

By default files created are generally readable by everyone, but if you pass FILE_CREATE_PRIVATE in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

Some filesystems don't allow all filenames, and may return an G_IO_ERROR_INVALID_FILENAME error. If the file is a directory the G_IO_ERROR_IS_DIRECTORY error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

Parameters:
flags A set of FileCreateFlags.
Returns:
A FileOutputStream.

Glib::RefPtr<FileOutputStream> Gio::File::create_file ( const Glib::RefPtr<Cancellable>&  cancellable,
FileCreateFlags  flags = FILE_CREATE_NONE 
)

Creates a new file and returns an output stream for writing to it.

The file must not already exists.

By default files created are generally readable by everyone, but if you pass FILE_CREATE_PRIVATE in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

If a file with this name already exists the IO_ERROR_EXISTS error will be returned. If the file is a directory the G_IO_ERROR_IS_DIRECTORY error will be returned. Some filesystems don't allow all filenames, and may return an IO_ERROR_INVALID_FILENAME error, and if the name is to long IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

Parameters:
cancellable A Cancellable object which can be used to cancel the operation.
flags a set of FileCreateFlags.
Returns:
A FileOutputStream for the newly created file, or 0 on error.

Glib::RefPtr<FileOutputStream> Gio::File::create_file ( FileCreateFlags  flags = FILE_CREATE_NONE  ) 

Creates a new file and returns an output stream for writing to it.

The file must not already exists.

By default files created are generally readable by everyone, but if you pass FILE_CREATE_PRIVATE in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

If a file with this name already exists the IO_ERROR_EXISTS error will be returned. If the file is a directory the G_IO_ERROR_IS_DIRECTORY error will be returned. Some filesystems don't allow all filenames, and may return an IO_ERROR_INVALID_FILENAME error, and if the name is to long IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

Parameters:
flags a set of FileCreateFlags.
Returns:
A FileOutputStream for the newly created file, or 0 on error.

Glib::RefPtr<FileOutputStream> Gio::File::replace ( const Glib::RefPtr<Cancellable>&  cancellable,
const std::string etag = std::string(),
bool  make_backup = false,
FileCreateFlags  flags = FILE_CREATE_NONE 
)

Returns an output stream for overwriting the file, possibly creating a backup copy of the file first.

This will try to replace the file in the safest way possible so that any errors during the writing will not affect an already existing copy of the file. For instance, for local files it may write to a temporary file and then atomically rename over the destination when the stream is closed.

By default files created are generally readable by everyone, but if you pass FILE_CREATE_PRIVATE in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

If you pass in an etag value, then this value is compared to the current entity tag of the file, and if they differ an IO_ERROR_WRONG_ETAG error is returned. This generally means that the file has been changed since you last read it. You can get the new etag from FileOutputStream::get_etag() after you've finished writing and closed the FileOutputStream. When you load a new file you can use FileInputStream::query_info() to get the etag of the file.

If make_backup is true, this function will attempt to make a backup of the current file before overwriting it. If this fails a IO_ERROR_CANT_CREATE_BACKUP error will be returned. If you want to replace anyway, try again with make_backup set to false.

If the file is a directory the IO_ERROR_IS_DIRECTORY error will be returned, and if the file is some other form of non-regular file then a IO_ERROR_NOT_REGULAR_FILE error will be returned. Some file systems don't allow all file names, and may return an IO_ERROR_INVALID_FILENAME error, and if the name is to long IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

Parameters:
etag An optional entity tag for the current Glib::File.
make_backup true if a backup should be created.
flags A set of FileCreateFlags.
Returns:
A FileOutputStream.

Glib::RefPtr<FileOutputStream> Gio::File::replace ( const std::string etag = std::string(),
bool  make_backup = false,
FileCreateFlags  flags = FILE_CREATE_NONE 
)

Returns an output stream for overwriting the file, possibly creating a backup copy of the file first.

This will try to replace the file in the safest way possible so that any errors during the writing will not affect an already existing copy of the file. For instance, for local files it may write to a temporary file and then atomically rename over the destination when the stream is closed.

By default files created are generally readable by everyone, but if you pass FILE_CREATE_PRIVATE in flags the file will be made readable only to the current user, to the level that is supported on the target filesystem.

If you pass in an etag value, then this value is compared to the current entity tag of the file, and if they differ an IO_ERROR_WRONG_ETAG error is returned. This generally means that the file has been changed since you last read it. You can get the new etag from FileOutputStream::get_etag() after you've finished writing and closed the FileOutputStream. When you load a new file you can use FileInputStream::query_info() to get the etag of the file.

If make_backup is true, this function will attempt to make a backup of the current file before overwriting it. If this fails a IO_ERROR_CANT_CREATE_BACKUP error will be returned. If you want to replace anyway, try again with make_backup set to false.

If the file is a directory the IO_ERROR_IS_DIRECTORY error will be returned, and if the file is some other form of non-regular file then a IO_ERROR_NOT_REGULAR_FILE error will be returned. Some file systems don't allow all file names, and may return an IO_ERROR_INVALID_FILENAME error, and if the name is to long IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

Parameters:
etag An optional entity tag for the current Glib::File.
make_backup true if a backup should be created.
flags A set of FileCreateFlags.
Returns:
A FileOutputStream.

void Gio::File::append_to_async ( const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable,
FileCreateFlags  flags = FILE_CREATE_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asynchronously opens the file for appending.

For more details, see append_to() which is the synchronous version of this call.

When the operation is finished, slot will be called. You can then call append_to_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
cancellable A Cancellable object which can be used to cancel the operation.
flags a set of FileCreateFlags.
io_priority The I/O priority of the request.

void Gio::File::append_to_async ( const SlotAsyncReady slot,
FileCreateFlags  flags = FILE_CREATE_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asynchronously opens the file for appending.

For more details, see append_to() which is the synchronous version of this call.

When the operation is finished, slot will be called. You can then call append_to_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
flags a set of FileCreateFlags.
io_priority The I/O priority of the request.

Glib::RefPtr<FileOutputStream> Gio::File::append_to_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes an asynchronous file append operation started with g_file_append_to_async().

Parameters:
res AsyncResult.
Returns:
A valid FileOutputStream or 0 on error.

void Gio::File::create_file_async ( const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable,
FileCreateFlags  flags = FILE_CREATE_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asynchronously creates a new file and returns an output stream for writing to it.

The file must not already exist. For more details, see create_file() which is the synchronous version of this call.

When the operation is finished, slot will be called. You can then call create_file_finish() to get the result of the operation.

Parameters:
flags a set of FileCreateFlags.
io_priority The I/O priority of the request.
cancellable A Cancellable object which can be used to cancel the operation.
slot A callback slot which will be called when the request is satisfied.

void Gio::File::create_file_async ( const SlotAsyncReady slot,
FileCreateFlags  flags = FILE_CREATE_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asynchronously creates a new file and returns an output stream for writing to it.

The file must not already exist. For more details, see create_file() which is the synchronous version of this call.

When the operation is finished, slot will be called. You can then call create_file_finish() to get the result of the operation.

Parameters:
flags a set of FileCreateFlags.
io_priority The I/O priority of the request.
slot A callback slot which will be called when the request is satisfied.

Glib::RefPtr<FileOutputStream> Gio::File::create_file_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes an asynchronous file create operation started with g_file_create_async().

Parameters:
res A AsyncResult.
Returns:
A FileOutputStream or 0 on error.

void Gio::File::replace_async ( const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable,
const std::string etag = std::string(),
bool  make_backup = false,
FileCreateFlags  flags = FILE_CREATE_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asyncronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first.

For more details, see replace() which is the synchronous version of this call. When the operation is finished, slot will be called. You can then call replace_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
cancellable A Cancellable object which can be used to cancel the operation.
etag An entity tag for the current Gio::File.
make_backup true if a backup of the existing file should be made.
flags A set of FileCreateFlags.
io_priority The I/O priority of the request.

void Gio::File::replace_async ( const SlotAsyncReady slot,
const std::string etag = std::string(),
bool  make_backup = false,
FileCreateFlags  flags = FILE_CREATE_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asyncronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first.

For more details, see replace() which is the synchronous version of this call. When the operation is finished, slot will be called. You can then call replace_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
etag An entity tag for the current Gio::File.
make_backup true if a backup of the existing file should be made.
flags A set of FileCreateFlags.
io_priority The I/O priority of the request.

Glib::RefPtr<FileOutputStream> Gio::File::replace_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes an asynchronous file replace operation started with g_file_replace_async().

Parameters:
res A AsyncResult.
Returns:
A FileOutputStream, or 0 on error.

Glib::RefPtr<FileInfo> Gio::File::query_info ( const Glib::RefPtr<Cancellable>&  cancellable,
const std::string attributes = "*",
FileQueryInfoFlags  flags = FILE_QUERY_INFO_NONE 
) const

Gets the requested information about the file.

The result is a FileInfo object that contains key-value attributes (such as the type or size of the file).

The attribute value is a string that specifies the file attributes that should be gathered. It is not an error if it's not possible to read a particular requested attribute from a file - it just won't be set. attribute should be a comma-separated list of attribute or attribute wildcards. The wildcard "*" means all attributes, and a wildcard like "standard::*" means all attributes in the standard namespace. An example attribute query be "standard::*,owner::user". The standard attributes are available as defines, like G_FILE_ATTRIBUTE_STANDARD_NAME.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

For symlinks, normally the information about the target of the symlink is returned, rather than information about the symlink itself. However if you pass FILE_QUERY_INFO_NOFOLLOW_SYMLINKS in flags the information about the symlink itself will be returned. Also, for symlinks that point to non-existing files the information about the symlink itself will be returned.

If the file does not exist, the IO_ERROR_NOT_FOUND error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

Parameters:
cancellable A Cancellable object.
attributes,: An attribute query string.
flags,: A set of FileQueryInfoFlags.
Returns:
a FileInfo for the file, or an empty RefPtr on error.

Glib::RefPtr<FileInfo> Gio::File::query_info ( const std::string attributes = "*",
FileQueryInfoFlags  flags = FILE_QUERY_INFO_NONE 
) const

Gets the requested information about the file.

The result is a FileInfo object that contains key-value attributes (such as the type or size of the file).

The attribute value is a string that specifies the file attributes that should be gathered. It is not an error if it's not possible to read a particular requested attribute from a file - it just won't be set. attribute should be a comma-separated list of attribute or attribute wildcards. The wildcard "*" means all attributes, and a wildcard like "standard::*" means all attributes in the standard namespace. An example attribute query be "standard::*,owner::user". The standard attributes are available as defines, like G_FILE_ATTRIBUTE_STANDARD_NAME.

For symlinks, normally the information about the target of the symlink is returned, rather than information about the symlink itself. However if you pass FILE_QUERY_INFO_NOFOLLOW_SYMLINKS in flags the information about the symlink itself will be returned. Also, for symlinks that point to non-existing files the information about the symlink itself will be returned.

If the file does not exist, the IO_ERROR_NOT_FOUND error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

Parameters:
attributes,: An attribute query string.
flags,: A set of FileQueryInfoFlags.
Returns:
a FileInfo for the file, or an empty RefPtr on error.

bool Gio::File::query_exists ( const Glib::RefPtr<Cancellable>&  cancellable  )  const

bool Gio::File::query_exists (  )  const

Utility function to check if a particular file exists.

This is implemented using query_info() and as such does blocking I/O.

Note that in many cases it is racy to first check for file existance and then execute something based on the outcome of that, because the file might have been created or removed inbetween the operations. The general approach to handling that is to not check, but just do the operation and handle the errors as they come.

As an example of race-free checking, take the case of reading a file, and if it doesn't exist, creating it. There are two racy versions: read it, and on error create it; and: check if it exists, if not create it. These can both result in two processes creating the file (with perhaps a partially written file as the result). The correct approach is to always try to create the file with g_file_create() which will either atomically create the file or fail with an IO_ERROR_EXISTS error.

However, in many cases an existance check is useful in a user interface, for instance to make a menu item sensitive/insensitive, so that you don't have to fool users that something is possible and then just show and error dialog. If you do this, you should make sure to also handle the errors that can happen due to races when you execute the operation.

Returns:
true if the file exists (and can be detected without error), false otherwise (or if cancelled).

void Gio::File::query_info_async ( const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable,
const std::string attributes = "*",
FileQueryInfoFlags  flags = FILE_QUERY_INFO_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
) const

Asynchronously gets the requested information about specified file.

The result is a FileInfo object that contains key-value attributes (such as type or size for the file).

For more details, see query_info() which is the synchronous version of this call. When the operation is finished, slot will be called. You can then call query_info_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
cancellable A Cancellable object which can be used to cancel the operation.
attributes An attribute query string.
flags A set of FileQueryInfoFlags.
io_priority The I/O priority of the request.

void Gio::File::query_info_async ( const SlotAsyncReady slot,
const std::string attributes = "*",
FileQueryInfoFlags  flags = FILE_QUERY_INFO_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
) const

Asynchronously gets the requested information about specified file.

The result is a FileInfo object that contains key-value attributes (such as type or size for the file).

For more details, see query_info() which is the synchronous version of this call. When the operation is finished, slot will be called. You can then call query_info_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
attributes An attribute query string.
flags A set of FileQueryInfoFlags.
io_priority The I/O priority of the request.

Glib::RefPtr<FileInfo> Gio::File::query_info_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes an asynchronous file info query.

See g_file_query_info_async().

Parameters:
res A AsyncResult.
Returns:
FileInfo for given file or 0 on error.

Glib::RefPtr<FileInfo> Gio::File::query_filesystem_info ( const Glib::RefPtr<Cancellable>&  cancellable,
const std::string attributes = "*" 
)

Similar to query_info(), but obtains information about the filesystem the file is on, rather than the file itself.

For instance the amount of space availible and the type of the filesystem.

The attribute value is a string that specifies the file attributes that should be gathered. It is not an error if its not possible to read a particular requested attribute from a file, it just won't be set. attribute should be a comma-separated list of attribute or attribute wildcards. The wildcard "*" means all attributes, and a wildcard like "fs:*" means all attributes in the fs namespace. The standard namespace for filesystem attributes is "fs". Common attributes of interest are FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem in bytes), FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes availible), and FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem).

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

Parameters:
cancellable A Cancellable object.
attributes An attribute query string.
Returns:
A FileInfo or an empty RefPtr if there was an error.

Glib::RefPtr<FileInfo> Gio::File::query_filesystem_info ( const std::string attributes = "*"  ) 

Similar to query_info(), but obtains information about the filesystem the file is on, rather than the file itself.

For instance the amount of space availible and the type of the filesystem.

The attribute value is a string that specifies the file attributes that should be gathered. It is not an error if its not possible to read a particular requested attribute from a file, it just won't be set. attribute should be a comma-separated list of attribute or attribute wildcards. The wildcard "*" means all attributes, and a wildcard like "fs:*" means all attributes in the fs namespace. The standard namespace for filesystem attributes is "fs". Common attributes of interest are FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem in bytes), FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes availible), and FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem).

If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.

Parameters:
attributes An attribute query string.
Returns:
A FileInfo or an empty RefPtr if there was an error.

Glib::RefPtr<Mount> Gio::File::find_enclosing_mount ( const Glib::RefPtr<Cancellable>&  cancellable  ) 

Gets a Mount for the File.

If the FileIface for file does not have a mount (e.g. possibly a remote share), error will be set to IO_ERROR_NOT_FOUND and 0 will be returned.

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
cancellable Optional Cancellable object, 0 to ignore.
Returns:
A Mount where the file is located or 0 on error.

Glib::RefPtr<Mount> Gio::File::find_enclosing_mount (  ) 

Gets a Mount for the File.

If the FileIface for the file does not have a mount (e.g. possibly a remote share), an error will be set to IO_ERROR_NOT_FOUND and an empty RefPtr will be returned.

Parameters:
cancellable Cancellable object.
Returns:
A Mount where the file is located.

void Gio::File::find_enclosing_mount_async ( const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asynchronously gets the mount for the file.

For more details, see find_enclosing_mount() which is the synchronous version of this call.

When the operation is finished, slot will be called. You can then call find_enclosing_mount_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
cancellable A Cancellable object.
io_priority The I/O priority of the request.

void Gio::File::find_enclosing_mount_async ( const SlotAsyncReady slot,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asynchronously gets the mount for the file.

For more details, see find_enclosing_mount() which is the synchronous version of this call.

When the operation is finished, slot will be called. You can then call find_enclosing_mount_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
io_priority The I/O priority of the request.

Glib::RefPtr<Mount> Gio::File::find_enclosing_mount_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Glib::RefPtr<FileEnumerator> Gio::File::enumerate_children ( const Glib::RefPtr<Cancellable>&  cancellable,
const std::string attributes = "*",
FileQueryInfoFlags  flags = FILE_QUERY_INFO_NONE 
)

Gets the requested information about the files in a directory.

The result is a FileEnumerator object that will give out FileInfo objects for all the files in the directory.

The attribute value is a string that specifies the file attributes that should be gathered. It is not an error if its not possible to read a particular requested attribute from a file, it just won't be set. attribute should be a comma-separated list of attribute or attribute wildcards. The wildcard "*" means all attributes, and a wildcard like "standard::*" means all attributes in the standard namespace. An example attribute query be "standard::*,owner::user". The standard attributes are availible as defines, like FILE_ATTRIBUTE_STANDARD_NAME.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. If the file is not a directory, the G_FILE_ERROR_NOTDIR error will be returned. Other errors are possible too.

Parameters:
cancellable A Cancellable object.
attributes An attribute query string.
flags A set of FileQueryInfoFlags.
Returns:
A FileEnumerator if successful, 0 on error.

Glib::RefPtr<FileEnumerator> Gio::File::enumerate_children ( const std::string attributes = "*",
FileQueryInfoFlags  flags = FILE_QUERY_INFO_NONE 
)

Gets the requested information about the files in a directory.

The result is a FileEnumerator object that will give out FileInfo objects for all the files in the directory.

The attribute value is a string that specifies the file attributes that should be gathered. It is not an error if its not possible to read a particular requested attribute from a file, it just won't be set. attribute should be a comma-separated list of attribute or attribute wildcards. The wildcard "*" means all attributes, and a wildcard like "standard::*" means all attributes in the standard namespace. An example attribute query be "standard::*,owner::user". The standard attributes are availible as defines, like FILE_ATTRIBUTE_STANDARD_NAME.

If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. If the file is not a directory, the G_FILE_ERROR_NOTDIR error will be returned. Other errors are possible too.

Parameters:
attributes An attribute query string.
flags A set of FileQueryInfoFlags.
Returns:
A FileEnumerator if successful, 0 on error.

void Gio::File::enumerate_children_async ( const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable,
const std::string attributes = "*",
FileQueryInfoFlags  flags = FILE_QUERY_INFO_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asynchronously gets the requested information about the files in a directory.

The result is a GFileEnumerator object that will give out GFileInfo objects for all the files in the directory.

For more details, see enumerate_children() which is the synchronous version of this call. When the operation is finished, slot will be called. You can then call enumerate_children_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
cancellable A Cancellable object which can be used to cancel the operation.
attributes An attribute query string.
flags A set of FileQueryInfoFlags.
io_priority The I/O priority of the request.

void Gio::File::enumerate_children_async ( const SlotAsyncReady slot,
const std::string attributes = "*",
FileQueryInfoFlags  flags = FILE_QUERY_INFO_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asynchronously gets the requested information about the files in a directory.

The result is a GFileEnumerator object that will give out GFileInfo objects for all the files in the directory.

For more details, see enumerate_children() which is the synchronous version of this call. When the operation is finished, slot will be called. You can then call enumerate_children_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
attributes An attribute query string.
flags A set of FileQueryInfoFlags.
io_priority The I/O priority of the request.

Glib::RefPtr<FileEnumerator> Gio::File::enumerate_children_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes an async enumerate children operation.

See g_file_enumerate_children_async().

Parameters:
res A AsyncResult.
Returns:
A FileEnumerator or 0 if an error occurred.

Glib::RefPtr<File> Gio::File::set_display_name ( const Glib::ustring display_name,
const Glib::RefPtr<Cancellable>&  cancellable 
)

Renames file to the specified display name.

The display name is converted from UTF8 to the correct encoding for the target filesystem if possible and the file is renamed to this.

If you want to implement a rename operation in the user interface the edit name (FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the initial value in the rename widget, and then the result after editing should be passed to g_file_set_display_name().

On success the resulting converted filename is returned.

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
display_name A string.
cancellable Optional Cancellable object, 0 to ignore.
Returns:
A File specifying what file was renamed to, or 0 if there was an error.

Glib::RefPtr<File> Gio::File::set_display_name ( const Glib::ustring display_name  ) 

Renames the file to the specified display name.

The display name is converted from UTF8 to the correct encoding for the target filesystem if possible and the file is renamed to this.

If you want to implement a rename operation in the user interface the edit name (G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the initial value in the rename widget, and then the result after editing should be passed to set_display_name().

On success the resulting converted filename is returned.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
display_name A string.
Returns:
A Glib::File specifying what the file was renamed to, or an empty RefPtr if there was an error.

void Gio::File::set_display_name_async ( const Glib::ustring display_name,
const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asynchronously sets the display name for a given Gio::File.

For the synchronous version of this function, see set_display_name(). When the operation is finished, slot will be called. You can then call set_display_name_finish() to get the result of the operation.

Parameters:
display_name A string.
slot A callback slot which will be called when the request is satisfied.
cancellable A Cancellable object which can be used to cancel the operation.
io_priority The I/O priority of the request.

void Gio::File::set_display_name_async ( const Glib::ustring display_name,
const SlotAsyncReady slot,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asynchronously sets the display name for a given Gio::File.

For the synchronous version of this function, see set_display_name(). When the operation is finished, slot will be called. You can then call set_display_name_finish() to get the result of the operation.

Parameters:
display_name A string.
slot A callback slot which will be called when the request is satisfied.
io_priority The I/O priority of the request.

Glib::RefPtr<File> Gio::File::set_display_name_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes setting a display name started with g_file_set_display_name_async().

Parameters:
res A AsyncResult.
Returns:
A File or 0 on error.

bool Gio::File::remove ( const Glib::RefPtr<Cancellable>&  cancellable  ) 

Deletes a file.

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
cancellable Optional Cancellable object, 0 to ignore.
Returns:
true if the file was deleted. false otherwise.

bool Gio::File::remove (  ) 

Deletes a file.

Returns:
true if the file was deleted. false otherwise.

bool Gio::File::trash ( const Glib::RefPtr<Cancellable>&  cancellable  ) 

Sends file to the "Trashcan", if possible.

This is similar to deleting it, but the user can recover it before emptying the trashcan. Not all filesystems support trashing, so this call can return the IO_ERROR_NOT_SUPPORTED error.

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
cancellable Optional Cancellable object, 0 to ignore.
Returns:
true on successful trash, false otherwise.

bool Gio::File::trash (  ) 

Sends the file to the "Trashcan", if possible.

This is similar to deleting it, but the user can recover it before emptying the trashcan. Not all filesystems support trashing, so this call can return the IO_ERROR_NOT_SUPPORTED error.

Returns:
true on successful trash, false otherwise.

bool Gio::File::copy ( const Glib::RefPtr<File>&  destination,
const SlotFileProgress slot,
const Glib::RefPtr<Cancellable>&  cancellable,
FileCopyFlags  flags = FILE_COPY_NONE 
)

Copies the file source to the location specified by destination.

Can not handle recursive copies of directories. If the flag FILE_COPY_OVERWRITE is specified an already existing destination file is overwritten. If the flag FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will be copied as symlinks, otherwise the target of the source symlink will be copied.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

The operation can be monitored via the slot callback.

If the source file does not exist then the IO_ERROR_NOT_FOUND error is returned, independent on the status of the destination.

If FILE_COPY_OVERWRITE is not specified and the target exists, then the error IO_ERROR_EXISTS is returned.

If trying to overwrite a file over a directory the IO_ERROR_IS_DIRECTORY error is returned. If trying to overwrite a directory with a directory the IO_ERROR_WOULD_MERGE error is returned.

If the source is a directory and the target does not exist, or FILE_COPY_OVERWRITE is specified and the target is a file, then the IO_ERROR_WOULD_RECURSE error is returned.

If you are interested in copying the Gio::File object itself (not the on-disk file), see File::dup().

bool Gio::File::copy ( const Glib::RefPtr<File>&  destination,
const SlotFileProgress slot,
FileCopyFlags  flags = FILE_COPY_NONE 
)

bool Gio::File::copy ( const Glib::RefPtr<File>&  destination,
FileCopyFlags  flags = FILE_COPY_NONE 
)

void Gio::File::copy_async ( const Glib::RefPtr<File>&  destination,
const SlotFileProgress slot_progress,
const SlotAsyncReady slot_ready,
const Glib::RefPtr<Cancellable>&  cancellable,
FileCopyFlags  flags = FILE_COPY_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Copies the file to the location specified by asynchronously.

For details of the behaviour, see copy().

When the operation is finished, will be called. You can then call copy_finish() to get the result of the operation.

The function specified by will be called just like in copy(), however the callback will run in the main loop, not in the thread that is doing the I/O operation.

Parameters:
destination Destination File
slot_progress The callback slot to be called with progress information
slot_ready A SlotAsyncReady to call when the request is satisfied
cancellable A Cancellable object which can be used to cancel the operation
flags Set of FileCopyFlags
io_priority The I/O priority of the request

void Gio::File::copy_async ( const Glib::RefPtr<File>&  destination,
const SlotAsyncReady slot_ready,
const Glib::RefPtr<Cancellable>&  cancellable,
FileCopyFlags  flags = FILE_COPY_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Copies the file to the location specified by asynchronously.

For details of the behaviour, see copy().

When the operation is finished, will be called. You can then call copy_finish() to get the result of the operation.

Parameters:
destination Destination File
slot_ready A SlotAsyncReady to call when the request is satisfied
cancellable A Cancellable object which can be used to cancel the operation
flags Set of FileCopyFlags
io_priority The I/O priority of the request

void Gio::File::copy_async ( const Glib::RefPtr<File>&  destination,
const SlotFileProgress slot_progress,
const SlotAsyncReady slot_ready,
FileCopyFlags  flags = FILE_COPY_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Copies the file to the location specified by asynchronously.

For details of the behaviour, see copy().

When the operation is finished, will be called. You can then call copy_finish() to get the result of the operation.

The function specified by will be called just like in copy(), however the callback will run in the main loop, not in the thread that is doing the I/O operation.

Parameters:
destination Destination File
slot_progress The callback slot to be called with progress information
slot_ready A SlotAsyncReady to call when the request is satisfied
flags Set of FileCopyFlags
io_priority The I/O priority of the request

void Gio::File::copy_async ( const Glib::RefPtr<File>&  destination,
const SlotAsyncReady slot_ready,
FileCopyFlags  flags = FILE_COPY_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Copies the file to the location specified by asynchronously.

For details of the behaviour, see copy().

When the operation is finished, will be called. You can then call copy_finish() to get the result of the operation.

Parameters:
destination Destination File
slot_ready A SlotAsyncReady to call when the request is satisfied
flags Set of FileCopyFlags
io_priority The I/O priority of the request

bool Gio::File::copy_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

bool Gio::File::move ( const Glib::RefPtr<File>&  destination,
const SlotFileProgress slot,
const Glib::RefPtr<Cancellable>&  cancellable,
FileCopyFlags  flags = FILE_COPY_NONE 
)

Tries to move the file or directory source to the location specified by destination.

If native move operations are supported then this is used, otherwise a copy and delete fallback is used. The native implementation may support moving directories (for instance on moves inside the same filesystem), but the fallback code does not.

If the flag FILE_COPY_OVERWRITE is specified an already existing destination file is overwritten.

If the flag FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will be copied as symlinks, otherwise the target of the source symlink will be copied.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

The operation can be monitored via the slot callback. If the source file does not exist then the IO_ERROR_NOT_FOUND error is returned, independent on the status of the destination.

If G_FILE_COPY_OVERWRITE is not specified and the target exists, then the error G_IO_ERROR_EXISTS is returned.

If trying to overwrite a file over a directory the IO_ERROR_IS_DIRECTORY error is returned. If trying to overwrite a directory with a directory the IO_ERROR_WOULD_MERGE error is returned.

If the source is a directory and the target does not exist, or FILE_COPY_OVERWRITE is specified and the target is a file, then the IO_ERROR_WOULD_RECURSE error may be returned (if the native move operation isn't available).

bool Gio::File::move ( const Glib::RefPtr<File>&  destination,
const SlotFileProgress slot,
FileCopyFlags  flags = FILE_COPY_NONE 
)

bool Gio::File::move ( const Glib::RefPtr<File>&  destination,
FileCopyFlags  flags = FILE_COPY_NONE 
)

bool Gio::File::make_directory ( const Glib::RefPtr<Cancellable>&  cancellable  ) 

Creates a directory.

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
cancellable Optional Cancellable object, 0 to ignore.
Returns:
true on successful creation, false otherwise.

bool Gio::File::make_directory (  ) 

Creates a directory.

Returns:
true on successful creation, false otherwise.

bool Gio::File::make_symbolic_link ( const std::string symlink_value,
const Glib::RefPtr<Cancellable>&  cancellable 
)

Creates a symbolic link.

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
symlink_value A string with the value of the new symlink.
cancellable Optional Cancellable object, 0 to ignore.
Returns:
true on the creation of a new symlink, false otherwise.

bool Gio::File::make_symbolic_link ( const std::string symlink_value  ) 

Creates a symbolic link.

Parameters:
symlink_value A string with the value of the new symlink.
Returns:
true on the creation of a new symlink, false otherwise.

Glib::RefPtr<FileAttributeInfoList> Gio::File::query_settable_attributes ( const Glib::RefPtr<Cancellable>&  cancellable  ) 

Obtain the list of settable attributes for the file.

Returns: a FileAttributeInfoList describing the settable attributes.

Parameters:
cancellable Optional Cancellable object, 0 to ignore.
Returns:
A FileAttributeInfoList describing the settable attributes. When you are done with it, release it with g_file_attribute_info_list_unref().

Glib::RefPtr<FileAttributeInfoList> Gio::File::query_settable_attributes (  ) 

Obtain the list of settable attributes for the file.

Returns: a FileAttributeInfoList describing the settable attributes.

Returns:
A FileAttributeInfoList describing the settable attributes.

Glib::RefPtr<FileAttributeInfoList> Gio::File::query_writable_namespaces ( const Glib::RefPtr<Cancellable>&  cancellable  ) 

Obtain the list of attribute namespaces where new attributes can be created by a user.

An example of this is extended attributes (in the "xattr" namespace).

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
cancellable Optional Cancellable object, 0 to ignore.
Returns:
A FileAttributeInfoList describing the writable namespaces. When you are done with it, release it with g_file_attribute_info_list_unref().

Glib::RefPtr<FileAttributeInfoList> Gio::File::query_writable_namespaces (  ) 

Obtain the list of attribute namespaces where new attributes can be created by a user.

An example of this is extended attributes (in the "xattr" namespace).

Returns:
A FileAttributeInfoList describing the writable namespaces.

bool Gio::File::set_attributes_from_info ( const Glib::RefPtr<FileInfo>&  info,
const Glib::RefPtr<Cancellable>&  cancellable,
FileQueryInfoFlags  flags = FILE_QUERY_INFO_NONE 
)

Tries to set all attributes in the FileInfo on the target values, not stopping on the first error.

If there is any error during this operation then a error will be set to the first error. Error on particular fields are flagged by setting the "status" field in the attribute value to FILE_ATTRIBUTE_STATUS_ERROR_SETTING, which means you can also detect further errors.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
info A FileInfo.
cancellable A Cancellable object which can be used to cancel the operation.
flags A set of FileQueryInfoFlags.
Returns:
true if there was any error, false otherwise.

bool Gio::File::set_attributes_from_info ( const Glib::RefPtr<FileInfo>&  info,
FileQueryInfoFlags  flags = FILE_QUERY_INFO_NONE 
)

Tries to set all attributes in the FileInfo on the target values, not stopping on the first error.

If there is any error during this operation then a error will be set to the first error. Error on particular fields are flagged by setting the "status" field in the attribute value to FILE_ATTRIBUTE_STATUS_ERROR_SETTING, which means you can also detect further errors.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
info A FileInfo.
flags A set of FileQueryInfoFlags.
Returns:
true if there was any error, false otherwise.

void Gio::File::set_attributes_async ( const Glib::RefPtr<FileInfo>&  info,
const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable,
FileQueryInfoFlags  flags = FILE_QUERY_INFO_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asynchronously sets the attributes of file with info.

For more details, see set_attributes_from_info() which is the synchronous version of this call. When the operation is finished, slot will be called. You can then call set_attributes_finish() to get the result of the operation.

Parameters:
info A FileInfo.
slot A callback slot which will be called when the request is satisfied.
cancellable A Cancellable object which can be used to cancel the operation.
flags A set of FileQueryInfoFlags.
io_priority The I/O priority of the request.

void Gio::File::set_attributes_async ( const Glib::RefPtr<FileInfo>&  info,
const SlotAsyncReady slot,
FileQueryInfoFlags  flags = FILE_QUERY_INFO_NONE,
int  io_priority = Glib::PRIORITY_DEFAULT 
)

Asynchronously sets the attributes of file with info.

For more details, see set_attributes_from_info() which is the synchronous version of this call. When the operation is finished, slot will be called. You can then call set_attributes_finish() to get the result of the operation.

Parameters:
info A FileInfo.
slot A callback slot which will be called when the request is satisfied.
flags A set of FileQueryInfoFlags.
io_priority The I/O priority of the request.

bool Gio::File::set_attributes_finish ( const Glib::RefPtr<AsyncResult>&  result,
const Glib::RefPtr<FileInfo>&  info 
)

bool Gio::File::set_attribute_string ( const std::string attribute,
const std::string value,
FileQueryInfoFlags  flags,
const Glib::RefPtr<Cancellable>&  cancellable 
)

Sets attribute of type FILE_ATTRIBUTE_TYPE_STRING to value.

If attribute is of a different type, this operation will fail.

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
attribute A string containing the attribute's name.
value A string containing the attribute's value.
flags FileQueryInfoFlags.
cancellable Optional Cancellable object, 0 to ignore.
Returns:
true if the attribute was successfully set, false otherwise.

bool Gio::File::set_attribute_string ( const std::string attribute,
const std::string value,
FileQueryInfoFlags  flags 
)

Sets attribute of type FILE_ATTRIBUTE_TYPE_STRING to value.

If attribute is of a different type, this operation will fail.

Parameters:
attribute A string containing the attribute's name.
value A string containing the attribute's value.
flags FileQueryInfoFlags.
Returns:
true if the attribute was successfully set, false otherwise.

bool Gio::File::set_attribute_byte_string ( const std::string attribute,
const std::string value,
FileQueryInfoFlags  flags,
const Glib::RefPtr<Cancellable>&  cancellable 
)

Sets attribute of type FILE_ATTRIBUTE_TYPE_BYTE_STRING to value.

If attribute is of a different type, this operation will fail, returning false.

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
attribute A string containing the attribute's name.
value A string containing the attribute's new value.
flags A FileQueryInfoFlags.
cancellable Optional Cancellable object, 0 to ignore.
Returns:
true if the attribute was successfully set to value in the file, false otherwise.

bool Gio::File::set_attribute_byte_string ( const std::string attribute,
const std::string value,
FileQueryInfoFlags  flags 
)

Sets attribute of type FILE_ATTRIBUTE_TYPE_BYTE_STRING to value.

If attribute is of a different type, this operation will fail, returning false.

Parameters:
attribute A string containing the attribute's name.
value A string containing the attribute's new value.
flags A FileQueryInfoFlags.
Returns:
true if the attribute was successfully set to value in the file, false otherwise.

bool Gio::File::set_attribute_uint32 ( const std::string attribute,
guint32  value,
FileQueryInfoFlags  flags,
const Glib::RefPtr<Cancellable>&  cancellable 
)

Sets attribute of type FILE_ATTRIBUTE_TYPE_UINT32 to value.

If attribute is of a different type, this operation will fail.

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
attribute A string containing the attribute's name.
value A guint32 containing the attribute's new value.
flags A FileQueryInfoFlags.
cancellable Optional Cancellable object, 0 to ignore.
Returns:
true if the attribute was successfully set to value in the file, false otherwise.

bool Gio::File::set_attribute_uint32 ( const std::string attribute,
guint32  value,
FileQueryInfoFlags  flags 
)

Sets attribute of type FILE_ATTRIBUTE_TYPE_UINT32 to value.

If attribute is of a different type, this operation will fail.

Parameters:
attribute A string containing the attribute's name.
value A guint32 containing the attribute's new value.
flags A FileQueryInfoFlags.
Returns:
true if the attribute was successfully set to value in the file, false otherwise.

bool Gio::File::set_attribute_int32 ( const std::string attribute,
gint32  value,
FileQueryInfoFlags  flags,
const Glib::RefPtr<Cancellable>&  cancellable 
)

Sets attribute of type FILE_ATTRIBUTE_TYPE_INT32 to value.

If attribute is of a different type, this operation will fail.

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
attribute A string containing the attribute's name.
value A gint32 containing the attribute's new value.
flags A FileQueryInfoFlags.
cancellable Optional Cancellable object, 0 to ignore.
Returns:
true if the attribute was successfully set to value in the file, false otherwise.

bool Gio::File::set_attribute_int32 ( const std::string attribute,
gint32  value,
FileQueryInfoFlags  flags 
)

Sets attribute of type FILE_ATTRIBUTE_TYPE_INT32 to value.

If attribute is of a different type, this operation will fail.

Parameters:
attribute A string containing the attribute's name.
value A gint32 containing the attribute's new value.
flags A FileQueryInfoFlags.
Returns:
true if the attribute was successfully set to value in the file, false otherwise.

bool Gio::File::set_attribute_uint64 ( const std::string attribute,
guint64  value,
FileQueryInfoFlags  flags,
const Glib::RefPtr<Cancellable>&  cancellable 
)

Sets attribute of type FILE_ATTRIBUTE_TYPE_UINT64 to value.

If attribute is of a different type, this operation will fail.

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
attribute A string containing the attribute's name.
value A guint64 containing the attribute's new value.
flags A FileQueryInfoFlags.
cancellable Optional Cancellable object, 0 to ignore.
Returns:
true if the attribute was successfully set to value in the file, false otherwise.

bool Gio::File::set_attribute_uint64 ( const std::string attribute,
guint64  value,
FileQueryInfoFlags  flags 
)

Sets attribute of type FILE_ATTRIBUTE_TYPE_UINT64 to value.

If attribute is of a different type, this operation will fail.

Parameters:
attribute A string containing the attribute's name.
value A guint64 containing the attribute's new value.
flags A FileQueryInfoFlags.
Returns:
true if the attribute was successfully set to value in the file, false otherwise.

bool Gio::File::set_attribute_int64 ( const std::string attribute,
gint64  value,
FileQueryInfoFlags  flags,
const Glib::RefPtr<Cancellable>&  cancellable 
)

Sets attribute of type FILE_ATTRIBUTE_TYPE_INT64 to value.

If attribute is of a different type, this operation will fail.

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
attribute A string containing the attribute's name.
value A guint64 containing the attribute's new value.
flags A FileQueryInfoFlags.
cancellable Optional Cancellable object, 0 to ignore.
Returns:
true if the attribute was successfully set, false otherwise.

bool Gio::File::set_attribute_int64 ( const std::string attribute,
gint64  value,
FileQueryInfoFlags  flags 
)

Sets attribute of type FILE_ATTRIBUTE_TYPE_INT64 to value.

If attribute is of a different type, this operation will fail.

Parameters:
attribute A string containing the attribute's name.
value A guint64 containing the attribute's new value.
flags A FileQueryInfoFlags.
Returns:
true if the attribute was successfully set, false otherwise.

void Gio::File::mount_enclosing_volume ( const Glib::RefPtr<MountOperation>&  mount_operation,
const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable 
)

Starts a , mounting the volume that contains the file.

When this operation has completed, slot will be called with, and the operation can be finalized with mount_enclosing_volume_finish().

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
mount_operation A MountOperation.
slot A callback slot which will be called when the request is satisfied.
cancellable A Cancellable object.

void Gio::File::mount_enclosing_volume ( const Glib::RefPtr<MountOperation>&  mount_operation,
const SlotAsyncReady slot 
)

Starts a , mounting the volume that contains the file.

When this operation has completed, slot will be called with, and the operation can be finalized with mount_enclosing_volume_finish().

Parameters:
mount_operation A MountOperation.
slot A callback slot which will be called when the request is satisfied.

void Gio::File::mount_enclosing_volume ( const SlotAsyncReady slot  ) 

Starts a , mounting the volume that contains the file.

When this operation has completed, slot will be called with, and the operation can be finalized with mount_enclosing_volume_finish().

Parameters:
slot A callback slot which will be called when the request is satisfied.

void Gio::File::mount_enclosing_volume (  ) 

Starts a , mounting the volume that contains the file.

bool Gio::File::mount_enclosing_volume_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes a mount operation started by g_file_mount_enclosing_volume().

Parameters:
result A AsyncResult.
Returns:
true if successful. If an error has occured, this function will return false and set error appropriately if present.

void Gio::File::mount_mountable ( const Glib::RefPtr<MountOperation>&  mount_operation,
const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable 
)

Mounts a file of type FILE_TYPE_MOUNTABLE.

Using mount_operation, you can request callbacks when, for instance, passwords are needed during authentication.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

When the operation is finished, slot will be called. You can then call mount_mountable_finish() to get the result of the operation.

Parameters:
mount_operation A MountOperation.
cancellable A Cancellable object which can be used to cancel the operation.
slot A callback slot which will be called when the request is satisfied.

void Gio::File::mount_mountable ( const Glib::RefPtr<MountOperation>&  mount_operation,
const SlotAsyncReady slot 
)

Mounts a file of type FILE_TYPE_MOUNTABLE.

Using mount_operation, you can request callbacks when, for instance, passwords are needed during authentication.

When the operation is finished, slot will be called. You can then call mount_mountable_finish() to get the result of the operation.

Parameters:
mount_operation A MountOperation.
slot A callback slot which will be called when the request is satisfied.

void Gio::File::mount_mountable ( const SlotAsyncReady slot  ) 

Mounts a file of type FILE_TYPE_MOUNTABLE without user interaction.

When the operation is finished, slot will be called. You can then call mount_mountable_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.

void Gio::File::mount_mountable (  ) 

Mounts a file of type FILE_TYPE_MOUNTABLE without user interaction.

Glib::RefPtr<File> Gio::File::mount_mountable_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes a mount operation.

See g_file_mount_mountable() for details.

Finish an asynchronous mount operation that was started with g_file_mount_mountable().

Parameters:
result A AsyncResult.
Returns:
A File or 0 on error.

void Gio::File::unmount_mountable ( const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable,
MountUnmountFlags  flags = MOUNT_UNMOUNT_NONE 
)

Unmounts a file of type FILE_TYPE_MOUNTABLE.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

When the operation is finished, slot will be called. You can then call unmount_mountable_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
cancellable A Cancellable object which can be used to cancel the operation.
flags Flags affecting the operation.

void Gio::File::unmount_mountable ( const SlotAsyncReady slot,
MountUnmountFlags  flags = MOUNT_UNMOUNT_NONE 
)

Unmounts a file of type FILE_TYPE_MOUNTABLE.

When the operation is finished, slot will be called. You can then call unmount_mountable_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
flags Flags affecting the operation.

void Gio::File::unmount_mountable ( MountUnmountFlags  flags = MOUNT_UNMOUNT_NONE  ) 

Unmounts a file of type FILE_TYPE_MOUNTABLE.

Parameters:
flags Flags affecting the operation.

bool Gio::File::unmount_mountable_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes an unmount operation, see g_file_unmount_mountable() for details.

Finish an asynchronous unmount operation that was started with g_file_unmount_mountable().

Parameters:
result A AsyncResult.
Returns:
true if the operation finished successfully. false otherwise.

void Gio::File::eject_mountable ( const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable,
MountUnmountFlags  flags = MOUNT_UNMOUNT_NONE 
)

Starts an asynchronous eject on a mountable.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

When the operation is finished, slot will be called. You can then call eject_mountable_finish() to get the result of the operation.

Parameters:
flags Flags affecting the operation.
cancellable A Cancellable object which can be used to cancel the operation.
slot A callback slot which will be called when the request is satisfied.

void Gio::File::eject_mountable ( const SlotAsyncReady slot,
MountUnmountFlags  flags = MOUNT_UNMOUNT_NONE 
)

Starts an asynchronous eject on a mountable.

When the operation is finished, slot will be called. You can then call eject_mountable_finish() to get the result of the operation.

Parameters:
slot A callback slot which will be called when the request is satisfied.
flags Flags affecting the operation.

void Gio::File::eject_mountable ( MountUnmountFlags  flags = MOUNT_UNMOUNT_NONE  ) 

Starts an asynchronous eject on a mountable.

Parameters:
flags Flags affecting the operation.

bool Gio::File::eject_mountable_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes an asynchronous eject operation started by g_file_eject_mountable().

Parameters:
result A AsyncResult.
Returns:
true if the file was ejected successfully. false otherwise.

bool Gio::File::copy_attributes ( const Glib::RefPtr<File>&  destination,
const Glib::RefPtr<Cancellable>&  cancellable,
FileCopyFlags  flags = FILE_COPY_NONE 
)

Copies the file attributes from to .

Normally only a subset of the file attributes are copied, those that are copies in a normal file copy operation (which for instance does not include e.g. mtime). However if FILE_COPY_ALL_METADATA is specified in flags, then all the metadata that is possible to copy is copied.

Parameters:
destination A File to copy attributes to.
cancellable A Cancellable object.
flags A set of FileMonitorFlags.
Returns:
true if the attributes were copied successfully, false otherwise.

bool Gio::File::copy_attributes ( const Glib::RefPtr<File>&  destination,
FileCopyFlags  flags = FILE_COPY_NONE 
)

Copies the file attributes from to .

Normally only a subset of the file attributes are copied, those that are copies in a normal file copy operation (which for instance does not include e.g. mtime). However if FILE_COPY_ALL_METADATA is specified in flags, then all the metadata that is possible to copy is copied.

Parameters:
destination A File to copy attributes to.
flags A set of FileMonitorFlags.
Returns:
true if the attributes were copied successfully, false otherwise.

Glib::RefPtr<FileMonitor> Gio::File::monitor_directory ( const Glib::RefPtr<Cancellable>&  cancellable,
FileMonitorFlags  flags = FILE_MONITOR_NONE 
)

Obtains a directory monitor for the given file.

This may fail if directory monitoring is not supported.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
cancellable A Cancellable object.
flags A set of FileMonitorFlags.
Returns:
A FileMonitor for the file. or 0 on error.

Glib::RefPtr<FileMonitor> Gio::File::monitor_directory ( FileMonitorFlags  flags = FILE_MONITOR_NONE  ) 

Obtains a directory monitor for the given file.

This may fail if directory monitoring is not supported.

Parameters:
flags A set of FileMonitorFlags.
Returns:
A FileMonitor for the file. or 0 on error.

Glib::RefPtr<FileMonitor> Gio::File::monitor_file ( const Glib::RefPtr<Cancellable>&  cancellable,
FileMonitorFlags  flags = FILE_MONITOR_NONE 
)

Obtains a file monitor for the given file.

If no file notification mechanism exists, then regular polling of the file is used.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
flags A set of FileMonitorFlags.
A Cancellable object.
Returns:
A FileMonitor for the file.

Glib::RefPtr<FileMonitor> Gio::File::monitor_file ( FileMonitorFlags  flags = FILE_MONITOR_NONE  ) 

Obtains a file monitor for the given file.

If no file notification mechanism exists, then regular polling of the file is used.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
flags A set of FileMonitorFlags.
A Cancellable object.
Returns:
A FileMonitor for the file.

Glib::RefPtr<AppInfo> Gio::File::query_default_handler ( const Glib::RefPtr<Cancellable>&  cancellable  ) 

Glib::RefPtr<AppInfo> Gio::File::query_default_handler (  ) 

Returns the AppInfo that is registered as the default application to handle the file specified by the file.

Returns:
A AppInfo if the handle was found, or an empty RefPtr if there were errors.

bool Gio::File::load_contents ( const Glib::RefPtr<Cancellable>&  cancellable,
char **  contents,
gsize &  length,
char **  etag_out 
)

Loads the content of the file into memory, returning the size of the data.

The data is always zero terminated, but this is not included in the resultant length.

If cancellable is not 0, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
cancellable Optional Cancellable object, 0 to ignore.
contents A location to place the contents of the file.
length A location to place the length of the contents of the file.
etag_out A location to place the current entity tag for the file.
Returns:
true if the file's contents were successfully loaded. false if there were errors..

void Gio::File::load_contents_async ( const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable 
)

Starts an asynchronous load of the file's contents.

For more details, see load_contents() which is the synchronous version of this call.

When the load operation has completed, the slot will be called. To finish the operation, call load_contents_finish() with the AsyncResult provided to the slot.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

Parameters:
slot A callback slot which will be called when the request is satisfied.
cancellable A Cancellable object.

void Gio::File::load_contents_async ( const SlotAsyncReady slot  ) 

Starts an asynchronous load of the file's contents.

For more details, see load_contents() which is the synchronous version of this call.

When the load operation has completed, the slot will be called. To finish the operation, call load_contents_finish() with the AsyncResult provided to the slot.

Parameters:
slot A callback slot which will be called when the request is satisfied.

bool Gio::File::load_contents_finish ( const Glib::RefPtr<AsyncResult>&  result,
char **  contents,
gsize &  length,
char **  etag_out 
)

Finishes an asynchronous load of the file's contents.

The contents are placed in contents, and length is set to the size of the contents string. If etag_out is present, it will be set to the new entity tag for the file.

Parameters:
res A AsyncResult.
contents A location to place the contents of the file.
length A location to place the length of the contents of the file.
etag_out A location to place the current entity tag for the file.
Returns:
true if the load was successful. If false and error is present, it will be set appropriately.

void Gio::File::load_partial_contents_async ( const SlotReadMore slot_read_more,
const SlotAsyncReady slot_async_ready,
const Glib::RefPtr<Cancellable>&  cancellable 
)

Reads the partial contents of a file.

The slot_read_more callback slot should be used to stop reading from the file when appropriate. This operation can be finished by load_partial_contents_finish().

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

When the operation is finished, slot will be called. You can then call load_partial_contents_finish() to get the result of the operation.

Parameters:
slot_read_more A callback to receive partial data and to specify whether further data should be read.
slot_async_ready A callback slot which will be called when the request is satisfied.
cancellable A Cancellable object which can be used to cancel the operation.

void Gio::File::load_partial_contents_async ( const SlotReadMore slot_read_more,
const SlotAsyncReady slot_async_ready 
)

Reads the partial contents of a file.

The slot_read_more callback slot should be used to stop reading from the file when appropriate. This operation can be finished by load_partial_contents_finish().

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

When the operation is finished, slot will be called. You can then call load_partial_contents_finish() to get the result of the operation.

Parameters:
slot_read_more A callback to receive partial data and to specify whether further data should be read.
slot_async_ready A callback slot which will be called when the request is satisfied.

bool Gio::File::load_partial_contents_finish ( const Glib::RefPtr<AsyncResult>&  result,
char **  contents,
gsize &  length,
char **  etag_out 
)

Finishes an asynchronous partial load operation that was started with g_file_load_partial_contents_async().

Parameters:
res A AsyncResult.
contents A location to place the contents of the file.
length A location to place the length of the contents of the file.
etag_out A location to place the current entity tag for the file.
Returns:
true if the load was successful. If false and error is present, it will be set appropriately.

void Gio::File::replace_contents ( const char *  contents,
gsize  length,
const std::string etag,
std::string new_etag,
const Glib::RefPtr<Cancellable>&  cancellable,
bool  make_backup = false,
FileCreateFlags  flags = FILE_CREATE_NONE 
)

Replaces the contents of the file with contents of length bytes.

If etag is specified (not 0) any existing file must have that etag, or the error IO_ERROR_WRONG_ETAG will be returned.

If make_backup is true, this function will attempt to make a backup of the file.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

The returned new_etag can be used to verify that the file hasn't changed the next time it is saved over.

Parameters:
contents A string containing the new contents for the file.
length The length of contents in bytes.
etag The old entity tag for the document.
make_backup true if a backup should be created.
flags A set of FileCreateFlags.
new_etag A location to a new entity tag for the document.
cancellable A Cancellable object.

void Gio::File::replace_contents ( const char *  contents,
gsize  length,
const std::string etag,
std::string new_etag,
bool  make_backup = false,
FileCreateFlags  flags = FILE_CREATE_NONE 
)

Replaces the contents of the file with contents of length bytes.

If etag is specified (not 0) any existing file must have that etag, or the error IO_ERROR_WRONG_ETAG will be returned.

If make_backup is true, this function will attempt to make a backup of the file.

The returned new_etag can be used to verify that the file hasn't changed the next time it is saved over.

Parameters:
contents A string containing the new contents for the file.
length The length of contents in bytes.
etag The old entity tag for the document.
make_backup true if a backup should be created.
flags A set of FileCreateFlags.
new_etag A location to a new entity tag for the document.

void Gio::File::replace_contents ( const std::string contents,
const std::string etag,
std::string new_etag,
const Glib::RefPtr<Cancellable>&  cancellable,
bool  make_backup = false,
FileCreateFlags  flags = FILE_CREATE_NONE 
)

Replaces the contents of the file with contents.

If etag is specified (not 0) any existing file must have that etag, or the error IO_ERROR_WRONG_ETAG will be returned.

If make_backup is true, this function will attempt to make a backup of the file.

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

The returned new_etag can be used to verify that the file hasn't changed the next time it is saved over.

Parameters:
contents A string containing the new contents for the file.
etag The old entity tag for the document.
make_backup true if a backup should be created.
flags A set of FileCreateFlags.
new_etag A location to a new entity tag for the document.
cancellable A Cancellable object.

void Gio::File::replace_contents ( const std::string contents,
const std::string etag,
std::string new_etag,
bool  make_backup = false,
FileCreateFlags  flags = FILE_CREATE_NONE 
)

Replaces the contents of the file with contents.

If etag is specified (not 0) any existing file must have that etag, or the error IO_ERROR_WRONG_ETAG will be returned.

If make_backup is true, this function will attempt to make a backup of the file.

The returned new_etag can be used to verify that the file hasn't changed the next time it is saved over.

Parameters:
contents A string containing the new contents for the file.
etag The old entity tag for the document.
make_backup true if a backup should be created.
flags A set of FileCreateFlags.
new_etag A location to a new entity tag for the document.

void Gio::File::replace_contents_async ( const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable,
const char *  contents,
gsize  length,
const std::string etag,
bool  make_backup = false,
FileCreateFlags  flags = FILE_CREATE_NONE 
)

Starts an asynchronous replacement of the file with the given of bytes.

will replace the document's current entity tag.

When this operation has completed, slot will be called and the operation can be finalized with replace_contents_finish().

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

If make_backup is true, this function will attempt to make a backup of the file.

Parameters:
slot,: A callback to call when the request is satisfied.
cancellable A Cancellable object.
contents String of contents to replace the file with.
length The length of contents in bytes.
etag a new entity tag for the file.
make_backup true if a backup should be created.
flags A set of FileCreateFlags.

void Gio::File::replace_contents_async ( const SlotAsyncReady slot,
const char *  contents,
gsize  length,
const std::string etag,
bool  make_backup = false,
FileCreateFlags  flags = FILE_CREATE_NONE 
)

Starts an asynchronous replacement of the file with the given of bytes.

will replace the document's current entity tag.

When this operation has completed, slot will be called and the operation can be finalized with replace_contents_finish().

If make_backup is true, this function will attempt to make a backup of the file.

Parameters:
slot,: A callback to call when the request is satisfied.
contents String of contents to replace the file with.
length The length of contents in bytes.
etag a new entity tag for the file.
make_backup true if a backup should be created.
flags A set of FileCreateFlags.

void Gio::File::replace_contents_async ( const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>&  cancellable,
const std::string contents,
const std::string etag,
bool  make_backup = false,
FileCreateFlags  flags = FILE_CREATE_NONE 
)

Starts an asynchronous replacement of the file with the given of bytes.

will replace the document's current entity tag.

When this operation has completed, slot will be called and the operation can be finalized with replace_contents_finish().

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

If make_backup is true, this function will attempt to make a backup of the file.

Parameters:
slot,: A callback to call when the request is satisfied.
cancellable A Cancellable object.
contents String of contents to replace the file with.
etag a new entity tag for the file.
make_backup true if a backup should be created.
flags A set of FileCreateFlags.

void Gio::File::replace_contents_async ( const SlotAsyncReady slot,
const std::string contents,
const std::string etag,
bool  make_backup = false,
FileCreateFlags  flags = FILE_CREATE_NONE 
)

Starts an asynchronous replacement of the file with the given contents.

etag will replace the document's current entity tag.

When this operation has completed, slot will be called and the operation can be finalized with replace_contents_finish().

The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IO_ERROR_CANCELLED will be returned.

If make_backup is true, this function will attempt to make a backup of the file.

Parameters:
slot,: A callback to call when the request is satisfied.
contents String of contents to replace the file with.
etag a new entity tag for the file.
make_backup true if a backup should be created.
flags A set of FileCreateFlags.

void Gio::File::replace_contents_finish ( const Glib::RefPtr<AsyncResult>&  result,
std::string etag 
)

Finishes an asynchronous replace of the given file .

See replace_contents_async(). Sets new_etag to the new entity tag for the document.

Parameters:
result A AsyncResult.
new_etag A location of a new entity tag for the document.

void Gio::File::replace_contents_finish ( const Glib::RefPtr<AsyncResult>&  result  ) 

Finishes an asynchronous replace of the given file .

See replace_contents_async(). Sets new_etag to the new entity tag for the document.

Parameters:
result A AsyncResult. for the document.

virtual Glib::RefPtr<File> Gio::File::dup_vfunc (  )  [virtual]

virtual guint Gio::File::hash_vfunc (  )  const [virtual]

virtual std::string Gio::File::get_basename_vfunc (  )  const [virtual]

virtual std::string Gio::File::get_path_vfunc (  )  const [virtual]

virtual std::string Gio::File::get_uri_vfunc (  )  const [virtual]

virtual std::string Gio::File::get_parse_name_vfunc (  )  const [virtual]

virtual bool Gio::File::contains_file_vfunc ( const Glib::RefPtr<File>&  descendant  )  const [virtual]

virtual std::string Gio::File::get_relative_path_vfunc ( const Glib::RefPtr<File>&  descendant  )  const [virtual]

virtual bool Gio::File::is_native_vfunc (  )  const [virtual]

virtual bool Gio::File::has_uri_scheme_vfunc ( const std::string uri_scheme  )  const [virtual]


Friends And Related Function Documentation

Glib::RefPtr<Gio::File> wrap ( GFile *  object,
bool  take_copy = false 
) [related]

A Glib::wrap() method for this object.

Parameters:
object The C instance.
take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns:
A C++ instance that wraps this C instance.


The documentation for this class was generated from the following file:

Generated for glibmm 2.4 by Doxygen 1.5.1 © 1997-2001