//	private void HandleTagMenuSelected (Tag t)
//	{
//		tag_selected = t;
//		//tag_image.Pixbuf = t.Icon;
//		//tag_label.Text = t.Name;
//	}

    private void HandleRecurseToggled(object sender, System.EventArgs args)
    {
        this.Cancel();
        this.Dialog.Sensitive = false;

        idle_start.Start();
    }
        public bool HideControls()
        {
            int x, y;

            Gdk.ModifierType type;

            if (!auto_hide)
            {
                return(false);
            }

            if (IsRealized)
            {
                GdkWindow.GetPointer(out x, out y, out type);
                if (Allocation.Contains(x, y))
                {
                    hide.Start();
                    return(true);
                }
            }

            hide.Stop();
            Hide();
            Visibility = VisibilityType.None;
            return(false);
        }
Exemple #3
0
        public void Play()
        {
            Gdk.GCValues values = new Gdk.GCValues();
            values.SubwindowMode = SubwindowMode.IncludeInferiors;
            Gdk.GC fillgc = new Gdk.GC(this.GdkWindow, values, Gdk.GCValuesMask.Subwindow);

            slideview.Show();
            this.GdkWindow.SetBackPixmap(null, false);
            this.Show();
            screenshot.RenderToDrawable(this.GdkWindow, fillgc,
                                        0, 0, 0, 0, -1, -1, RgbDither.Normal, 0, 0);

            slideview.Play();
            hide.Start();
        }
		public void HandleExposeEvent (object sender, ExposeEventArgs args)
		{
			if (fade_delay == null) {
				fade_delay = new Delay (50, new GLib.IdleHandler (Update));
					start = DateTime.Now;
					fade_delay.Start ();
			}
		}
Exemple #5
0
        private void Adjust()
        {
            if (brightness_scale == null)
            {
                return;
            }

            if (AdjustedPixbuf == null)
            {
                return;
            }

            Cms.Profile    display_profile = Cms.Profile.GetScreenProfile(view.Screen);
            Cms.Profile [] list;

            if (display_profile == null)
            {
                display_profile = Cms.Profile.CreateStandardRgb();
            }

            if (!Changed || AdjustedPixbuf.HasAlpha)
            {
                if (AdjustedPixbuf.HasAlpha)
                {
                    System.Console.WriteLine("Cannot currently adjust images with an alpha channel");
                }

                list = new Cms.Profile [] { image_profile, display_profile };

                next_transform = new Cms.Transform(list,
                                                   PixbufUtils.PixbufCmsFormat(AdjustedPixbuf),
                                                   PixbufUtils.PixbufCmsFormat(AdjustedPixbuf),
                                                   Cms.Intent.Perceptual, 0x0000);
            }
            else
            {
                using (adjustment_profile = AdjustmentProfile()) {
                    list = new Cms.Profile [] { image_profile, adjustment_profile, display_profile };

                    next_transform = new Cms.Transform(list,
                                                       PixbufUtils.PixbufCmsFormat(AdjustedPixbuf),
                                                       PixbufUtils.PixbufCmsFormat(AdjustedPixbuf),
                                                       Cms.Intent.Perceptual, 0x0000);
                }
            }

            lock (AdjustedPixbuf) {
                PixbufUtils.ColorAdjust(ScaledPixbuf,
                                        AdjustedPixbuf,
                                        next_transform);
#if USE_THREAD
                expose_timeout.Start();
#else
                this.QueueDraw();
#endif
            }
        }
 public void HandleExposeEvent(object sender, ExposeEventArgs args)
 {
     if (fade_delay == null)
     {
         fade_delay = new Delay(50, new GLib.IdleHandler(Update));
         start      = DateTime.Now;
         fade_delay.Start();
     }
 }
    public bool Start()
    {
        if (Dialog != null)
        {
            Dialog.Sensitive = true;
        }

        if (import_path == null)
        {
            return(false);
        }

        string [] pathimport = { ImportPath };
        //this.Dialog.Destroy();

        if (copy_check != null)
        {
            copy = copy_check.Active;
        }

        bool recurse = true;

        if (recurse_check != null)
        {
            recurse = recurse_check.Active;
        }

        bool detect_duplicates = false;

        if (duplicate_check != null)
        {
            detect_duplicates = duplicate_check.Active;
        }

//		importer = new FileImportBackend (store, pathimport, copy, recurse, null);
        importer    = new FileImportBackend(store, pathimport, copy, recurse, detect_duplicates, null, Dialog);
        AllowFinish = false;

        total = importer.Prepare();

        if (total > 0)
        {
            UpdateProgressBar(1, total);
        }

        collection.Clear();
        collection.Capacity = total;

        if (total > 0)
        {
            step.Start();
        }

        return(false);
    }
