Commit 51211546 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

filter metadata in the registration functions

moved the metadata filter in the metadata registration function to avoid duplicated code.
parent a33f1603
...@@ -226,10 +226,6 @@ set_file_info (GFileInfo *info, ...@@ -226,10 +226,6 @@ set_file_info (GFileInfo *info,
formatted_value_utf8 = g_locale_to_utf8 (formatted_clean, -1, NULL, NULL, NULL); formatted_value_utf8 = g_locale_to_utf8 (formatted_clean, -1, NULL, NULL, NULL);
} }
/*
g_print ("%s (%s): %s (%s)\n", key, description, formatted_value, raw_value);
*/
metadata_info = gth_main_get_metadata_info (attribute); metadata_info = gth_main_get_metadata_info (attribute);
if ((metadata_info == NULL) && (category != NULL)) { if ((metadata_info == NULL) && (category != NULL)) {
GthMetadataInfo info; GthMetadataInfo info;
...@@ -243,7 +239,7 @@ g_print ("%s (%s): %s (%s)\n", key, description, formatted_value, raw_value); ...@@ -243,7 +239,7 @@ g_print ("%s (%s): %s (%s)\n", key, description, formatted_value, raw_value);
metadata_info = gth_main_register_metadata_info (&info); metadata_info = gth_main_register_metadata_info (&info);
} }
if ((metadata_info->display_name == NULL) && (description_utf8 != NULL)) if ((metadata_info != NULL) && (metadata_info->display_name == NULL) && (description_utf8 != NULL))
metadata_info->display_name = g_strdup (description_utf8); metadata_info->display_name = g_strdup (description_utf8);
metadata = gth_metadata_new (); metadata = gth_metadata_new ();
......
...@@ -119,9 +119,6 @@ gth_file_properties_real_set_file (GthPropertyView *base, ...@@ -119,9 +119,6 @@ gth_file_properties_real_set_file (GthPropertyView *base,
if ((info->flags & GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW) != GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW) if ((info->flags & GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW) != GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW)
continue; continue;
if ((info->display_name == NULL) || (strstr (info->display_name, "0x") != NULL))
continue;
value = gth_file_data_get_attribute_as_string (file_data, info->id); value = gth_file_data_get_attribute_as_string (file_data, info->id);
if ((value == NULL) || (*value == '\0')) if ((value == NULL) || (*value == '\0'))
continue; continue;
......
...@@ -407,6 +407,9 @@ gth_main_register_metadata_info (GthMetadataInfo *metadata_info) ...@@ -407,6 +407,9 @@ gth_main_register_metadata_info (GthMetadataInfo *metadata_info)
{ {
GthMetadataInfo *info; GthMetadataInfo *info;
if ((metadata_info->display_name == NULL) || (strstr (metadata_info->display_name, "0x") != NULL))
return NULL;
g_static_mutex_lock (&metadata_info_mutex); g_static_mutex_lock (&metadata_info_mutex);
info = gth_metadata_info_dup (metadata_info); info = gth_metadata_info_dup (metadata_info);
...@@ -427,7 +430,8 @@ gth_main_register_metadata_info_v (GthMetadataInfo metadata_info[]) ...@@ -427,7 +430,8 @@ gth_main_register_metadata_info_v (GthMetadataInfo metadata_info[])
g_static_mutex_lock (&metadata_info_mutex); g_static_mutex_lock (&metadata_info_mutex);
for (i = 0; metadata_info[i].id != NULL; i++) for (i = 0; metadata_info[i].id != NULL; i++)
g_ptr_array_add (Main->priv->metadata_info, &metadata_info[i]); if ((metadata_info[i].display_name != NULL) && (strstr (metadata_info[i].display_name, "0x") == NULL))
g_ptr_array_add (Main->priv->metadata_info, &metadata_info[i]);
g_static_mutex_unlock (&metadata_info_mutex); g_static_mutex_unlock (&metadata_info_mutex);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment