public PhotoView (IBrowsableCollection query)
		: base ()
	{
		this.query = query;

		description_delay = new FSpot.Delay (1000, new GLib.IdleHandler (CommitPendingChanges));
		this.Destroyed += HandleDestroy;

		Name = "ImageContainer";
		Box vbox = new VBox (false, 6);
		Add (vbox);

	        background = new EventBox ();
		Frame frame = new Frame ();
		background.Add (frame);

		frame.ShadowType = ShadowType.In;
		vbox.PackStart (background, true, true, 0);
		
		Box inner_vbox = new VBox (false , 2);

		frame.Add (inner_vbox);
		
		photo_view = new FSpot.PhotoImageView (query);
		photo_view.PhotoChanged += HandlePhotoChanged; 
		photo_view.SelectionChanged += HandleSelectionChanged;

		photo_view_scrolled = new ScrolledWindow (null, null);

		photo_view_scrolled.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
		photo_view_scrolled.ShadowType = ShadowType.None;
		photo_view_scrolled.Add (photo_view);
		photo_view_scrolled.ButtonPressEvent += HandleButtonPressEvent;
		photo_view.AddEvents ((int) EventMask.KeyPressMask);
		inner_vbox.PackStart (photo_view_scrolled, true, true, 0);
		
		HBox inner_hbox = new HBox (false, 2);
		//inner_hbox.BorderWidth = 6;

		tag_view = new TagView ();
		inner_hbox.PackStart (tag_view, false, true, 0);
		SetColors ();

		Label comment = new Label (Catalog.GetString ("Comment:"));
		inner_hbox.PackStart (comment, false, false, 0);
		description_entry = new Entry ();
		inner_hbox.PackStart (description_entry, true, true, 0);
		description_entry.Changed += HandleDescriptionChanged;
		
		inner_vbox.PackStart (inner_hbox, false, true, 0);

		Box toolbar_hbox = new HBox (false, 6);
		vbox.PackStart (toolbar_hbox, false, true, 0);

		toolbar_hbox.PackStart (CreateConstraintsOptionMenu (), false, false, 0);

		crop_button = new ToolbarButton ();
		crop_button.Add (new Gtk.Image ("f-spot-crop", IconSize.Button));
		toolbar_hbox.PackStart (crop_button, false, true, 0);
	
		crop_button.Clicked += new EventHandler (HandleCropButtonClicked);

		redeye_button = new ToolbarButton ();
		redeye_button.Add (new Gtk.Image ("f-spot-red-eye", IconSize.Button));
		toolbar_hbox.PackStart (redeye_button, false, true, 0);
	
		redeye_button.Clicked += new EventHandler (HandleRedEyeButtonClicked);

		color_button = new ToolbarButton ();
		color_button.Add (new Gtk.Image ("f-spot-adjust-colors", IconSize.Button));
		toolbar_hbox.PackStart (color_button, false, true, 0);
	
		color_button.Clicked += new EventHandler (HandleColorButtonClicked);

		desaturate_button = new ToolbarButton ();
		desaturate_button.Add (new Gtk.Image ("f-spot-desaturate", IconSize.Button));
		toolbar_hbox.PackStart (desaturate_button, false, true, 0);
		desaturate_button.Clicked += HandleDesaturateButtonClicked;

		sepia_button = new ToolbarButton ();
		sepia_button.Add (new Gtk.Image ("f-spot-sepia", IconSize.Button));
		toolbar_hbox.PackStart (sepia_button, false, true, 0);
		sepia_button.Clicked += HandleSepiaButtonClicked;

		ItemAction straighten = new TiltEditorAction (photo_view);
		toolbar_hbox.PackStart (straighten.GetToolButton (false), false, true, 0);
		
		ItemAction softfocus = new SoftFocusEditorAction (photo_view);
		toolbar_hbox.PackStart (softfocus.GetToolButton (false), false, true, 0);

		ItemAction autocolor = new AutoColor (photo_view.Item);
		toolbar_hbox.PackStart (autocolor.GetToolButton (false), false, true, 0);
		
		/* Face detection ! */
		
		face_widget = new FaceBox (toolbar_hbox, photo_view);
		
		vbox.PackStart ( face_widget, false, true, 0);
		/* Spacer Label */
		toolbar_hbox.PackStart (new Label (String.Empty), true, true, 0);

		count_label = new Label (String.Empty);
		toolbar_hbox.PackStart (count_label, false, true, 0);

		display_previous_button = new ToolbarButton ();
		Gtk.Image display_previous_image = new Gtk.Image (Stock.GoBack, IconSize.Button);
		display_previous_button.Add (display_previous_image);
		display_previous_button.Clicked += new EventHandler (HandleDisplayPreviousButtonClicked);
		toolbar_hbox.PackStart (display_previous_button, false, true, 0);

		display_next_button = new ToolbarButton ();
		Gtk.Image display_next_image = new Gtk.Image (Stock.GoForward, IconSize.Button);
		display_next_button.Add (display_next_image);
		display_next_button.Clicked += new EventHandler (HandleDisplayNextButtonClicked);
		toolbar_hbox.PackStart (display_next_button, false, true, 0);

		tips.Enable ();


		UpdateButtonSensitivity ();

		vbox.ShowAll ();
		tips.SetTip (color_button, Catalog.GetString ("Adjust the photo colors"), String.Empty);
		tips.SetTip (constraints_option_menu, Catalog.GetString ("Constrain the aspect ratio of the selection"), String.Empty);
		tips.SetTip (display_next_button, Catalog.GetString ("Next photo"), String.Empty);
		tips.SetTip (display_previous_button, Catalog.GetString ("Previous photo"), String.Empty);
		tips.SetTip (desaturate_button, Catalog.GetString ("Convert the photo to black and white"), String.Empty);
		tips.SetTip (sepia_button, Catalog.GetString ("Convert the photo to sepia tones"), String.Empty);

		Realized += delegate (object o, EventArgs e) {SetColors ();};
	}
        public PhotoView(IBrowsableCollection query)
            : base()
        {
            this.query = query;

            description_delay = new FSpot.Delay(1000, new GLib.IdleHandler(CommitPendingChanges));
            this.Destroyed   += HandleDestroy;

            Name = "ImageContainer";
            Box vbox = new VBox(false, 6);

            Add(vbox);

            background = new EventBox();
            Frame frame = new Frame();

            background.Add(frame);

            frame.ShadowType = ShadowType.In;
            vbox.PackStart(background, true, true, 0);

            Box inner_vbox = new VBox(false, 2);

            frame.Add(inner_vbox);

            photo_view = new FSpot.PhotoImageView(query);
            photo_view.PhotoChanged     += HandlePhotoChanged;
            photo_view.SelectionChanged += HandleSelectionChanged;

            photo_view_scrolled = new ScrolledWindow(null, null);

            photo_view_scrolled.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            photo_view_scrolled.ShadowType = ShadowType.None;
            photo_view_scrolled.Add(photo_view);
            photo_view_scrolled.ButtonPressEvent += HandleButtonPressEvent;
            photo_view.AddEvents((int)EventMask.KeyPressMask);
            inner_vbox.PackStart(photo_view_scrolled, true, true, 0);

            HBox inner_hbox = new HBox(false, 2);

            //inner_hbox.BorderWidth = 6;

            tag_view = new TagView();
            inner_hbox.PackStart(tag_view, false, true, 0);
            SetColors();

            Label comment = new Label(Catalog.GetString("Comment:"));

            inner_hbox.PackStart(comment, false, false, 0);
            description_entry = new Entry();
            inner_hbox.PackStart(description_entry, true, true, 0);
            description_entry.Changed += HandleDescriptionChanged;

            inner_vbox.PackStart(inner_hbox, false, true, 0);

            Box toolbar_hbox = new HBox(false, 6);

            vbox.PackStart(toolbar_hbox, false, true, 0);

            toolbar_hbox.PackStart(CreateConstraintsOptionMenu(), false, false, 0);

            crop_button = new ToolbarButton();
            crop_button.Add(new Gtk.Image("f-spot-crop", IconSize.Button));
            toolbar_hbox.PackStart(crop_button, false, true, 0);

            crop_button.Clicked += new EventHandler(HandleCropButtonClicked);

            redeye_button = new ToolbarButton();
            redeye_button.Add(new Gtk.Image("f-spot-red-eye", IconSize.Button));
            toolbar_hbox.PackStart(redeye_button, false, true, 0);

            redeye_button.Clicked += new EventHandler(HandleRedEyeButtonClicked);

            color_button = new ToolbarButton();
            color_button.Add(new Gtk.Image("f-spot-adjust-colors", IconSize.Button));
            toolbar_hbox.PackStart(color_button, false, true, 0);

            color_button.Clicked += new EventHandler(HandleColorButtonClicked);

            desaturate_button = new ToolbarButton();
            desaturate_button.Add(new Gtk.Image("f-spot-desaturate", IconSize.Button));
            toolbar_hbox.PackStart(desaturate_button, false, true, 0);
            desaturate_button.Clicked += HandleDesaturateButtonClicked;

            sepia_button = new ToolbarButton();
            sepia_button.Add(new Gtk.Image("f-spot-sepia", IconSize.Button));
            toolbar_hbox.PackStart(sepia_button, false, true, 0);
            sepia_button.Clicked += HandleSepiaButtonClicked;

            ItemAction straighten = new TiltEditorAction(photo_view);

            toolbar_hbox.PackStart(straighten.GetToolButton(false), false, true, 0);

            ItemAction softfocus = new SoftFocusEditorAction(photo_view);

            toolbar_hbox.PackStart(softfocus.GetToolButton(false), false, true, 0);

            ItemAction autocolor = new AutoColor(photo_view.Item);

            toolbar_hbox.PackStart(autocolor.GetToolButton(false), false, true, 0);

            /* Face detection ! */

            face_widget = new FaceBox(toolbar_hbox, photo_view);

            vbox.PackStart(face_widget, false, true, 0);
            /* Spacer Label */
            toolbar_hbox.PackStart(new Label(String.Empty), true, true, 0);

            count_label = new Label(String.Empty);
            toolbar_hbox.PackStart(count_label, false, true, 0);

            display_previous_button = new ToolbarButton();
            Gtk.Image display_previous_image = new Gtk.Image(Stock.GoBack, IconSize.Button);
            display_previous_button.Add(display_previous_image);
            display_previous_button.Clicked += new EventHandler(HandleDisplayPreviousButtonClicked);
            toolbar_hbox.PackStart(display_previous_button, false, true, 0);

            display_next_button = new ToolbarButton();
            Gtk.Image display_next_image = new Gtk.Image(Stock.GoForward, IconSize.Button);
            display_next_button.Add(display_next_image);
            display_next_button.Clicked += new EventHandler(HandleDisplayNextButtonClicked);
            toolbar_hbox.PackStart(display_next_button, false, true, 0);

            tips.Enable();


            UpdateButtonSensitivity();

            vbox.ShowAll();
            tips.SetTip(color_button, Catalog.GetString("Adjust the photo colors"), String.Empty);
            tips.SetTip(constraints_option_menu, Catalog.GetString("Constrain the aspect ratio of the selection"), String.Empty);
            tips.SetTip(display_next_button, Catalog.GetString("Next photo"), String.Empty);
            tips.SetTip(display_previous_button, Catalog.GetString("Previous photo"), String.Empty);
            tips.SetTip(desaturate_button, Catalog.GetString("Convert the photo to black and white"), String.Empty);
            tips.SetTip(sepia_button, Catalog.GetString("Convert the photo to sepia tones"), String.Empty);

            Realized += delegate(object o, EventArgs e) { SetColors(); };
        }