Exemple #8
0
        public void Start(bool run_now)
        {
            start = DateTime.Now;

            if (run_now)
            {
                HandleTimeout();
            }

            delay.Start();
        }
Exemple #9
0
        private void HandleMotionNotifyEvent(object sender, MotionNotifyEventArgs args)
        {
            pos.X = (int)args.Event.XRoot - start.X;
            pos.Y = (int)args.Event.YRoot - start.Y;

            root_pos.X = (int)args.Event.XRoot;
            root_pos.Y = (int)args.Event.YRoot;

            if (dragging)
            {
                drag.Start();
            }
        }
Exemple #10
0
        bool FadeToTarget(double target)
        {
            //Log.DebugFormat ("FadeToTarget {0}", target);
            Realize();
            this.target = target;
            fade.Start();

            if (target > 0.0)
            {
                hide.Restart();
            }

            return(false);
        }
        public void Load(Uri uri)
        {
            this.uri = uri;

            delay.Stop();

            if (!done_reading)
            {
                Close();
            }

            done_reading  = false;
            area_prepared = false;
            damage        = Gdk.Rectangle.Zero;

            using (ImageFile img = ImageFile.Create(uri)) {
                orientation = Accelerometer.GetViewOrientation(img.Orientation);

                try {
                    PixbufOrientation thumb_orientation = Accelerometer.GetViewOrientation(PixbufOrientation.TopLeft);
                    thumb = new Gdk.Pixbuf(ThumbnailGenerator.ThumbnailPath(uri));
                    thumb = PixbufUtils.TransformOrientation(thumb, thumb_orientation);

                    if (FSpot.ColorManagement.IsEnabled && !thumb.HasAlpha)
                    {
                        if (img.GetProfile() == null)
                        {
                            FSpot.ColorManagement.PhotoImageView.Transform = FSpot.ColorManagement.StandartTransform();
                        }
                        else
                        {
                            FSpot.ColorManagement.PhotoImageView.Transform = FSpot.ColorManagement.CreateTransform(thumb, img.GetProfile());
                        }
                    }
                    else
                    {
                        FSpot.ColorManagement.PhotoImageView.Transform = null;
                    }
                } catch (System.Exception e) {
                    //FSpot.ThumbnailGenerator.Default.Request (uri.ToString (), 0, 256, 256);
                    if (!(e is GLib.GException))
                    {
                        System.Console.WriteLine(e.ToString());
                    }
                }

                System.IO.Stream nstream = img.PixbufStream();
                if (nstream == null)
                {
                    FileLoad(img);
                    return;
                }
                else
                {
                    stream = new StreamWrapper(nstream);
                }

                loader = new Gdk.PixbufLoader();
                loader.AreaPrepared += ap;
                loader.AreaUpdated  += au;
                loader.Closed       += ev;

                if (AreaPrepared != null && thumb != null)
                {
                    pixbuf = thumb;
                    AreaPrepared(this, new AreaPreparedArgs(true));
                }

                ThumbnailGenerator.Default.PushBlock();
                //AsyncIORead (null);
                if (nstream is IOChannel)
                {
                    ((IOChannel)nstream).DataReady += IOChannelRead;
                }
                else
                {
                    delay.Start();
                }
            }
        }
		public bool Execute (Tag t)
		{
			this.CreateDialog ("edit_icon_dialog");

			this.Dialog.Title = String.Format (Catalog.GetString ("Edit Icon for Tag {0}"), t.Name);

			PreviewPixbuf = t.Icon;

			query = new FSpot.PhotoQuery (db.Photos);
			
			if (db.Tags.Hidden != null)
				query.Terms = FSpot.OrTerm.FromTags (new Tag []{ t, db.Tags.Hidden });
			else 
				query.Terms = new FSpot.Literal (t);

			image_view = new FSpot.PhotoImageView (query);
			image_view.SelectionXyRatio = 1.0;
			image_view.SelectionChanged += HandleSelectionChanged;
			image_view.PhotoChanged += HandlePhotoChanged;

                        external_photo_chooser = new Gtk.FileChooserButton (Catalog.GetString ("Select Photo from file"),
                                                                 Gtk.FileChooserAction.Open);

			external_photo_chooser.Filter = new FileFilter();
			external_photo_chooser.Filter.AddPixbufFormats();
                        external_photo_chooser.LocalOnly = false;
                        external_photo_chooser_hbox.PackStart (external_photo_chooser);

    			Dialog.ShowAll ();
			external_photo_chooser.SelectionChanged += HandleExternalFileSelectionChanged;

			photo_scrolled_window.Add (image_view);

			if (query.Count > 0) {
				photo_spin_button.Wrap = true;
				photo_spin_button.Adjustment.Lower = 1.0;
				photo_spin_button.Adjustment.Upper = (double) query.Count;
				photo_spin_button.Adjustment.StepIncrement = 1.0;
				photo_spin_button.ValueChanged += HandleSpinButtonChanged;
				
				image_view.Item.Index = 0;
			} else {
				from_photo_label.Markup = String.Format (Catalog.GetString (
					"\n<b>From Photo</b>\n" +
					" You can use one of your library photos as an icon for this tag.\n" +
					" However, first you must have at least one photo associated\n" +
					" with this tag. Please tag a photo as '{0}' and return here\n" +
					" to use it as an icon."), t.Name); 
				photo_scrolled_window.Visible = false;
				photo_label.Visible = false;
				photo_spin_button.Visible = false;
			}			

			icon_store = new ListStore (typeof (string), typeof (Gdk.Pixbuf));

			icon_view = new Gtk.IconView (icon_store); 
			icon_view.PixbufColumn = 1;
			icon_view.SelectionMode = SelectionMode.Single;
			icon_view.SelectionChanged += HandleIconSelectionChanged;

			icon_scrolled_window.Add (icon_view);

			icon_view.Show();

			image_view.Show ();

			FSpot.Delay fill_delay = new FSpot.Delay (FillIconView);
			fill_delay.Start ();

			ResponseType response = (ResponseType) this.Dialog.Run ();
			bool success = false;

			if (response == ResponseType.Ok) {
				try {
					if (IconName != null) {
						t.ThemeIconName = IconName;
					} else {
						t.ThemeIconName = null;
						t.Icon = PreviewPixbuf_WithoutProfile;
					}
					//db.Tags.Commit (t);
					success = true;
				} catch (Exception ex) {
					// FIXME error dialog.
					Console.WriteLine ("error {0}", ex);
				}
			} else if (response == (ResponseType) (1)) {
				t.Icon = null;
				success = true;
			}
			
			this.Dialog.Destroy ();
			return success;
		}
