Ejemplo n.º 1
0
        private Picture [] GetPicturesForUpload()
        {
            if (null == photos)
            {
                Log.DebugFormat("No photos");
            }
            if (null == preferences)
            {
                Log.DebugFormat("No preferences");
            }

            Picture [] pictures = new Picture [photos.Items.Length];

            for (int i = 0; i < pictures.Length; ++i)
            {
                FSpot.IBrowsableItem photo = photos.Items [i];

                // FIXME: GnomeVFS is deprecated, we should use
                // GIO instead.  However, I don't know how to
                // call `GLib.Content.TypeGuess ()'.
                string path      = photo.DefaultVersionUri.LocalPath;
                string mime_type = Gnome.Vfs.MimeType
                                   .GetMimeTypeForUri(path);

                pictures [i] = new Picture(photo.Name,
                                           photo.DefaultVersionUri,
                                           mime_type,
                                           preferences.Privacy);
            }

            return(pictures);
        }
Ejemplo n.º 2
0
        private static FSpot.Xmp.XmpFile UpdateXmp(FSpot.IBrowsableItem item, FSpot.Xmp.XmpFile xmp)
        {
            if (xmp == null)
            {
                xmp = new FSpot.Xmp.XmpFile();
            }

            Tag []    tags  = item.Tags;
            string [] names = new string [tags.Length];

            for (int i = 0; i < tags.Length; i++)
            {
                names [i] = tags [i].Name;
            }

            xmp.Store.Update("dc:subject", "rdf:Bag", names);
            if ((item as Photo).Rating > 0)
            {
                xmp.Store.Update("xmp:Rating", (item as Photo).Rating.ToString());
                // FIXME - Should we also store/overwrite the Urgency field?
                // uint urgency_value = (item as Photo).Rating + 1; // Urgency valid values 1 - 8
                // xmp.Store.Update ("photoshop:Urgency", urgency_value.ToString());
            }
            else
            {
                xmp.Store.Delete("xmp:Rating");
            }
            xmp.Dump();

            return(xmp);
        }
Ejemplo n.º 3
0
        public override int IndexFromPhoto(FSpot.IBrowsableItem photo)
        {
            if (order_ascending)
            {
                return(IndexFromDateAscending(photo.Time));
            }

            return(IndexFromDateDescending(photo.Time));
        }
        public int Add(FSpot.IBrowsableItem item, string path)
        {
            if (item == null)
            {
                Console.WriteLine("NO PHOTO");
            }

            return(gallery.AddItem(this,
                                   path,
                                   Path.GetFileName(item.DefaultVersionUri.LocalPath),
                                   item.Description,
                                   true));
        }
        private void UpdateImage()
        {
            FSpot.IBrowsableItem item = view.Collection.Items [Item];

            string orig_path = item.DefaultVersionUri.LocalPath;

            Gdk.Pixbuf pixbuf = preview_cache.GetThumbnailForPath(orig_path);
            if (pixbuf == null)
            {
                // A bizarre pixbuf = hack to try to deal with cinematic displays, etc.
                int preview_size = ((this.Screen.Width + this.Screen.Height) / 2) / 3;
                try {
                    if (item is Photo)
                    {
                        pixbuf = FSpot.PhotoLoader.LoadAtMaxSize((Photo)item, preview_size, preview_size);
                    }
                    else
                    {
                        pixbuf = PixbufUtils.LoadAtMaxSize(orig_path, preview_size, preview_size);
                    }
                } catch (Exception) {
                    pixbuf = null;
                }

                if (pixbuf != null)
                {
                    preview_cache.AddThumbnail(orig_path, pixbuf);
                    AddHistogram(pixbuf);
                    image.Pixbuf = pixbuf;
                }
                else
                {
                    image.Pixbuf = PixbufUtils.ErrorPixbuf;
                }
            }
            else
            {
                image.Pixbuf = pixbuf;
                pixbuf.Dispose();
            }

            string desc = String.Empty;

            if (item.Description != null && item.Description.Length > 0)
            {
                desc = item.Description + Environment.NewLine;
            }

            desc      += item.Time.ToString() + "   " + item.Name;
            label.Text = desc;
        }
Ejemplo n.º 6
0
        public override int IndexFromPhoto(FSpot.IBrowsableItem item)
        {
            Photo  photo          = (Photo)item;
            string directory_path = photo.DirectoryPath;

            for (int i = 0; i < dirs.Length; i++)
            {
                if ((string)dirs [i].Key == directory_path)
                {
                    return(i);
                }
            }

            // FIXME not truly implemented
            return(0);
        }
Ejemplo n.º 7
0
 public void HandleIconViewSelectionChanged(FSpot.IBrowsableCollection collection)
 {
     // FIXME this handler seems to be called twice for each selection change
     if (icon_view.Selection.Count > 0)
     {
         FSpot.IBrowsableItem item = icon_view.Selection [0];
         string path = item.DefaultVersionUri.LocalPath;
         try {
             preview_image.Pixbuf = new Gdk.Pixbuf(path);
             image_view.UnsetSelection();
         } catch {
             // FIXME add a real exception handler here.
             System.Console.WriteLine("Unable To Load image");
         }
     }
 }
Ejemplo n.º 8
0
 public abstract int IndexFromPhoto(FSpot.IBrowsableItem photo);
Ejemplo n.º 9
0
 public void Add(FSpot.IBrowsableItem item)
 {
     Add(item.DefaultVersionUri);
 }
 public void Add(FSpot.IBrowsableItem item)
 {
     Add(item, item.DefaultVersionUri.LocalPath);
 }