CreateReparentedVersion() public method

public CreateReparentedVersion ( FSpot.PhotoVersion version ) : uint
version FSpot.PhotoVersion
return uint
        public bool Execute(PhotoStore store, Photo [] photos, Photo new_parent, Gtk.Window parent_window)
        {
            string ok_caption = Catalog.GetString ("Re_parent");
            string msg = String.Format (Catalog.GetPluralString ("Really reparent \"{0}\" as version of \"{1}\"?",
                                                                 "Really reparent {2} photos as versions of \"{1}\"?", photos.Length),
                                        new_parent.Name.Replace ("_", "__"), photos[0].Name.Replace ("_", "__"), photos.Length);
            string desc = Catalog.GetString ("This makes the photos appear as a single one in the library. The versions can be detached using the Photo menu.");

            try {
                if (ResponseType.Ok == HigMessageDialog.RunHigConfirmation(parent_window, DialogFlags.DestroyWithParent,
                                       MessageType.Warning, msg, desc, ok_caption)) {
                    uint highest_rating = new_parent.Rating;
                    string new_description = new_parent.Description;
                    foreach (Photo photo in photos) {
                        highest_rating = Math.Max(photo.Rating, highest_rating);
                        if (string.IsNullOrEmpty(new_description))
                            new_description = photo.Description;
                        new_parent.AddTag (photo.Tags);

                        foreach (uint version_id in photo.VersionIds) {
                            new_parent.DefaultVersionId = new_parent.CreateReparentedVersion (photo.GetVersion (version_id) as PhotoVersion);
                            store.Commit (new_parent);
                        }
                        uint [] version_ids = photo.VersionIds;
                        Array.Reverse (version_ids);
                        foreach (uint version_id in version_ids) {
                            photo.DeleteVersion (version_id, true, true);
                        }
                        store.Remove (photo);
                    }
                    new_parent.Rating = highest_rating;
                    new_parent.Description = new_description;
                    store.Commit (new_parent);
                    return true;
                }
            }
            catch (Exception e) {
                HandleException ("Could not reparent photos", e, parent_window);
            }
            return false;
        }
 public bool Execute(PhotoStore store, Photo [] photos, Photo new_parent, Gtk.Window parent_window)
 {
     foreach (Photo photo in photos) {
         new_parent.AddTag (photo.Tags);
         foreach (uint version_id in photo.VersionIds) {
             try {
                 new_parent.DefaultVersionId = new_parent.CreateReparentedVersion (photo.GetVersion (version_id) as PhotoVersion);
                 store.Commit (new_parent);
             } catch (Exception e) {
                 Log.DebugException (e);
             }
         }
         uint [] version_ids = photo.VersionIds;
         Array.Reverse (version_ids);
         foreach (uint version_id in version_ids) {
             try {
                 photo.DeleteVersion (version_id, true, true);
             } catch (Exception e) {
                 Log.DebugException (e);
             }
         }
         MainWindow.Toplevel.Database.Photos.Remove (photo);
     }
     return true;
 }