Exemple #13
0
 public void Dismiss()
 {
     Visibility = VisibilityType.None;
     dismiss.Start();
 }
Exemple #14
0
        public FullScreenView(IBrowsableCollection collection, Gtk.Window parent)
            : base("Full Screen Mode")
        {
            //going fullscreen on the same screen the parent window
            Gdk.Screen screen = Screen;
            int monitor = screen.GetMonitorAtWindow (parent.GdkWindow);
            Gdk.Rectangle bounds = screen.GetMonitorGeometry (monitor);
            Move (bounds.X, bounds.Y);

            string style = "style \"test\" {\n" +
                "GtkToolbar::shadow_type = GTK_SHADOW_NONE\n" +
                "}\n" +
                "class \"GtkToolbar\" style \"test\"";

            Gtk.Rc.ParseString (style);

            Name = "FullscreenContainer";
            try {
                //scroll = new Gtk.ScrolledWindow (null, null);
                actions = new ActionGroup ("joe");

                actions.Add (new ActionEntry [] {
                    new ActionEntry (HideToolbar, Stock.Close,
                             Catalog.GetString ("Hide"),
                             null,
                             Catalog.GetString ("Hide Toolbar"),
                             HideToolbarAction)});

                actions.Add (new ToggleActionEntry [] {
                    new ToggleActionEntry (Info,
                                   Stock.Info,
                                   Catalog.GetString ("Info"),
                                   null,
                                   Catalog.GetString ("Image Information"),
                                   InfoAction,
                                   false)});

                Gtk.Action exit_full_screen = new Gtk.Action (ExitFullScreen,
                    Catalog.GetString ("Exit fullscreen"),
                    null,
                    null);
                exit_full_screen.IconName = "view-restore";
                exit_full_screen.Activated += ExitAction;
                actions.Add (exit_full_screen);

                Gtk.Action slide_show = new Gtk.Action (SlideShow,
                    Catalog.GetString ("Slideshow"),
                    Catalog.GetString ("Start slideshow"),
                    null);
                slide_show.IconName = "media-playback-start";
                slide_show.Activated += SlideShowAction;
                actions.Add (slide_show);

                new Fader (this, 1.0, 3);
                notebook = new Notebook ();
                notebook.ShowBorder = false;
                notebook.ShowTabs = false;
                notebook.Show ();

                scroll = new ScrolledView ();
                scroll.ScrolledWindow.SetPolicy (PolicyType.Never, PolicyType.Never);
                view = new PhotoImageView (collection);
                // FIXME this should be handled by the new style setting code
                view.ModifyBg (Gtk.StateType.Normal, this.Style.Black);
                this.Add (notebook);
                view.Show ();
                view.MotionNotifyEvent += HandleViewMotion;
                view.PointerMode = PointerMode.Scroll;

                scroll.ScrolledWindow.Add (view);

                Toolbar tbar = new Toolbar ();
                tbar.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz;

                tbar.ShowArrow = false;
                tbar.BorderWidth = 15;

                ToolItem t_item = (actions [ExitFullScreen]).CreateToolItem () as ToolItem;
                t_item.IsImportant = true;
                tbar.Insert (t_item, -1);

                Gtk.Action action = new PreviousPictureAction (view.Item);
                actions.Add (action);
                tbar.Insert (action.CreateToolItem () as ToolItem, -1);

                play_pause_button = (actions [SlideShow]).CreateToolItem () as ToolButton;
                tbar.Insert (play_pause_button, -1);

                action = new NextPictureAction (view.Item);
                actions.Add (action);
                tbar.Insert (action.CreateToolItem () as ToolItem, -1);

                t_item = new ToolItem ();
                t_item.Child = new Label (Catalog.GetString ("Slide transition:"));
                tbar.Insert (t_item, -1);

                display = new SlideShow (view.Item);
                display.AddEvents ((int) (Gdk.EventMask.PointerMotionMask));
                display.ModifyBg (Gtk.StateType.Normal, this.Style.Black);
                display.MotionNotifyEvent += HandleViewMotion;
                display.Show ();

                t_item = new ToolItem ();
                ComboBox combo = ComboBox.NewText ();
                foreach (var transition in display.Transitions)
                    combo.AppendText (transition.Name);
                combo.Active = 0;
                combo.Changed += HandleTransitionChanged;
                t_item.Child = combo;
                tbar.Insert (t_item, -1);

                action = new RotateLeftAction (view.Item);
                actions.Add (action);
                tbar.Insert (action.CreateToolItem () as ToolItem, -1);

                action = new RotateRightAction (view.Item);
                actions.Add (action);
                tbar.Insert (action.CreateToolItem () as ToolItem, -1);

                info_button = (ToggleToolButton) ((actions [Info]).CreateToolItem () as ToolItem);
                tbar.Insert (info_button, -1);

                tbar.Insert ((actions [HideToolbar]).CreateToolItem () as ToolItem, -1);

                notebook.AppendPage (scroll, null);
                notebook.AppendPage (display, null);

                tbar.ShowAll ();

                scroll.Show ();
                this.Decorated = false;
                this.Fullscreen ();
                this.ButtonPressEvent += HandleButtonPressEvent;

                view.Item.Changed += HandleItemChanged;
                view.GrabFocus ();

                hide_cursor_delay = new Delay (3000, new GLib.IdleHandler (HideCursor));
                hide_cursor_delay.Start ();

                controls = new ControlOverlay (this);
                controls.Add (tbar);
                controls.Dismiss ();

                notebook.CurrentPage = 0;
            } catch (System.Exception e) {
                Log.Exception (e);
            }
        }
