mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-11-05 16:04:31 +00:00
file: make nautilus_file_get_keywords() private
No need to export this, since the only caller is inside nautilus-file.c
This commit is contained in:
parent
61d09c72b0
commit
244b0c2896
2 changed files with 50 additions and 52 deletions
|
@ -6401,6 +6401,56 @@ nautilus_file_is_launchable (NautilusFile *file)
|
|||
!nautilus_file_is_directory (file);
|
||||
}
|
||||
|
||||
static GList *
|
||||
sort_keyword_list_and_remove_duplicates (GList *keywords)
|
||||
{
|
||||
GList *p;
|
||||
GList *duplicate_link;
|
||||
|
||||
if (keywords != NULL) {
|
||||
keywords = g_list_sort (keywords, (GCompareFunc) g_utf8_collate);
|
||||
|
||||
p = keywords;
|
||||
while (p->next != NULL) {
|
||||
if (strcmp ((const char *) p->data, (const char *) p->next->data) == 0) {
|
||||
duplicate_link = p->next;
|
||||
keywords = g_list_remove_link (keywords, duplicate_link);
|
||||
g_list_free_full (duplicate_link, g_free);
|
||||
} else {
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_file_get_keywords
|
||||
*
|
||||
* Return this file's keywords.
|
||||
* @file: NautilusFile representing the file in question.
|
||||
*
|
||||
* Returns: A list of keywords.
|
||||
*
|
||||
**/
|
||||
static GList *
|
||||
nautilus_file_get_keywords (NautilusFile *file)
|
||||
{
|
||||
GList *keywords;
|
||||
|
||||
if (file == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
|
||||
|
||||
keywords = eel_g_str_list_copy (file->details->extension_emblems);
|
||||
keywords = g_list_concat (keywords, eel_g_str_list_copy (file->details->pending_extension_emblems));
|
||||
keywords = g_list_concat (keywords, nautilus_file_get_metadata_list (file, NAUTILUS_METADATA_KEY_EMBLEMS));
|
||||
|
||||
return sort_keyword_list_and_remove_duplicates (keywords);
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_file_get_emblem_icons
|
||||
|
@ -6466,57 +6516,6 @@ nautilus_file_get_emblem_icons (NautilusFile *file)
|
|||
return icons;
|
||||
}
|
||||
|
||||
static GList *
|
||||
sort_keyword_list_and_remove_duplicates (GList *keywords)
|
||||
{
|
||||
GList *p;
|
||||
GList *duplicate_link;
|
||||
|
||||
if (keywords != NULL) {
|
||||
keywords = g_list_sort (keywords, (GCompareFunc) g_utf8_collate);
|
||||
|
||||
p = keywords;
|
||||
while (p->next != NULL) {
|
||||
if (strcmp ((const char *) p->data, (const char *) p->next->data) == 0) {
|
||||
duplicate_link = p->next;
|
||||
keywords = g_list_remove_link (keywords, duplicate_link);
|
||||
g_list_free_full (duplicate_link, g_free);
|
||||
} else {
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_file_get_keywords
|
||||
*
|
||||
* Return this file's keywords.
|
||||
* @file: NautilusFile representing the file in question.
|
||||
*
|
||||
* Returns: A list of keywords.
|
||||
*
|
||||
**/
|
||||
GList *
|
||||
nautilus_file_get_keywords (NautilusFile *file)
|
||||
{
|
||||
GList *keywords;
|
||||
|
||||
if (file == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
|
||||
|
||||
keywords = eel_g_str_list_copy (file->details->extension_emblems);
|
||||
keywords = g_list_concat (keywords, eel_g_str_list_copy (file->details->pending_extension_emblems));
|
||||
keywords = g_list_concat (keywords, nautilus_file_get_metadata_list (file, NAUTILUS_METADATA_KEY_EMBLEMS));
|
||||
|
||||
return sort_keyword_list_and_remove_duplicates (keywords);
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_file_is_symbolic_link
|
||||
*
|
||||
|
|
|
@ -205,7 +205,6 @@ NautilusRequestStatus nautilus_file_get_deep_counts (Nautilu
|
|||
gboolean nautilus_file_should_show_thumbnail (NautilusFile *file);
|
||||
gboolean nautilus_file_should_show_directory_item_count (NautilusFile *file);
|
||||
gboolean nautilus_file_should_show_type (NautilusFile *file);
|
||||
GList * nautilus_file_get_keywords (NautilusFile *file);
|
||||
GList * nautilus_file_get_emblem_icons (NautilusFile *file);
|
||||
char * nautilus_file_get_top_left_text (NautilusFile *file);
|
||||
char * nautilus_file_peek_top_left_text (NautilusFile *file,
|
||||
|
|
Loading…
Reference in a new issue