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

gboolean hildon_uri_is_default_action ( HildonURIAction *  action,
GError **  error 

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

Return: The TRUE if it is the default action or FALSE.

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

References hildon_uri_action_unref(), and hildon_uri_get_default_action().

      HildonURIAction *default_action;
      gboolean       equal = FALSE;

      g_return_val_if_fail (action != NULL, FALSE);
      g_return_val_if_fail (action->scheme != NULL, FALSE);

      /* If new type of action we only need to make sure we have the
       * scheme to go on and we can then look for the default action
       * for that scheme in the old group ('Default Actions' in the
       * defaults file).
      if (action->id && !action->scheme) {
            return FALSE;

      default_action = hildon_uri_get_default_action (action->scheme, error);

      DEBUG_MSG (("URI: Checking desktop file is default for scheme:'%s':\n"
                default_action ? default_action->desktop_file : "",

            if (default_action && 
                default_action->desktop_file && 
                action->desktop_file) {
                  gchar *desktop_file1;
                  gchar *desktop_file2;

                  /* Change all "/" to "-" since there may be some differences here */
                  desktop_file1 = g_strdup (default_action->desktop_file);
                  g_strdelimit (desktop_file1, G_DIR_SEPARATOR_S, '-');
                  desktop_file2 = g_strdup (action->desktop_file);
                  g_strdelimit (desktop_file2, G_DIR_SEPARATOR_S, '-');

                  /* Compare desktop files to know if this is the same
                   * action as the default action.
                   * We compare the desktop file and the method since
                   * these two are what the dbus service will use to
                   * identify what is done with the action. 
                  if (default_action->name && action->name &&
                      default_action->method && action->method &&
                      strcmp (desktop_file1, desktop_file2) == 0 && 
                      strcmp (default_action->name, action->name) == 0 && 
                      strcmp (default_action->method, action->method) == 0) {
                        equal = TRUE;
                  DEBUG_MSG (("URI: Checking desktop file is default:\n"
                            "\tEQUAL = %s",
                            desktop_file1, desktop_file2,
                            default_action->name, action->name,
                            default_action->method, action->method,
                            equal ? "YES" : "NO"))

                  g_free (desktop_file1);
                  g_free (desktop_file2);

      if (default_action) {
            hildon_uri_action_unref (default_action);

      return equal;

Generated by  Doxygen 1.6.0   Back to index