/* Sort an array of tags on the specified attribuites using the inbuilt comparison function. @param tags_array The array of tags to be sorted @param sort_attributes Attributes to be sorted on (int array terminated by 0) @param dedup Whether to deduplicate the sorted array */ void tm_tags_sort(GPtrArray *tags_array, TMTagAttrType *sort_attributes, gboolean dedup, gboolean unref_duplicates) { TMSortOptions sort_options; g_return_if_fail(tags_array); sort_options.sort_attrs = sort_attributes; sort_options.cmp_len = -1; g_ptr_array_sort_with_data(tags_array, tm_tag_compare, &sort_options); if (dedup) tm_tags_dedup(tags_array, sort_attributes, unref_duplicates); }
/* Sort an array of tags on the specified attribuites using the inbuilt comparison function. @param tags_array The array of tags to be sorted @param sort_attributes Attributes to be sorted on (int array terminated by 0) @param dedup Whether to deduplicate the sorted array @return TRUE on success, FALSE on failure */ gboolean tm_tags_sort(GPtrArray *tags_array, TMTagAttrType *sort_attributes, gboolean dedup, gboolean unref_duplicates) { TMSortOptions sort_options; if ((!tags_array) || (!tags_array->len)) return TRUE; sort_options.sort_attrs = sort_attributes; sort_options.partial = FALSE; g_ptr_array_sort_with_data(tags_array, tm_tag_compare, &sort_options); if (dedup) tm_tags_dedup(tags_array, sort_attributes, unref_duplicates); return TRUE; }