protected void DevelopPhoto(Photo p)
        {
            LoadPreference(UFRAW_JPEG_QUALITY_KEY);
            LoadPreference(UFRAW_ARGUMENTS_KEY);
            LoadPreference(UFRAW_BATCH_ARGUMENTS_KEY);

            PhotoVersion raw = p.GetVersion(Photo.OriginalVersionId) as PhotoVersion;

            if (!App.Instance.Container.Resolve <IImageFileFactory> ().IsRaw(raw.Uri))
            {
                Log.Warning("The original version of this image is not a (supported) RAW file");
                return;
            }

            string name = GetNextVersionFileName(p);

            System.Uri developed = GetUriForVersionFileName(p, name);
            string     idfile    = "";


            if (ufraw_jpeg_quality < 1 || ufraw_jpeg_quality > 100)
            {
                Log.Debug("Invalid JPEG quality specified, defaulting to quality 98");
                ufraw_jpeg_quality = 98;
            }

            string args = "";

            switch (executable)
            {
            case "ufraw":
                args += ufraw_args;
                if (GLib.FileFactory.NewForUri(Path.ChangeExtension(raw.Uri.ToString(), ".ufraw")).Exists)
                {
                    // We found an ID file, use that instead of the raw file
                    idfile = "--conf=" + GLib.Shell.Quote(Path.ChangeExtension(raw.Uri.LocalPath, ".ufraw"));
                }
                break;

            case "ufraw-batch":
                args += ufraw_batch_args;
                if (GLib.FileFactory.NewForUri(Path.Combine(Global.BaseDirectory, "batch.ufraw")).Exists)
                {
                    // We found an ID file, use that instead of the raw file
                    idfile = "--conf=" + GLib.Shell.Quote(Path.Combine(Global.BaseDirectory, "batch.ufraw"));
                }
                break;
            }

            args += String.Format(" --exif --overwrite --create-id=also --compression={0} --out-type=jpeg {1} --output={2} {3}",
                                  ufraw_jpeg_quality,
                                  idfile,
                                  GLib.Shell.Quote(developed.LocalPath),
                                  GLib.Shell.Quote(raw.Uri.LocalPath));
            Log.Debug(executable + " " + args);

            System.Diagnostics.Process ufraw = System.Diagnostics.Process.Start(executable, args);
            ufraw.WaitForExit();
            if (!(GLib.FileFactory.NewForUri(developed.ToString())).Exists)
            {
                Log.Warning("UFRaw quit with an error. Check that you have UFRaw 0.13 or newer. Or did you simply clicked on Cancel?");
                return;
            }

            if (GLib.FileFactory.NewForUri(Path.ChangeExtension(developed.ToString(), ".ufraw")).Exists)
            {
                // We save our own copy of the last ufraw settings, as ufraw can overwrite it's own last used settings outside f-spot
                File.Delete(Path.Combine(Global.BaseDirectory, "batch.ufraw"));
                File.Copy(Path.ChangeExtension(developed.LocalPath, ".ufraw"), Path.Combine(Global.BaseDirectory, "batch.ufraw"));

                // Rename the ufraw file to match the original RAW filename, instead of the (Developed In UFRaw) filename
                if (!(Path.ChangeExtension(raw.Uri.LocalPath, ".ufraw") == Path.ChangeExtension(developed.LocalPath, ".ufraw")))
                {
                    File.Delete(Path.ChangeExtension(raw.Uri.LocalPath, ".ufraw"));
                    File.Move(Path.ChangeExtension(developed.LocalPath, ".ufraw"), Path.ChangeExtension(raw.Uri.LocalPath, ".ufraw"));
                }
            }

            p.DefaultVersionId    = p.AddVersion(new SafeUri(developed).GetBaseUri(), new SafeUri(developed).GetFilename(), name, true);
            p.Changes.DataChanged = true;
            App.Instance.Database.Photos.Commit(p);
        }