* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <locale.h>
+
#include "main.h"
#include "metadata.h"
{
gboolean success;
ExifData *exif;
+ guint lf;
g_assert(fd->change);
+ lf = strlen(GQ_CACHE_EXT_METADATA);
if (fd->change->dest &&
- strcmp(registered_extension_from_path(fd->change->dest), GQ_CACHE_EXT_METADATA) == 0)
+ g_ascii_strncasecmp(fd->change->dest + strlen(fd->change->dest) - lf, GQ_CACHE_EXT_METADATA, lf) == 0)
{
success = metadata_legacy_write(fd);
if (success) metadata_legacy_delete(fd, fd->change->dest);
(we can't wait until the sidecar is discovered by directory scanning because
exif_read_fd is called before that and it would read the main file only and
store the metadata in the cache)
- FIXME: this does not catch new sidecars created by independent external programs
+ */
+ /**
+ @FIXME this does not catch new sidecars created by independent external programs
*/
file_data_unref(file_data_new_group(fd->change->dest));
const GList *cache_entry;
if (!fd) return NULL;
- /* unwritten data overide everything */
+ /* unwritten data override everything */
if (fd->modified_xmp && format == METADATA_PLAIN)
{
list = g_hash_table_lookup(fd->modified_xmp, key);
{
return g_list_append(NULL, metadata_file_info(fd, key, format));
}
+#ifdef HAVE_LUA
+ else if (strncmp(key, "lua.", 4) == 0)
+ {
+ return g_list_append(NULL, metadata_lua_info(fd, key, format));
+ }
+#endif
exif = exif_read_fd(fd); /* this is cached, thus inexpensive */
if (!exif) return NULL;
return ret;
}
+gchar *metadata_read_rating_stars(FileData *fd)
+{
+ gchar *ret;
+ gint n = metadata_read_int(fd, RATING_KEY, METADATA_PLAIN);
+
+ ret = convert_rating_to_stars(n);
+
+ return ret;
+}
+
gdouble metadata_read_GPS_coord(FileData *fd, const gchar *key, gdouble fallback)
{
gdouble coord;
char *coordinate;
char *ref;
gboolean ok = TRUE;
+ char *old_locale, *saved_locale;
param = value;
if (param < 0)
if (ok)
{
+ /* Avoid locale problems with commas and decimal points in numbers */
+ old_locale = setlocale(LC_ALL, NULL);
+ saved_locale = strdup(old_locale);
+ if (saved_locale == NULL)
+ {
+ return FALSE;
+ }
+ setlocale(LC_ALL, "C");
+
coordinate = g_strdup_printf("%i,%lf,%s", deg, min, ref);
metadata_write_string(fd, key, coordinate );
+
+ setlocale(LC_ALL, saved_locale);
+ free(saved_locale);
g_free(coordinate);
}
}
/**
- * \see find_string_in_list
+ * @see find_string_in_list
*/
gchar *find_string_in_list_utf8nocase(GList *list, const gchar *string)
{
}
/**
- * \see find_string_in_list
+ * @see find_string_in_list
*/
gchar *find_string_in_list_utf8case(GList *list, const gchar *string)
{
} // gchar *find_string_in_list_utf...
/**
- * \brief Find a existent string in a list.
+ * @brief Find a existent string in a list.
*
* This is a switch between find_string_in_list_utf8case and
* find_string_in_list_utf8nocase to search with or without case for the
* existence of a string.
*
- * \param list The list to search in
- * \param string The string to search for
- * \return The string or NULL
+ * @param list The list to search in
+ * @param string The string to search for
+ * @return The string or NULL
*
- * \see find_string_in_list_utf8case
- * \see find_string_in_list_utf8nocase
+ * @see find_string_in_list_utf8case
+ * @see find_string_in_list_utf8nocase
*/
gchar *find_string_in_list(GList *list, const gchar *string)
{
gboolean meta_data_get_keyword_mark(FileData *fd, gint n, gpointer data)
{
- /* FIXME: do not use global keyword_tree */
+ /** @FIXME do not use global keyword_tree */
GList *path = data;
GList *keywords;
gboolean found = FALSE;
WRITE_NL(); WRITE_STRING("</keyword_tree>");
}
+ void keyword_tree_node_disconnect_marks(GtkTreeModel *keyword_tree, GtkTreeIter *iter_ptr)
+{
+ GtkTreeIter iter = *iter_ptr;
+
+ while (TRUE)
+ {
+ GtkTreeIter children;
+
+ meta_data_connect_mark_with_keyword((keyword_tree), &iter, -1);
+
+ if (gtk_tree_model_iter_children((keyword_tree), &children, &iter))
+ {
+ keyword_tree_node_disconnect_marks((keyword_tree), &children);
+ }
+
+ if (!gtk_tree_model_iter_next((keyword_tree), &iter)) return;
+ }
+}
+
+void keyword_tree_disconnect_marks()
+{
+ GtkTreeIter iter;
+
+ if (keyword_tree && gtk_tree_model_get_iter_first(GTK_TREE_MODEL(keyword_tree), &iter))
+ {
+ keyword_tree_node_disconnect_marks(GTK_TREE_MODEL(keyword_tree), &iter);
+ }
+}
+
GtkTreeIter *keyword_add_from_config(GtkTreeStore *keyword_tree, GtkTreeIter *parent, const gchar **attribute_names, const gchar **attribute_values)
{
gchar *name = NULL;