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

gboolean hildon_uri_is_default_action_by_uri ( const gchar *  uri_str,
HildonURIAction *  action,
GError **  error 

hildon_uri_action_is_default_action_by_uri: : A const pointer to a URI. : 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 1818 of file hildon-uri.c.

References hildon_uri_action_unref(), and hildon_uri_get_default_action_by_uri().

Referenced by hildon_uri_get_actions_by_uri().

      HildonURIAction *default_action;
      gboolean         equal = FALSE;

      g_return_val_if_fail (uri_str != NULL, FALSE);
      g_return_val_if_fail (action != NULL, FALSE);

      default_action = hildon_uri_get_default_action_by_uri (uri_str, error);

      DEBUG_MSG (("URI: Checking desktop file is default by uri:'%s' 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 by uri:'%s':\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