gnomevfs Functions
Prev | The gnomevfs class reference | Next

## gnomevfs Functions

gnomevfs Functions — Additional functions which are not part of a class.

## Synopsis

        def gnomevfs.create(uri, open_mode=gnomevfs.OPEN_NONE, exclusive=False, perm=0666)
        def gnomevfs.get_file_info(uri, options=gnomevfs.FILE_INFO_DEFAULT)
        def gnomevfs.set_file_info(uri, info, mask=gnomevfs.SET_FILE_INFO_NONE)
        def gnomevfs.truncate(uri, length)
        def gnomevfs.make_directory(uri, perm)
        def gnomevfs.remove_directory(uri)
        def gnomevfs.unlink(uri)
        def gnomevfs.exists(uri)
        def gnomevfs.format_file_size_for_display(size)
        def gnomevfs.get_mime_type(uri)
        def gnomevfs.get_mime_type_for_data(data)
        def gnomevfs.mime_get_icon(mime_type)
        def gnomevfs.mime_set_icon()
        def gnomevfs.mime_get_description(mime_type)
        def gnomevfs.mime_set_description()
        def gnomevfs.mime_can_be_executable(mime_type)
        def gnomevfs.mime_set_can_be_executable()
        def gnomevfs.monitor_add(text_uri, monitor_type, callback, user_data=None)
        def gnomevfs.monitor_cancel(id)
        def gnomevfs.read_entire_file(text_uri)
        def gnomevfs.mime_get_default_application(mime_type)
        def gnomevfs.xfer_uri()
        def gnomevfs.xfer_uri_list()
        def gnomevfs.xfer_delete_list()
        def gnomevfs.mime_get_default_action_type()
        def gnomevfs.mime_get_default_action()
        def gnomevfs.mime_get_default_component()
        def gnomevfs.mime_get_short_list_components()
        def gnomevfs.mime_get_short_list_applications()
        def gnomevfs.mime_get_all_applications()
        def gnomevfs.mime_get_all_components()
        def gnomevfs.mime_set_default_action_type()
        def gnomevfs.mime_set_default_application()
        def gnomevfs.mime_set_default_component()
        def gnomevfs.mime_set_short_list_applications()
        def gnomevfs.mime_set_short_list_components()
        def gnomevfs.mime_add_application_to_short_list()
        def gnomevfs.mime_remove_application_from_short_list()
        def gnomevfs.mime_add_component_to_short_list()
        def gnomevfs.mime_remove_component_from_short_list()
        def gnomevfs.mime_add_extension()
        def gnomevfs.mime_remove_extension()
        def gnomevfs.mime_extend_all_applications()
        def gnomevfs.mime_remove_from_all_applications()
        def gnomevfs.mime_application_new_from_id()
        def gnomevfs.connect_to_server()
        def gnomevfs.escape_string()
        def gnomevfs.escape_path_string()
        def gnomevfs.escape_host_and_path_string()
        def gnomevfs.escape_slashes()
        def gnomevfs.escape_set()
        def gnomevfs.unescape_string()
        def gnomevfs.make_uri_canonical()
        def gnomevfs.make_path_name_canonical()
        def gnomevfs.unescape_string_for_display()
        def gnomevfs.get_local_path_from_uri()
        def gnomevfs.get_uri_from_local_path()
        def gnomevfs.is_executable_command_string()
        def gnomevfs.get_volume_free_space()
        def gnomevfs.icon_path_from_filename()
        def gnomevfs.open_fd()
        def gnomevfs.is_primary_thread()
        def gnomevfs.format_uri_for_display()
        def gnomevfs.make_uri_from_input()
        def gnomevfs.make_uri_from_input_with_dirs()
        def gnomevfs.make_uri_canonical_strip_fragment()
        def gnomevfs.uris_match()
        def gnomevfs.get_uri_scheme()
        def gnomevfs.make_uri_from_shell_arg()
        def gnomevfs.url_show()
        def gnomevfs.resolve()
        def gnomevfs.dns_sd_browse_sync()
        def gnomevfs.dns_sd_resolve_sync()
        def gnomevfs.dns_sd_list_browse_domains_sync()
        def gnomevfs.get_default_browse_domains()

## Description

These functions are part of the gnomevfs module but are not associated with a specific class.

## Functions

### gnomevfs.create

                def gnomevfs.create(uri, open_mode=gnomevfs.OPEN_NONE, exclusive=False, perm=0666)

`uri`: | The URI to create.
`open_mode`: | Mode to leave the file in after creation (or gnomevfs.OPEN_MODE_NONE to leave the file closed).
`exclusive`: | Whether the file should be created in "exclusive" mode. i.e. if this flag is nonzero, The operation will fail if a file with the same name already exists.
`perm`: | Or'd set of file permissions flags
Returns: | A gnomevfs.Handle.