Exemple #15
0
        public FullScreenView(IBrowsableCollection collection, Gtk.Window parent) : base("Full Screen Mode")
        {
            //going fullscreen on the same screen the parent window
            Gdk.Screen screen  = Screen;
            int        monitor = screen.GetMonitorAtWindow(parent.GdkWindow);

            Gdk.Rectangle bounds = screen.GetMonitorGeometry(monitor);
            Move(bounds.X, 0);


            string style = "style \"test\" {\n" +
                           "GtkToolbar::shadow_type = GTK_SHADOW_NONE\n" +
                           "}\n" +
                           "class \"GtkToolbar\" style \"test\"";

            Gtk.Rc.ParseString(style);

            Name = "FullscreenContainer";
            try {
                //scroll = new Gtk.ScrolledWindow (null, null);
                actions = new ActionGroup("joe");

                actions.Add(new ActionEntry [] {
                    new ActionEntry(HideToolbar, Stock.Close,
                                    Catalog.GetString("Hide"),
                                    null,
                                    Catalog.GetString("Hide Toolbar"),
                                    HideToolbarAction)
                });

                actions.Add(new ToggleActionEntry [] {
                    new ToggleActionEntry(Info,
                                          Stock.Info,
                                          Catalog.GetString("Info"),
                                          null,
                                          Catalog.GetString("Image Information"),
                                          InfoAction,
                                          false)
                });

                Gtk.Action exit_full_screen = new Gtk.Action(ExitFullScreen,
                                                             Catalog.GetString("Exit fullscreen"),
                                                             null,
                                                             null);
#if GTK_2_10
                exit_full_screen.IconName = "view-restore";
#endif
                exit_full_screen.Activated += ExitAction;
                actions.Add(exit_full_screen);

                Gtk.Action slide_show = new Gtk.Action(SlideShow,
                                                       Catalog.GetString("Slideshow"),
                                                       Catalog.GetString("Start slideshow"),
                                                       null);
#if GTK_2_10
                slide_show.IconName = "media-playback-start";
#endif
                slide_show.Activated += SlideShowAction;
                actions.Add(slide_show);

                new Fader(this, 1.0, 3);
                notebook            = new Notebook();
                notebook.ShowBorder = false;
                notebook.ShowTabs   = false;
                notebook.Show();

                scroll = new ScrolledView();
                scroll.ScrolledWindow.SetPolicy(PolicyType.Never, PolicyType.Never);
                view = new PhotoImageView(collection);
                // FIXME this should be handled by the new style setting code
                view.ModifyBg(Gtk.StateType.Normal, this.Style.Black);
                this.Add(notebook);
                view.Show();
                view.MotionNotifyEvent += HandleViewMotion;
                view.PointerMode        = ImageView.PointerModeType.Scroll;

                scroll.ScrolledWindow.Add(view);

                Toolbar tbar = new Toolbar();
                tbar.ToolbarStyle = Gtk.ToolbarStyle.BothHoriz;

                tbar.ShowArrow   = false;
                tbar.BorderWidth = 15;

                ToolItem t_item = (actions [ExitFullScreen]).CreateToolItem() as ToolItem;
                t_item.IsImportant = true;
                tbar.Insert(t_item, -1);

                Gtk.Action action = new PreviousPictureAction(view.Item);
                actions.Add(action);
#if GTK_2_10
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);
#else
                t_item = action.CreateToolItem() as ToolItem;
                (t_item as ToolButton).IconName = "gtk-go-back-ltr";
                tbar.Insert(t_item, -1);
#endif

                play_pause_button = (actions [SlideShow]).CreateToolItem() as ToolButton;
#if GTK_2_10
                tbar.Insert(play_pause_button, -1);
#else
                play_pause_button.IconName = "media-playback-start";
                tbar.Insert(play_pause_button, -1);
#endif

                action = new NextPictureAction(view.Item);
                actions.Add(action);
#if GTK_2_10
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);
#else
                t_item = action.CreateToolItem() as ToolItem;
                (t_item as ToolButton).IconName = "gtk-go-forward-ltr";
                tbar.Insert(t_item, -1);
