Example #1
0
        private void PhotoItemChanged(BrowsablePointer item, BrowsablePointerChangedArgs args)
        {
            // If it is just the position that changed fall out
            if (args != null &&
                args.PreviousItem != null &&
                Item.IsValid &&
                (args.PreviousIndex != item.Index) &&
                (this.Item.Current.DefaultVersionUri == args.PreviousItem.DefaultVersionUri))
            {
                return;
            }

            // Don't reload if the image didn't change at all.
            if (args != null && args.Changes != null &&
                !args.Changes.DataChanged &&
                args.PreviousItem != null &&
                Item.IsValid &&
                this.Item.Current.DefaultVersionUri == args.PreviousItem.DefaultVersionUri)
            {
                return;
            }

            if (args != null &&
                args.PreviousItem != null &&
                Item.IsValid &&
                Item.Current.DefaultVersionUri == args.PreviousItem.DefaultVersionUri &&
                load_async == ProgressType.Full)
            {
                progressive_display = false;
            }

            if (load_async != ProgressType.None)
            {
                Gdk.Pixbuf old = this.Pixbuf;
                try {
                    if (Item.IsValid)
                    {
                        System.Uri uri = Item.Current.DefaultVersionUri;
                        loader.Load(uri);
                    }
                    else
                    {
                        LoadErrorImage(null);
                    }
                } catch (System.Exception e) {
                    System.Console.WriteLine(e.ToString());
                    LoadErrorImage(e);
                }
                if (old != null)
                {
                    old.Dispose();
                }
            }
            else
            {
                Gdk.Pixbuf old = this.Pixbuf;
                this.Pixbuf = FSpot.PhotoLoader.Load(item.Collection,
                                                     item.Index);
                if (old != null)
                {
                    old.Dispose();
                }

                UpdateMinZoom();
                this.ZoomFit();
            }

            this.UnsetSelection();

            if (PhotoChanged != null)
            {
                PhotoChanged(this);
            }
        }