Create and open `uri` according to `open_mode`.

### gnomevfs.get_file_info

                def gnomevfs.get_file_info(uri, options=gnomevfs.FILE_INFO_DEFAULT)

`uri`: | The URI to retrieve information for.
`options`: | Or'd set of file info options.
Returns: | A gnomevfs.FileInfo

Retrieve information about `uri`.

### gnomevfs.set_file_info

                def gnomevfs.set_file_info(uri, info, mask=gnomevfs.SET_FILE_INFO_NONE)

`uri`: | The URI to set information on.
`info`: | gnomevfs.FileInfo with the information to set.
`mask`: | Or'd set of file info set flags.

Set file information for `uri`. Only the information for which the corresponding bit in `mask` is set is actually modified.

### gnomevfs.truncate

                def gnomevfs.truncate(uri, length)

`uri`: | The URI of the file to truncate.
`length`: | The length to truncate to.

Truncate a file to a specific length.

### gnomevfs.make_directory

                def gnomevfs.make_directory(uri, perm)

`uri`: | The URI of the directory to create.
`perm`: | Or'd set of file permissions flags.

Create a directory with the given name and permissions.

### gnomevfs.remove_directory

                def gnomevfs.remove_directory(uri)

`uri`: | The URI of the directory to remove.

Remove a directory.

### gnomevfs.unlink

                def gnomevfs.unlink(uri)

`uri`: | The URI of the file to unlink

Unlink (delete) a URI.

### gnomevfs.exists

                def gnomevfs.exists(uri)

`uri`: | The URI to check.
Returns: | True if the URI exists.

Check if a given URI exists.

### gnomevfs.format_file_size_for_display

                def gnomevfs.format_file_size_for_display(size)

`size`: | The size of the file in bytes
Returns: | A string with the printable size

Formats `size` in a way that is easy for the user to read. Gives the size in bytes, kilobytes, megabytes or gigabytes, choosing whatever is appropriate.

### gnomevfs.get_mime_type

                def gnomevfs.get_mime_type(uri)

`uri`: | The URI to retrieve the mime type for.
Returns: | A string containing the mime type.

Determine the mime type of `uri`. The mime type is determined in the same way as by gnomevfs.get_file_info.

### gnomevfs.get_mime_type_for_data

`data`: | A string containing the data.
Returns: | A string containing the mime type.

Tries to guess the mime type of the data in `data` using magic patterns.

### gnomevfs.mime_get_icon

                def gnomevfs.mime_get_icon(mime_type)

`mime_type`: | A string with the mime type.
Returns: | A string with an icon name.

Query the MIME database for an icon representing `mime_type`. It usually returns a filename without path information, e.g. "i-chardev.png", and sometimes does not have an extension, e.g. "i-regular" if the icon is supposed to be image type agnostic between icon themes. Icons are generic and not theme specific. These will not necessarily match with the icons a user sees in Nautilus, you have been warned.

### gnomevfs.mime_get_description

                def gnomevfs.mime_get_description(mime_type)

`mime_type`: | The mime type to query.
Returns: | A description of the mime type.

Query the MIME database for a description of `mime_type`.

### gnomevfs.mime_can_be_executable

                def gnomevfs.mime_can_be_executable(mime_type)

`mime_type`: | The mime type to query.
Returns: | True if files of `mime_type` can be executable, False otherwise.

Check whether files of `mime_type` might conceivably be executable. Default for known types is False. Default for unknown types is True.

### gnomevfs.monitor_add

                def gnomevfs.monitor_add(text_uri, monitor_type, callback, extra=None)

`text_uri`: | String representing the URI to monitor.
`monitor_type`: | A monitor type signifying the type of the URI.
`callback`: | Function to call when the monitor is tripped.
`user_data`: | Data to pass to `callback`
Returns: | An identifier representing this monitor.

Watch the file or directory at `text_uri` for changes (or the creation/deletion of the file) and call `callback` when there is a change. If a directory monitor is added, `callback` is notified when any file in the directory changes.

### gnomevfs.monitor_cancel

                def gnomevfs.monitor_cancel(id)

`id`: | Identifier which was given by monitor_add

Cancel the monitor pointed to by `id`

### gnomevfs.read_entire_file

                def gnomevfs.read_entire_file(text_uri)

`text_uri`: | String containing the URI of the file to read.
Returns: | String containing the data in the file.

Reads an entire file into memory for convenience. Beware of accidentally loading large files into memory with this function.

### gnomevfs.mime_get_default_application

                def gnomevfs.mime_get_default_application(mime_type)

`mime_type`: | Mime type to query.
Returns: | Information about the application configured as the default handler for `mime_type`.

Query the MIME database for the default Bonobo component to be activated to view files of MIME type `mime_type`

Prev | Up | Next
gnomevfs.Volume | Home | gnomevfs Constants