f-spot r4160 - in trunk: . src
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4160 - in trunk: . src
- Date: Mon, 7 Jul 2008 09:47:14 +0000 (UTC)
Author: sdelcroix
Date: Mon Jul 7 09:47:14 2008
New Revision: 4160
URL: http://svn.gnome.org/viewvc/f-spot?rev=4160&view=rev
Log:
2008-07-07 Stephane Delcroix <sdelcroix novell com>
* TagCommands.cs:
* TagSelectionWidget.cs:
* TagStore.cs: create the transaction at the TagStore level, move
the EmitChanged call out of the transaction. Update the metadata
on tag renaming with F2, fixes bgo 517612.
Modified:
trunk/ChangeLog
trunk/src/TagCommands.cs
trunk/src/TagSelectionWidget.cs
trunk/src/TagStore.cs
Modified: trunk/src/TagCommands.cs
==============================================================================
--- trunk/src/TagCommands.cs (original)
+++ trunk/src/TagCommands.cs Mon Jul 7 09:47:14 2008
@@ -298,11 +298,7 @@
try {
t.Name = last_valid_name;
t.Category = categories [category_option_menu.History] as Category;
-
- db.BeginTransaction ();
db.Tags.Commit (t, orig_name != t.Name);
- db.CommitTransaction ();
-
success = true;
} catch (Exception ex) {
// FIXME error dialog.
Modified: trunk/src/TagSelectionWidget.cs
==============================================================================
--- trunk/src/TagSelectionWidget.cs (original)
+++ trunk/src/TagSelectionWidget.cs Mon Jul 7 09:47:14 2008
@@ -514,7 +514,7 @@
}
tag.Name = args.NewText;
- tag_store.Commit (tag);
+ tag_store.Commit (tag, true);
text_render.Edited -= HandleTagNameEdited;
Modified: trunk/src/TagStore.cs
==============================================================================
--- trunk/src/TagStore.cs (original)
+++ trunk/src/TagStore.cs Mon Jul 7 09:47:14 2008
@@ -365,6 +365,11 @@
{
Tag tag = item as Tag;
+ bool use_transactions = !Database.InTransaction && update_xmp;
+
+ if (use_transactions)
+ Database.BeginTransaction ();
+
Database.ExecuteNonQuery (new DbCommand ("UPDATE tags SET name = :name, category_id = :category_id, "
+ "is_category = :is_category, sort_priority = :sort_priority, icon = :icon WHERE id = :id",
"name", tag.Name,
@@ -374,13 +379,15 @@
"icon", GetIconString (tag),
"id", tag.Id));
- EmitChanged (tag);
-
if (update_xmp && Preferences.Get<bool> (Preferences.METADATA_EMBED_IN_IMAGE)) {
Photo [] photos = Core.Database.Photos.Query (new Tag [] { tag });
- foreach (Photo p in photos) {
+ foreach (Photo p in photos)
SyncMetadataJob.Create (Core.Database.Jobs, p);
- }
}
+
+ if (use_transactions)
+ Database.CommitTransaction ();
+
+ EmitChanged (tag);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]