#endif

                t_item       = new ToolItem();
                t_item.Child = new Label(Catalog.GetString("Slide transition:"));
                tbar.Insert(t_item, -1);

                display = new TextureDisplay(view.Item);
                display.AddEvents((int)(Gdk.EventMask.PointerMotionMask));
                display.ModifyBg(Gtk.StateType.Normal, this.Style.Black);
                display.MotionNotifyEvent += HandleViewMotion;
                display.Show();

                t_item       = new ToolItem();
                t_item.Child = display.GetCombo();
                tbar.Insert(t_item, -1);

                action = new RotateLeftAction(view.Item);
                actions.Add(action);
#if GTK_2_10
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);
#else
                t_item = action.CreateToolItem() as ToolItem;
                (t_item as ToolButton).IconName = "object-rotate-left";
                tbar.Insert(t_item, -1);
#endif

                action = new RotateRightAction(view.Item);
                actions.Add(action);
#if GTK_2_10
                tbar.Insert(action.CreateToolItem() as ToolItem, -1);
#else
                t_item = action.CreateToolItem() as ToolItem;
                (t_item as ToolButton).IconName = "object-rotate-right";
                tbar.Insert(t_item, -1);
#endif

                info_button = (ToggleToolButton)((actions [Info]).CreateToolItem() as ToolItem);
                tbar.Insert(info_button, -1);

                tbar.Insert((actions [HideToolbar]).CreateToolItem() as ToolItem, -1);

                notebook.AppendPage(scroll, null);
                notebook.AppendPage(display, null);

                tbar.ShowAll();

                scroll.Show();
                this.Decorated = false;
                this.Fullscreen();
                this.ButtonPressEvent += HandleButtonPressEvent;

                view.Item.Changed += HandleItemChanged;
                view.GrabFocus();

                hide_cursor_delay = new Delay(3000, new GLib.IdleHandler(HideCursor));
                hide_cursor_delay.Start();

                controls = new ControlOverlay(this);
                controls.Add(tbar);
                controls.Dismiss();

                notebook.CurrentPage = 0;
            } catch (System.Exception e) {
                Log.Exception(e);
            }
        }
 private void HandleRightPressed(object sender, System.EventArgs ars)
 {
     HandleScrollRight();
     right_delay.Start();
 }
 private void HandleLeftPressed(object sender, System.EventArgs ars)
 {
     HandleScrollLeft();
     left_delay.Start();
 }
        public bool Execute(Tag t)
        {
            this.CreateDialog("edit_icon_dialog");

            this.Dialog.Title = String.Format(Catalog.GetString("Edit Icon for Tag {0}"), t.Name);

            PreviewPixbuf = t.Icon;

            query = new FSpot.PhotoQuery(db.Photos);

            if (db.Tags.Hidden != null)
            {
                query.Terms = FSpot.OrTerm.FromTags(new Tag [] { t, db.Tags.Hidden });
            }
            else
            {
                query.Terms = new FSpot.Literal(t);
            }

            image_view = new FSpot.PhotoImageView(query);
            image_view.SelectionXyRatio  = 1.0;
            image_view.SelectionChanged += HandleSelectionChanged;
            image_view.PhotoChanged     += HandlePhotoChanged;

            external_photo_chooser = new Gtk.FileChooserButton(Catalog.GetString("Select Photo from file"),
                                                               Gtk.FileChooserAction.Open);

            external_photo_chooser.Filter = new FileFilter();
            external_photo_chooser.Filter.AddPixbufFormats();
            external_photo_chooser.LocalOnly = false;
            external_photo_chooser_hbox.PackStart(external_photo_chooser);

            Dialog.ShowAll();
            external_photo_chooser.SelectionChanged += HandleExternalFileSelectionChanged;

            photo_scrolled_window.Add(image_view);

            if (query.Count > 0)
            {
                photo_spin_button.Wrap                     = true;
                photo_spin_button.Adjustment.Lower         = 1.0;
                photo_spin_button.Adjustment.Upper         = (double)query.Count;
                photo_spin_button.Adjustment.StepIncrement = 1.0;
                photo_spin_button.ValueChanged            += HandleSpinButtonChanged;

                image_view.Item.Index = 0;
            }
            else
            {
                from_photo_label.Markup = String.Format(Catalog.GetString(
                                                            "\n<b>From Photo</b>\n" +
                                                            " You can use one of your library photos as an icon for this tag.\n" +
                                                            " However, first you must have at least one photo associated\n" +
                                                            " with this tag. Please tag a photo as '{0}' and return here\n" +
                                                            " to use it as an icon."), t.Name);
                photo_scrolled_window.Visible = false;
                photo_label.Visible           = false;
                photo_spin_button.Visible     = false;
            }

            icon_store = new ListStore(typeof(string), typeof(Gdk.Pixbuf));

            icon_view = new Gtk.IconView(icon_store);
            icon_view.PixbufColumn      = 1;
            icon_view.SelectionMode     = SelectionMode.Single;
            icon_view.SelectionChanged += HandleIconSelectionChanged;

            icon_scrolled_window.Add(icon_view);

            icon_view.Show();

            image_view.Show();

            FSpot.Delay fill_delay = new FSpot.Delay(FillIconView);
            fill_delay.Start();

            ResponseType response = (ResponseType)this.Dialog.Run();
            bool         success  = false;

            if (response == ResponseType.Ok)
            {
                try {
                    if (IconName != null)
                    {
                        t.ThemeIconName = IconName;
                    }
                    else
                    {
                        t.ThemeIconName = null;
                        t.Icon          = PreviewPixbuf_WithoutProfile;
                    }
                    //db.Tags.Commit (t);
                    success = true;
                } catch (Exception ex) {
                    // FIXME error dialog.
                    Console.WriteLine("error {0}", ex);
                }
            }
            else if (response == (ResponseType)(1))
            {
                t.Icon  = null;
                success = true;
            }

            this.Dialog.Destroy();
            return(success);
        }
Exemple #19
0
        // Constructor.
        public InfoBox()
            : base(false, 0)
        {
            ContextSwitchStrategy = new MRUInfoBoxContextSwitchStrategy ();
            ContextChanged += HandleContextChanged;

            SetupWidgets ();

            update_delay = new Delay (Update);
            update_delay.Start ();

            histogram_delay = new Delay (DelayedUpdateHistogram);

            BorderWidth = 2;
            Hide ();
        }