Logo Search packages:      
Sourcecode: libhildonmime version File versions  Download package

gchar* hildon_uri_get_scheme_from_uri ( const gchar *  uri,
GError **  error 
)

hildon_uri_get_scheme_from_uri: : A const pointer to a URI. : The address of a pointer to a structure. This is optional and can be NULL.

This returns the scheme part of . An example of a scheme would be "http", "callto", "mailto", etc.

If NULL is returned and is non-NULL, it will hold the error that occurred while trying to obtain the scheme.

Return: A newly allocated pointer which must be freed with g_free().

Definition at line 1643 of file hildon-uri.c.

Referenced by hildon_uri_open().

{
      const gchar *error_str = NULL;

      if (uri) { 
            gchar *p;

            p = strstr (uri, ":");
            if (p) {
                  gchar *scheme;
                  gchar *scheme_lower;

                  scheme = g_strndup (uri, p - uri); 
                  scheme_lower = g_ascii_strdown (scheme, -1);
                  g_free (scheme);

                  return scheme_lower;
            } 
                  
            error_str = "No colon in the URI.";
      } else {
            error_str = "The URI was not specified.";
      }

      g_set_error (error,
                 HILDON_URI_ERROR,
                 HILDON_URI_INVALID_URI,
                 error_str);

      return NULL;
}


Generated by  Doxygen 1.6.0   Back to index