ROX-CLib: uri.h File Reference

- Main Page
- Data Structures
- Files
- Related Pages

- File List
- Globals

# uri.h File Reference

Utilities for uri handling and launching. More...

## Functions
gchar * | rox_unescape_uri (const char *uri)
gchar * | rox_encode_path_as_uri (const guchar *path)
gchar * | rox_escape_uri_path (const char *path)
gchar * | rox_uri_get_handler (const char *scheme)
int | rox_uri_launch_handler (const char *uri, gboolean block, GError **err)
int | rox_uri_launch (const char *uri)
const char * | rox_hostname (void)

## Detailed Description

Utilities for uri handling and launching.

Author:
  Stephen Watson

Version:
  Id
    uri.h,v 1.3 2007/01/29 12:41:10 stephen Exp

## Function Documentation

gchar* rox_encode_path_as_uri | ( | const guchar * | path | ) |

Convert a local path into a file: URI with problematic characters replaced with %xx escapes.

Parameters:

  `[in]` | path | to encode

Returns:
  the converted URI, pass to g_free() when done.

gchar* rox_escape_uri_path | ( | const char * | path | ) |

Escape path for future use in URI by replacing problematic characters with a %xx escape sequence.

Parameters:

  `[in]` | path | path to be escaped

Returns:
  escaped path, pass to g_free() when done.

const char* rox_hostname | ( | void |  | ) |

Return the canonical hostname for use in drag and drop.

Returns:
  host name

gchar* rox_unescape_uri | ( | const char * | uri | ) |

Convert a URI with %xx escapes into one without

Parameters:

  `[in]` | uri | URI to be converted.

Returns:
  converted URI, pass to g_free() when done.

gchar* rox_uri_get_handler | ( | const char * | scheme | ) |

Return the handler for URI's of the named scheme (e.g. http, file, ftp, etc.) The handler for file is always rox, otherwise it obtained from the configuration directory rox.sourceforge.net/URI.

Parameters:

  `[in]` | scheme | URI scheme to get handler for (do not include trailing ':' character)

Returns:
  Command to execute. The returned string may contain %s in which case it should be replaced with the URI, otherwise append the URI (after a space). Pass the string to g_free() when done. `NULL` is returned if no handler is defined.

int rox_uri_launch | ( | const char * | uri | ) |

Launch a URI. If there is a handler for the MIME type text/x-uri then that is executed with '-' as a single argument and the URI pass in on standard input. If there is no such handler then each of the following commands is tried in turn:

- gnome-moz-remote --newwin uri
- mozilla uri
- netscape uri

Parameters:

  `[in]` | uri | URI to launch

Returns:
  exit status of the last attempted command (0 for success).

Deprecated:
  use rox_uri_launch_handler() instead.

int rox_uri_launch_handler | ( | const char * | uri,
|  | gboolean | block,
|  | GError ** | err |
| ) |  |  |

For a given URI pass it to the appropriate launcher. rox_uri_get_handler() is used to look up the launcher command which is executed.

Parameters:

  `[in]` | uri | the URI to launch
  `[in]` | block | if `FALSE` then do not wait for command to complete, otherwise block until so.
  `[in,out]` | err | location to store error message when launching fails, or `NULL` to discard it

Returns:
  When block is true the process id of the command otherwise the exit status of the command, `-1` if no launcher is defined or `-2` if an error occured (check err).