int mime_type_get_mime_type_for_file(const char *file_path, char **mime_type);
/**
- * @brief Gets the icon name for the given MIME type.
- *
- * @since_tizen 4.0
- * @remarks The @a icon must be released with free() by you.
- * @param[in] mime_type The MIME type
- * @param[out] icon The icon name for the given MIME type
- * @return 0 on success, otherwise a negative error value.
- * @retval #MIME_TYPE_ERROR_NONE Successful
- * @retval #MIME_TYPE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MIME_TYPE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MIME_TYPE_ERROR_IO_ERROR Internal I/O error
- * @see mime_type_get_mime_type()
- */
-int mime_type_get_icon(const char *mime_type, char **icon);
-
-/**
- * @brief Gets the generic icon name for the given MIME type.
- *
- * @since_tizen 4.0
- * @remarks The @a generic_icon must be released with free() by you.
- * @param[in] mime_type The MIME type
- * @param[out] generic_icon The generic icon name for the given MIME type
- * @return 0 on success, otherwise a negative error value.
- * @retval #MIME_TYPE_ERROR_NONE Successful
- * @retval #MIME_TYPE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MIME_TYPE_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MIME_TYPE_ERROR_IO_ERROR Internal I/O error
- * @see mime_type_get_mime_type()
- */
-int mime_type_get_generic_icon(const char *mime_type, char **generic_icon);
-
-
-
-/**
* @}
*/
return MIME_TYPE_ERROR_NONE;
}
-int mime_type_get_icon(const char *mime_type, char **icon)
-{
- const char *xdg_icon = NULL;
-
- if (mime_type == NULL || icon == NULL)
- return mime_type_error(MIME_TYPE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- xdg_icon = xdg_mime_get_icon(mime_type);
-
- if (xdg_icon == NULL)
- return mime_type_error(MIME_TYPE_ERROR_IO_ERROR, __FUNCTION__, "failed to get the icon from the shared MIME database");
-
- char *icon_dup = NULL;
-
- icon_dup = strdup(xdg_icon);
-
- if (icon_dup == NULL)
- return mime_type_error(MIME_TYPE_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-
- *icon = icon_dup;
-
- return MIME_TYPE_ERROR_NONE;
-}
-
-int mime_type_get_generic_icon(const char *mime_type, char **generic_icon)
-{
- const char *xdg_icon = NULL;
-
- if (mime_type == NULL || generic_icon == NULL)
- return mime_type_error(MIME_TYPE_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- xdg_icon = xdg_mime_get_generic_icon(mime_type);
-
- if (xdg_icon == NULL)
- return mime_type_error(MIME_TYPE_ERROR_IO_ERROR, __FUNCTION__, "failed to get the generic icon from the shared MIME database");
-
- char *icon_dup = NULL;
-
- icon_dup = strdup(xdg_icon);
-
- if (icon_dup == NULL)
- return mime_type_error(MIME_TYPE_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-
- *generic_icon = icon_dup;
-
- return MIME_TYPE_ERROR_NONE;
-}