Author: post
Date: 2010-12-29 23:25:57 +0100 (Wed, 29 Dec 2010)
New Revision: 3727
Modified:
trunk/librawstudio/rs-library.c
trunk/librawstudio/rs-library.h
trunk/src/rs-actions.c
trunk/src/rs-tethered-shooting.c
Log:
Pass tag ID when adding tags to an image to avoid looking it up again.
Modified: trunk/librawstudio/rs-library.c
===================================================================
--- trunk/librawstudio/rs-library.c 2010-12-29 21:53:53 UTC (rev 3726)
+++ trunk/librawstudio/rs-library.c 2010-12-29 22:25:57 UTC (rev 3727)
@@ -623,24 +623,23 @@
}
void
-rs_library_photo_add_tag(RSLibrary *library, const gchar *filename, const
gchar *tagname, const gboolean autotag)
+rs_library_photo_add_tag(RSLibrary *library, const gchar *filename, gint
tag_id, const gboolean autotag)
{
g_assert(RS_IS_LIBRARY(library));
if (!rs_library_has_database_connection(library)) return;
- gint photo_id = 0, tag_id;
+ gint photo_id;
- photo_id = library_find_photo_id(library, filename);
- if (photo_id == -1)
+ if (tag_id == -1)
{
- g_warning("Photo not known...");
+ g_warning("Tag not known...");
return;
}
- tag_id = library_find_tag_id(library, tagname);
- if (tag_id == -1)
+ photo_id = library_find_photo_id(library, filename);
+ if (photo_id == -1)
{
- g_warning("Tag not known...");
+ g_warning("Photo not known...");
return;
}
Modified: trunk/librawstudio/rs-library.h
===================================================================
--- trunk/librawstudio/rs-library.h 2010-12-29 21:53:53 UTC (rev 3726)
+++ trunk/librawstudio/rs-library.h 2010-12-29 22:25:57 UTC (rev 3727)
@@ -47,7 +47,11 @@
RSLibrary *rs_library_get_singleton(void);
gint rs_library_add_photo(RSLibrary *library, const gchar *filename);
gint rs_library_add_tag(RSLibrary *library, const gchar *tagname);
-void rs_library_photo_add_tag(RSLibrary *library, const gchar *filename, const
gchar *tagname, const gboolean autotag);
+
+/* Links an image to a tag */
+/* You must have created the tag on beforehand using rs_library_add_tag */
+/* Pass the returned value as tag_id */
+void rs_library_photo_add_tag(RSLibrary *library, const gchar *filename, gint
tag_id, const gboolean autotag);
void rs_library_delete_photo(RSLibrary *library, const gchar *photo);
gboolean rs_library_delete_tag(RSLibrary *library, const gchar *tag, const
gboolean force);
GList *rs_library_search(RSLibrary *library, GList *tags);
Modified: trunk/src/rs-actions.c
===================================================================
--- trunk/src/rs-actions.c 2010-12-29 21:53:53 UTC (rev 3726)
+++ trunk/src/rs-actions.c 2010-12-29 22:25:57 UTC (rev 3727)
@@ -824,10 +824,10 @@
for(i = 0; i < g_list_length(tags); i++)
{
gchar *tag = (gchar *) g_list_nth_data(tags, i);
- rs_library_add_tag(library, tag);
+ gint tag_id = rs_library_add_tag(library, tag);
for(cur=0;cur<num_selected;cur++)
- rs_library_photo_add_tag(library,
g_list_nth_data(selected, cur), tag, FALSE);
+ rs_library_photo_add_tag(library,
g_list_nth_data(selected, cur), tag_id, FALSE);
g_free(tag);
}
rs_library_backup_tags(library, g_list_nth_data(selected,
num_selected-1));
Modified: trunk/src/rs-tethered-shooting.c
===================================================================
--- trunk/src/rs-tethered-shooting.c 2010-12-29 21:53:53 UTC (rev 3726)
+++ trunk/src/rs-tethered-shooting.c 2010-12-29 22:25:57 UTC (rev 3727)
@@ -409,8 +409,8 @@
int i = 0;
while (split_tags[i] != NULL)
{
- rs_library_add_tag(lib, split_tags[i]);
- rs_library_photo_add_tag(lib, photo->filename, split_tags[i],
FALSE);
+ gint tag_id = rs_library_add_tag(lib, split_tags[i]);
+ rs_library_photo_add_tag(lib, photo->filename, tag_id, FALSE);
i++;
}
g_strfreev(split_tags);
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit