Esempio n. 1
0
        public SelectAvatarDialog(Window parent)
            : base()
        {
            XML glade = new XML (null, "FileFind.Meshwork.GtkClient.meshwork.glade",
                        "SelectAvatarDialog", null);

            this.Remove (this.Child);

            glade.Autoconnect (this);

            Window window = (Window) glade ["SelectAvatarDialog"];
            this.Title = window.Title;
            Widget child = window.Child;
            child.Reparent (this);
            window.Destroy ();
            child.Show ();

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

            avatarIconView = new IconView (store);
            avatarIconView.PixbufColumn = 0;
            avatarIconView.ItemActivated += avatarIconView_ItemActivated;
            avatarIconView.SelectionChanged += avatarIconView_SelectionChanged;
            avatarIconView.DragDataReceived += avatarIconView_DragDataReceived;
            avatarIconView.ButtonPressEvent += avatarIconView_ButtonPressEvent;

            Gtk.Drag.DestSet (avatarIconView, DestDefaults.All,
                    new TargetEntry [] {
                        new TargetEntry ("STRING",
                                0, (uint) 0)
                    },
                    Gdk.DragAction.Copy);

            iconViewScrolledWindow.Add (avatarIconView);

            avatarIconView.Show ();

            Resize (570, 400);

            GLib.Timeout.Add (50, new GLib.TimeoutHandler (PulseProgressBar));

            // Load images
            gravatarThread = new Thread (new ThreadStart (LoadImages));
            gravatarThread.Start ();
        }
Esempio n. 2
0
        public EditTagIconDialog(Db db, Tag t, Gtk.Window parent_window) : base("EditTagIconDialog.ui", "edit_tag_icon_dialog")
        {
            TransientFor = parent_window;
            Title        = String.Format(Catalog.GetString("Edit Icon for Tag {0}"), t.Name);

            preview_pixbuf = t.Icon;
            Cms.Profile screen_profile;
            if (preview_pixbuf != null && ColorManagement.Profiles.TryGetValue(Preferences.Get <string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out screen_profile))
            {
                preview_image.Pixbuf = preview_pixbuf.Copy();
                ColorManagement.ApplyProfile(preview_image.Pixbuf, screen_profile);
            }
            else
            {
                preview_image.Pixbuf = preview_pixbuf;
            }

            query = new PhotoQuery(db.Photos);

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

            image_view = new PhotoImageView(query)
            {
                CropHelpers = false
            };
            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);
            external_photo_chooser.Show();
            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();

            DelayedOperation fill_delay = new DelayedOperation(FillIconView);

            fill_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;
		}
Esempio n. 4
0
        public EditTagIconDialog(Db db, Tag t, Gtk.Window parent_window)
            : base("EditTagIconDialog.ui", "edit_tag_icon_dialog")
        {
            this.db = db;
            TransientFor = parent_window;
            Title = String.Format (Catalog.GetString ("Edit Icon for Tag {0}"), t.Name);

            preview_pixbuf = t.Icon;
            Cms.Profile screen_profile;
            if (preview_pixbuf != null && FSpot.ColorManagement.Profiles.TryGetValue (Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out screen_profile)) {
                preview_image.Pixbuf = preview_pixbuf.Copy ();
                ColorManagement.ApplyProfile (preview_image.Pixbuf, screen_profile);
            } else
                preview_image.Pixbuf = preview_pixbuf;

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

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

            image_view = new PhotoImageView (query) {CropHelpers = false};
            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);
            external_photo_chooser.Show ();
            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 ();
        }
Esempio n. 5
0
        public SmugMugExport(IBrowsableCollection selection)
            : base("smugmug_export_dialog")
        {
            this.items = selection.Items;
                        album_button.Sensitive = false;
                        IconView view = new IconView (selection);
                        view.DisplayDates = false;
                        view.DisplayTags = false;

                        Dialog.Modal = false;
                        Dialog.TransientFor = null;
                        Dialog.Close += HandleCloseEvent;

                        thumb_scrolledwindow.Add (view);
                        view.Show ();
                        Dialog.Show ();

                        SmugMugAccountManager manager = SmugMugAccountManager.GetInstance ();
                        manager.AccountListChanged += PopulateSmugMugOptionMenu;
                        PopulateSmugMugOptionMenu (manager, null);

                        if (edit_button != null)
                                edit_button.Clicked += HandleEditGallery;

                        rh = new Gtk.ResponseHandler (HandleResponse);
                        Dialog.Response += HandleResponse;
                        connect = true;
                        HandleSizeActive (null, null);
                        Connect ();

                        scale_check.Toggled += HandleScaleCheckToggled;

                        LoadPreference (Preferences.EXPORT_SMUGMUG_SCALE);
                        LoadPreference (Preferences.EXPORT_SMUGMUG_SIZE);
                        LoadPreference (Preferences.EXPORT_SMUGMUG_ROTATE);
                        LoadPreference (Preferences.EXPORT_SMUGMUG_BROWSER);
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
#pragma warning restore 649

        public EditTagIconDialog(Db db, Tag t, Gtk.Window parent_window) : base("EditTagIconDialog.ui", "edit_tag_icon_dialog")
        {
            TransientFor = parent_window;
            Title        = Strings.EditIconForTagName(t.Name);

            // FIXME, Icon
            //preview_pixbuf = t.Icon;
            if (preview_pixbuf != null && ColorManagement.Profiles.TryGetValue(Preferences.Get <string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out var screen_profile))
            {
                preview_image.Pixbuf = preview_pixbuf.Copy();
                ColorManagement.ApplyProfile(preview_image.Pixbuf, screen_profile);
            }
            else
            {
                preview_image.Pixbuf = preview_pixbuf;
            }

            query = new PhotoQuery(db.Photos);

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

            image_view = new PhotoImageView(query)
            {
                CropHelpers = false
            };
            image_view.SelectionXyRatio  = 1.0;
            image_view.SelectionChanged += HandleSelectionChanged;
            image_view.PhotoChanged     += HandlePhotoChanged;

            external_photo_chooser = new Gtk.FileChooserButton(Strings.SelectPhotoFromFile, Gtk.FileChooserAction.Open)
            {
                Filter = new FileFilter()
            };
            external_photo_chooser.Filter.AddPixbufFormats();
            external_photo_chooser.LocalOnly = false;
            external_photo_chooser_hbox.PackStart(external_photo_chooser);
            external_photo_chooser.Show();
            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         = 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($"\n<b>{Strings.FromPhoto}</b>\n{Strings.TagFromPhotoLabelMessage}", 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)
            {
                PixbufColumn  = 1,
                SelectionMode = SelectionMode.Single
            };
            icon_view.SelectionChanged += HandleIconSelectionChanged;

            icon_scrolled_window.Add(icon_view);

            icon_view.Show();

            image_view.Show();

            //var fill_delay = new DelayedOperation (FillIconView);
            //fill_delay.Start ();
        }