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

gboolean hildon_uri_set_default_action ( const gchar *  scheme,
HildonURIAction *  action,
GError **  error 

hildon_uri_set_default_action: : A string which represents a scheme. : A pointer. : The address of a pointer to a structure. This is optional and can be NULL.

: Use () instead.

Sets the default which should be used with a when hildon_uri_open() is called. The can be obtained from a URI by calling hildon_uri_get_scheme_from_uri().

If is NULL, the default action is unset. It is important to note that ONLY the user's default actions are unset NOT the system default actions. The user's default actions are in $home/.local/share/applications/defaults.list (the system default actions are in $prefix/share/applications/defaults.list). This means that if you remove a user's default action, the system default will be used instead if there is one.

If FALSE is returned and is non-NULL, it will hold the error that occurred while trying to set the default .

Return: TRUE if it was successfully set or FALSE.

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

Referenced by hildon_uri_set_default_action_by_uri().

      const gchar *desktop_file = NULL;
      const gchar *action_id = NULL;
      gchar       *scheme_lower;
      gboolean     ok;

      if (!scheme || scheme[0] == '\0') {
            g_set_error (error,
                       "The scheme was not specified.");

            return FALSE;

      scheme_lower = g_ascii_strdown (scheme, -1);

      /* We can have a NULL action to remove the default action. */
      if (action && action->desktop_file && action->desktop_file[0] != '\0') {
            desktop_file = action->desktop_file;

      if (action && action->id && action->id[0] != '\0') {
            action_id = action->id;

      ok = uri_set_defaults_file (scheme_lower, NULL, desktop_file, action_id);
      if (!ok) {
            g_set_error (error,
                       "The defaults file could not be saved.");

      g_free (scheme_lower);

      return ok;

Generated by  Doxygen 1.6.0   Back to index