Пример #1
0
        public CDExportDialog(IBrowsableCollection collection, System.Uri dest)
            : base(Assembly.GetExecutingAssembly (), "CDExport.ui", "cd_export_dialog")
        {
            this.dest = dest;

            // Calculate the total size
            long total_size = 0;
            string path;
            System.IO.FileInfo file_info;

            foreach (IPhoto item in collection.Items) {
                path = item.DefaultVersion.Uri.LocalPath;
                if (System.IO.File.Exists (path)) {
                    file_info = new System.IO.FileInfo (path);
                    total_size += file_info.Length;
                }
            }

            var view = new TrayView (collection);
            view.DisplayDates = false;
            view.DisplayTags = false;
            view.DisplayRatings = false;

            this.Modal = false;
            this.TransientFor = null;

            size_label.Text = Format.SizeForDisplay (total_size);

            thumb_scrolledwindow.Add (view);
            this.ShowAll ();

            previous_frame.Visible = !IsDestEmpty (dest);

            browse_button.Clicked += HandleBrowseExisting;
        }
Пример #2
0
        public void Run(IBrowsableCollection selection)
        {
            dialog = new FacebookExportDialog (selection);

            if (selection.Items.Length > max_photos_per_album) {
                HigMessageDialog mbox = new HigMessageDialog (dialog,
                        Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error,
                        Gtk.ButtonsType.Ok, Catalog.GetString ("Too many images to export"),
                        String.Format (Catalog.GetString ("Facebook only permits {0} photographs per album.  Please refine your selection and try again."), max_photos_per_album));
                mbox.Run ();
                mbox.Destroy ();
                return;
            }

            if (dialog.Run () != (int)ResponseType.Ok) {
                dialog.Destroy ();
                return;
            }

            if (dialog.CreateAlbum) {
                string name = dialog.AlbumName;
                if (String.IsNullOrEmpty (name)) {
                    HigMessageDialog mbox = new HigMessageDialog (dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal,
                            Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Album must have a name"),
                            Catalog.GetString ("Please name your album or choose an existing album."));
                    mbox.Run ();
                    mbox.Destroy ();
                    return;
                }

                string description = dialog.AlbumDescription;
                string location = dialog.AlbumLocation;

                try {
                    album = dialog.Account.Facebook.CreateAlbum (name, description, location);
                }
                catch (FacebookException fe) {
                    HigMessageDialog mbox = new HigMessageDialog (dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal,
                            Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Creating a new album failed"),
                            String.Format (Catalog.GetString ("An error occurred creating a new album.\n\n{0}"), fe.Message));
                    mbox.Run ();
                    mbox.Destroy ();
                    return;
                }
            } else {
                album = dialog.ActiveAlbum;
            }

            if (dialog.Account != null) {
                dialog.Hide ();

                command_thread = new System.Threading.Thread (new System.Threading.ThreadStart (Upload));
                command_thread.Name = Mono.Unix.Catalog.GetString ("Uploading Pictures");

                progress_dialog = new ThreadProgressDialog (command_thread, selection.Items.Length);
                progress_dialog.Start ();
            }

            dialog.Destroy ();
        }
Пример #3
0
		public void Run (IBrowsableCollection selection)
		{
			this.selection = selection;

			// Calculate the total size
			long total_size = 0;
			string path;
			System.IO.FileInfo file_info;

			foreach (IBrowsableItem item in selection.Items) {
				path = item.DefaultVersionUri.LocalPath;
				if (System.IO.File.Exists (path)) {
					file_info = new System.IO.FileInfo (path);
					total_size += file_info.Length;
				}
			}

			IconView view = new IconView (selection);
			view.DisplayDates = false;
			view.DisplayTags = false;

			Dialog.Modal = false;
			Dialog.TransientFor = null;
			
			size_label.Text = SizeUtil.ToHumanReadable (total_size);

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

			//LoadHistory ();

			Dialog.Response += HandleResponse;
		}
Пример #4
0
        public void Run(IBrowsableCollection selection)
        {
            dialog = new FacebookExportDialog (selection);

            if (selection.Items.Length > max_photos_per_album) {
                HigMessageDialog mbox = new HigMessageDialog (dialog,
                        Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error,
                        Gtk.ButtonsType.Ok, Catalog.GetString ("Too many images to export"),
                        String.Format (Catalog.GetString ("Facebook only permits {0} photographs per album.  Please refine your selection and try again."), max_photos_per_album));
                mbox.Run ();
                mbox.Destroy ();
                return;
            }

            if (dialog.Run () != (int)ResponseType.Ok) {
                dialog.Destroy ();
                return;
            }

            if (dialog.Account != null) {
                dialog.Hide ();

                command_thread = new System.Threading.Thread (new System.Threading.ThreadStart (Upload));
                command_thread.Name = Mono.Unix.Catalog.GetString ("Uploading Pictures");

                progress_dialog = new ThreadProgressDialog (command_thread, selection.Items.Length);
                progress_dialog.Start ();
            }

            dialog.Destroy ();
        }
		private void Changed (IBrowsableCollection query)
		{
			this.ClearMarks ();
			foreach (IBrowsableItem item in query.Items) {
				MarkDay ((uint)item.Time.Day);
			}
		}
Пример #6
0
 public SelectionCollection(IBrowsableCollection collection)
 {
     this.selected_cells = new Dictionary<IPhoto, int> ();
     this.parent = collection;
     this.bit_array = new BitArray (this.parent.Count);
     this.parent.Changed += HandleParentChanged;
     this.parent.ItemsChanged += HandleParentItemsChanged;
 }
Пример #7
0
 public OriginalGallery(IBrowsableCollection selection, string path, string name)
     : base(selection, path, name)
 {
     requests = new ScaleRequest [] { new ScaleRequest ("hq", 0, 0, false),
                      new ScaleRequest ("mq", 800, 600, true),
                      new ScaleRequest ("lq", 640, 480, false, true),
                      new ScaleRequest ("thumbs", 120, 120, false) };
 }
		public BrowsablePointer (IBrowsableCollection collection, int index)
		{
			this.collection = collection;
			this.Index = index;
			item = Current;

			collection.Changed += HandleCollectionChanged;
			collection.ItemsChanged += HandleCollectionItemsChanged;
		}
Пример #9
0
		public MailImages (IBrowsableCollection collection)
		{
			message = new MailMessage ();
			message.From = "*****@*****.**";
			message.To = "*****@*****.**";
			message.Subject = "test";

			EsmtpMail mail = new EsmtpMail ("smtp.gmail.com", "lewing", "ricedream");
			mail.Send (message)
		}
Пример #10
0
		public RepairDialog (IBrowsableCollection collection) : base ("RepairDialog.ui", "repair_dialog")
		{
			source = collection;
			missing = new PhotoList ();

			FindMissing ();
			TrayView view = new TrayView (missing);
			view_scrolled.Add (view);

			this.ShowAll ();
		}
Пример #11
0
        public BrowsablePointer(IBrowsableCollection collection, int index)
        {
            if (collection == null)
                throw new ArgumentNullException ("collection");

            this.collection = collection;
            Index = index;
            item = Current;

            collection.Changed += HandleCollectionChanged;
            collection.ItemsChanged += HandleCollectionItemsChanged;
        }
Пример #12
0
		public void Run (IBrowsableCollection p) {
			Console.WriteLine ("Executing ZipExport extension");
			if (p.Count == 0) {
				HigMessageDialog md = new HigMessageDialog (MainWindow.Toplevel.Window, DialogFlags.DestroyWithParent,
							  Gtk.MessageType.Error, ButtonsType.Ok,
							  Catalog.GetString ("No selection available"),
							  Catalog.GetString ("This tool requires an active selection. Please select one or more pictures and try again"));

				md.Run ();
				md.Destroy ();
				return;
			}
			photos = p.Items;
			ShowDialog ();
		}
Пример #13
0
        internal FolderGallery(IBrowsableCollection selection, string path, string gallery_name)
        {
            if (null == selection)
                throw new ArgumentNullException ("selection");

            if (0 == selection.Count)
                throw new ArgumentException ("selection can't be empty");

            if (null == path)
                throw new ArgumentNullException ("path");

            if (null == gallery_name)
                throw new ArgumentNullException ("gallery_name");

            Collection = selection;
            GalleryName = gallery_name;
            GalleryPath = Path.Combine (path, GalleryName);
            this.requests = new ScaleRequest [] { ScaleRequest.Default };
        }
Пример #14
0
        public AdjustTimeDialog(Db db, IBrowsableCollection collection)
            : base("AdjustTimeDialog.ui", "time_dialog")
        {
            this.db = db;
            this.collection = collection;

            tray = new TrayView (collection);
            tray_scrolled.Add (tray);
            tray.Selection.Changed += HandleSelectionChanged;

            view = new PhotoImageView (collection);
            view_scrolled.Add (view);
            Item = view.Item;
            Item.Changed += HandleItemChanged;
            Item.MoveFirst ();

            //forward_button.Clicked += HandleForwardClicked;
            //back_button.Clicked += HandleBackClicked;
            ok_button.Clicked += HandleOkClicked;
            cancel_button.Clicked += HandleCancelClicked;

            photo_spin.ValueChanged += HandleSpinChanged;
            photo_spin.SetIncrements (1.0, 1.0);
            photo_spin.Adjustment.StepIncrement = 1.0;
            photo_spin.Wrap = true;

            date_edit.TimeChanged += HandleTimeChanged;
            date_edit.DateChanged += HandleTimeChanged;
            Gtk.Entry entry = (Gtk.Entry) date_edit.Children [0];
            entry.Changed += HandleTimeChanged;
            entry = (Gtk.Entry) date_edit.Children [2];
            entry.Changed += HandleTimeChanged;
            offset_entry.Changed += HandleOffsetChanged;
            ShowAll ();
            HandleCollectionChanged (collection);

            spacing_entry.Changed += HandleSpacingChanged;
            spacing_entry.Sensitive = ! difference_check.Active;

            difference_check.Toggled += HandleActionToggled;
        }
        public void Run(IBrowsableCollection photos)
        {
            if (null == photos || null == photos.Items) {
                throw new ArgumentNullException ("photos");
            }

            main_dialog = new TabbloExportView (photos);

            InitBindings ();

            model.Deserialize ();
            model.PhotoCollection = photos;

            // Model deserialization triggers the various event
            // handlers, which can cause the default widget to lose
            // focus (it can be invalid, and hence disabled, for a
            // moment).
            main_dialog.ResetFocus ();

            main_dialog.Show ();
        }
Пример #16
0
        public CollectionGridView (IBrowsableCollection collection) : base ()
        {
            Collection = collection;

            Collection.Changed += (obj) => {
                QueueResize ();
            };

            Collection.ItemsChanged += (obj, args) => {
                foreach (int item in args.Items) {
                    if (args.Changes.DataChanged)
                        UpdateThumbnail (item);
                    InvalidateCell (item);
                }
            };

            Name = "ImageContainer";

            Cache = new FSpot.PixbufCache ();
            Cache.OnPixbufLoaded += HandlePixbufLoaded;
        }
		public PhotoImageView (IBrowsableCollection query)
		{
			loader = new FSpot.AsyncPixbufLoader ();
			loader.AreaUpdated += HandlePixbufAreaUpdated;
			loader.AreaPrepared += HandlePixbufPrepared;
			loader.Done += HandleDone;

			Accelerometer.OrientationChanged += HandleOrientationChanged;

			HandleRealized (null, null);

			this.SizeAllocated += HandleSizeAllocated;
			this.KeyPressEvent += HandleKeyPressEvent;
			//this.Realized += HandleRealized;
			this.Unrealized += HandleUnrealized;
			this.ScrollEvent += HandleScrollEvent;
			this.item = new BrowsablePointer (query, -1);
			item.Changed += PhotoItemChanged;
			this.Destroyed += HandleDestroyed;
			this.SetTransparentColor (this.Style.BaseColors [(int)Gtk.StateType.Normal]);
		}
        internal TabbloExportView(IBrowsableCollection photos)
            : base(Assembly.GetExecutingAssembly (),
					"TabbloExport.ui", DialogName)
        {
            // Thumbnails
            var icon_view = new TrayView (photos);
            icon_view.DisplayDates = false;
            icon_view.DisplayTags = false;

            thumb_scrolled_window.Add (icon_view);
            icon_view.Show ();

            // Tags
            attached_tags_view = new FSpot.Widgets.TagView ();
            attached_tags_alignment.Add (attached_tags_view);
            attached_tags_view.Show ();

            removed_tags_view = new FSpot.Widgets.TagView ();
            removed_tags_alignment.Add (removed_tags_view);
            removed_tags_view.Show ();
        }
Пример #19
0
        public CDExportDialog(IBrowsableCollection collection, System.Uri dest) :
            base(Assembly.GetExecutingAssembly(), "CDExport.ui", "cd_export_dialog")
        {
            this.dest = dest;

            // Calculate the total size
            long   total_size = 0;
            string path;

            System.IO.FileInfo file_info;

            foreach (IPhoto item in collection.Items)
            {
                path = item.DefaultVersion.Uri.LocalPath;
                if (System.IO.File.Exists(path))
                {
                    file_info   = new System.IO.FileInfo(path);
                    total_size += file_info.Length;
                }
            }

            var view = new TrayView(collection);

            view.DisplayDates   = false;
            view.DisplayTags    = false;
            view.DisplayRatings = false;

            this.Modal        = false;
            this.TransientFor = null;

            size_label.Text = Format.SizeForDisplay(total_size);

            thumb_scrolledwindow.Add(view);
            this.ShowAll();

            previous_frame.Visible = !IsDestEmpty(dest);

            browse_button.Clicked += HandleBrowseExisting;
        }
Пример #20
0
        internal TabbloExportView(IBrowsableCollection photos)
            : base(Assembly.GetExecutingAssembly(),
                   "TabbloExport.ui", DialogName)
        {
            // Thumbnails
            var icon_view = new TrayView(photos);

            icon_view.DisplayDates = false;
            icon_view.DisplayTags  = false;

            thumb_scrolled_window.Add(icon_view);
            icon_view.Show();

            // Tags
            attached_tags_view = new FSpot.Widgets.TagView();
            attached_tags_alignment.Add(attached_tags_view);
            attached_tags_view.Show();

            removed_tags_view = new FSpot.Widgets.TagView();
            removed_tags_alignment.Add(removed_tags_view);
            removed_tags_view.Show();
        }
Пример #21
0
        public void Run(IBrowsableCollection selection)
        {
            this.selection = selection;
            dialog = new CDExportDialog (selection, dest);
            //LoadHistory ();

                        if (dialog.Run () != (int)ResponseType.Ok) {
                                dialog.Destroy ();
                                return;
                        }

            clean = dialog.Clean;
            rotate = dialog.Rotate;

            command_thread = new System.Threading.Thread (new System.Threading.ThreadStart (Transfer));
            command_thread.Name = Catalog.GetString ("Transferring Pictures");

            progress_dialog = new ThreadProgressDialog (command_thread, selection.Count);
            progress_dialog.Start ();

            dialog.Destroy ();
        }
Пример #22
0
        public void Run(IBrowsableCollection photos)
        {
            if (null == photos || null == photos.Items)
            {
                throw new ArgumentNullException("photos");
            }

            main_dialog = new TabbloExportView(photos);

            InitBindings();

            model.Deserialize();
            model.PhotoCollection = photos;

            // Model deserialization triggers the various event
            // handlers, which can cause the default widget to lose
            // focus (it can be invalid, and hence disabled, for a
            // moment).
            main_dialog.ResetFocus();

            main_dialog.Show();
        }
Пример #23
0
        public void Run(IBrowsableCollection selection)
        {
            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;

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


            GalleryAccountManager manager = GalleryAccountManager.GetInstance();

            manager.AccountListChanged += PopulateGalleryOptionMenu;
            PopulateGalleryOptionMenu(manager, null);

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

            Dialog.Response += HandleResponse;
            connect          = true;
            HandleSizeActive(null, null);
            Connect();

            LoadPreference(Preferences.EXPORT_GALLERY_SCALE);
            LoadPreference(Preferences.EXPORT_GALLERY_SIZE);
            LoadPreference(Preferences.EXPORT_GALLERY_BROWSER);
            LoadPreference(Preferences.EXPORT_GALLERY_META);
            LoadPreference(Preferences.EXPORT_GALLERY_ROTATE);
        }
Пример #24
0
        public void Run(IBrowsableCollection selection)
        {
            this.selection = selection;

            // Calculate the total size
            long   total_size = 0;
            string path;

            System.IO.FileInfo file_info;

            foreach (IBrowsableItem item in selection.Items)
            {
                path = item.DefaultVersionUri.LocalPath;
                if (System.IO.File.Exists(path))
                {
                    file_info   = new System.IO.FileInfo(path);
                    total_size += file_info.Length;
                }
            }

            IconView view = new IconView(selection);

            view.DisplayDates = false;
            view.DisplayTags  = false;

            Dialog.Modal        = false;
            Dialog.TransientFor = null;

            size_label.Text = SizeUtil.ToHumanReadable(total_size);

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

            //LoadHistory ();

            Dialog.Response += HandleResponse;
        }
Пример #25
0
        void HandleParentChanged(IBrowsableCollection collection)
        {
            IPhoto [] local = old;
            selected_cells.Clear();
            bit_array = new BitArray(parent.Count);
            ClearCached();

            if (old != null)
            {
                int i = 0;

                for (i = 0; i < local.Length; i++)
                {
                    int parent_index = parent.IndexOf(local [i]);
                    if (parent_index >= 0)
                    {
                        Add(parent_index, false);
                    }
                }
            }

            // Call the directly so that we don't reset old immediately this way the old selection
            // set isn't actually lost until we change it.
            var changedHandler = Changed;

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

            var detailedChangedHandler = DetailedChanged;

            if (detailedChangedHandler != null)
            {
                detailedChangedHandler(this, null);
            }
        }
Пример #26
0
        protected void HandleCollectionChanged(IBrowsableCollection browsableCollection)
        {
            if (browsableCollection == null)
            {
                throw new ArgumentNullException(nameof(browsableCollection));
            }
            int old_location  = Index;
            int next_location = browsableCollection.IndexOf(item);

            if (old_location == next_location)
            {
                if (!Valid(next_location))
                {
                    SetIndex(0, null);
                }

                return;
            }

            if (Valid(next_location))
            {
                SetIndex(next_location);
            }
            else if (Valid(old_location))
            {
                SetIndex(old_location);
            }
            else if (Valid(old_location - 1))
            {
                SetIndex(old_location - 1);
            }
            else
            {
                SetIndex(0);
            }
        }
Пример #27
0
        protected CollectionGridView(IBrowsableCollection collection)
        {
            Collection = collection;

            Collection.Changed += (c) => {
                QueueResize();
            };

            Collection.ItemsChanged += (c, args) => {
                foreach (int item in args.Items)
                {
                    if (args.Changes.DataChanged)
                    {
                        UpdateThumbnail(item);
                    }
                    InvalidateCell(item);
                }
            };

            Name = "ImageContainer";

            Cache = new PixbufCache();
            Cache.OnPixbufLoaded += HandlePixbufLoaded;
        }
Пример #28
0
        public void HandleChanged(IBrowsableCollection collection)
        {
            if (query.ExtraCondition == null)
            {
                logic_widget.Clear = true;
            }

            if (!logic_widget.Clear || query.Untagged || (query.RollSet != null) || (query.RatingRange != null))
            {
                ShowBar();
            }
            else
            {
                HideBar();
            }

            untagged.Visible     = query.Untagged;
            rated.Visible        = (query.RatingRange != null);
            warning_box.Visible  = (query.Count < 1);
            rollfilter.Visible   = (query.RollSet != null);
            comma1_label.Visible = (untagged.Visible && rated.Visible);
            comma2_label.Visible = (!untagged.Visible && rated.Visible && rollfilter.Visible) ||
                                   (untagged.Visible && rollfilter.Visible);
        }
Пример #29
0
        public void Run(IBrowsableCollection selection)
        {
            builder = new GtkBeans.Builder (null, "smugmug_export_dialog.ui", null);
            builder.Autoconnect (this);

            gallery_optionmenu = Gtk.ComboBox.NewText();
            album_optionmenu = Gtk.ComboBox.NewText();

            (edit_button.Parent as Gtk.HBox).PackStart (gallery_optionmenu);
            (album_button.Parent as Gtk.HBox).PackStart (album_optionmenu);
            (edit_button.Parent as Gtk.HBox).ReorderChild (gallery_optionmenu, 1);
            (album_button.Parent as Gtk.HBox).ReorderChild (album_optionmenu, 1);

            gallery_optionmenu.Show ();
            album_optionmenu.Show ();

            this.items = selection.Items;
            album_button.Sensitive = false;
            var view = new TrayView (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;

            Dialog.Response += HandleResponse;
            connect = true;
            HandleSizeActive (null, null);
            Connect ();

            LoadPreference (SCALE_KEY);
            LoadPreference (SIZE_KEY);
            LoadPreference (BROWSER_KEY);
        }
Пример #30
0
        public void Run(IBrowsableCollection selection)
        {
            this.selection = selection;

            var view = new TrayView (selection);
            view.DisplayDates = false;
            view.DisplayTags = false;

            builder = new GtkBeans.Builder (null, "folder_export.ui", null);
            builder.Autoconnect (this);
            Dialog.Modal = false;
            Dialog.TransientFor = null;

            thumb_scrolledwindow.Add (view);
            HandleSizeActive (null, null);
            name_entry.Text = gallery_name;

            string uri_path = System.IO.Path.Combine (FSpot.Core.Global.HomeDirectory, "Desktop");
            if (!System.IO.Directory.Exists (uri_path))
                    uri_path = FSpot.Core.Global.HomeDirectory;

            uri_chooser = new Gtk.FileChooserButton (Catalog.GetString ("Select Export Folder"),
                                 Gtk.FileChooserAction.SelectFolder);

            uri_chooser.LocalOnly = false;

            if (!String.IsNullOrEmpty (Preferences.Get<string> (URI_KEY)))
                uri_chooser.SetCurrentFolderUri (Preferences.Get<string> (URI_KEY));
            else
                uri_chooser.SetFilename (uri_path);

            chooser_hbox.PackStart (uri_chooser);

            Dialog.ShowAll ();
            Dialog.Response += HandleResponse;

            LoadPreference (SCALE_KEY);
            LoadPreference (SIZE_KEY);
            LoadPreference (OPEN_KEY);
            LoadPreference (EXPORT_TAGS_KEY);
            LoadPreference (EXPORT_TAG_ICONS_KEY);
            LoadPreference (METHOD_KEY);
        }
		public void Run (IBrowsableCollection selection)
		{
			/*
			Gnome.Vfs.ModuleCallbackFullAuthentication auth = new Gnome.Vfs.ModuleCallbackFullAuthentication ();
			auth.Callback += new Gnome.Vfs.ModuleCallbackHandler (HandleAuth);
			auth.SetDefault ();
			auth.Push ();
			
			Gnome.Vfs.ModuleCallbackAuthentication mauth = new Gnome.Vfs.ModuleCallbackAuthentication ();
			mauth.Callback += new Gnome.Vfs.ModuleCallbackHandler (HandleAuth);
			mauth.SetDefault ();
			mauth.Push ();
			
			Gnome.Vfs.ModuleCallbackSaveAuthentication sauth = new Gnome.Vfs.ModuleCallbackSaveAuthentication ();
			sauth.Callback += new Gnome.Vfs.ModuleCallbackHandler (HandleAuth);
			sauth.SetDefault ();
			sauth.Push ();
			
			Gnome.Vfs.ModuleCallbackStatusMessage msg = new Gnome.Vfs.ModuleCallbackStatusMessage ();
			msg.Callback += new Gnome.Vfs.ModuleCallbackHandler (HandleMsg);
			msg.SetDefault ();
			msg.Push ();
			*/
			this.selection = selection;
			
			IconView view = (IconView) new IconView (selection);
			view.DisplayDates = false;
			view.DisplayTags = false;

			Dialog.Modal = false;
			Dialog.TransientFor = null;

			thumb_scrolledwindow.Add (view);
			HandleSizeActive (null, null);
			name_entry.Text = gallery_name;

			string uri_path = System.IO.Path.Combine (FSpot.Global.HomeDirectory, "Desktop");
			if (!System.IO.Directory.Exists (uri_path))
			        uri_path = FSpot.Global.HomeDirectory;

			uri_chooser = new Gtk.FileChooserButton (Catalog.GetString ("Select Export Folder"),
								 Gtk.FileChooserAction.SelectFolder);
			
			uri_chooser.LocalOnly = false;

			if (Preferences.Get (Preferences.EXPORT_FOLDER_URI) != null && Preferences.Get (Preferences.EXPORT_FOLDER_URI) as string != String.Empty)
				uri_chooser.SetUri (Preferences.Get (Preferences.EXPORT_FOLDER_URI) as string);
			else
				uri_chooser.SetFilename (uri_path);

			chooser_hbox.PackStart (uri_chooser);

			Dialog.ShowAll ();

			//LoadHistory ();
			Dialog.Response += HandleResponse;

			LoadPreference (Preferences.EXPORT_FOLDER_SCALE);
			LoadPreference (Preferences.EXPORT_FOLDER_SIZE);
			LoadPreference (Preferences.EXPORT_FOLDER_OPEN);
			LoadPreference (Preferences.EXPORT_FOLDER_ROTATE);
			LoadPreference (Preferences.EXPORT_FOLDER_METHOD);
		}
Пример #32
0
 protected void HandleQueryChanged(IBrowsableCollection sender)
 {
     Reload();
 }
Пример #33
0
 public virtual void Run(IBrowsableCollection selection)
 {
     Run(SupportedService.Flickr, selection, false);
 }
Пример #34
0
 public FlickrExport(IBrowsableCollection selection, bool display_tags) :
     this(SupportedService.Flickr, selection, display_tags)
 {
 }
Пример #35
0
        public FullScreenView(IBrowsableCollection collection) : base("Full Screen Mode")
        {
            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),
                    new ActionEntry(ExitFullScreen,
                                    "f-spot-view-restore",
                                    Catalog.GetString("Exit fullscreen"),
                                    null,
                                    null,
                                    ExitAction),
                    new ActionEntry(SlideShow,
                                    "f-spot-slideshow",
                                    Catalog.GetString("Slideshow"),
                                    null,
                                    Catalog.GetString("Start slideshow"),
                                    SlideShowAction),
                });

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

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

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

                Action rotate_left = new RotateLeftAction(view.Item);
                actions.Add(rotate_left);

                Action rotate_right = new RotateRightAction(view.Item);
                actions.Add(rotate_right);

                scroll.ScrolledWindow.Add(view);
                HBox hhbox = new HBox();
                hhbox.PackEnd(GetButton(HideToolbar), false, true, 0);
                hhbox.PackEnd(GetButton(Info), false, true, 0);
                hhbox.PackStart(GetButton(ExitFullScreen, true), false, false, 0);
                hhbox.PackStart(Add(new PreviousPictureAction(view.Item)), false, false, 0);
                hhbox.PackStart(GetButton(SlideShow), false, true, 0);
                hhbox.PackStart(Add(new NextPictureAction(view.Item)), false, false, 0);
                //hhbox.PackStart (Add (new AutoColor (view.Item)), false, false, 0);

                display = new TextureDisplay(view.Item);
                display.AddEvents((int)(Gdk.EventMask.PointerMotionMask));
                display.ModifyBg(Gtk.StateType.Normal, this.Style.Black);
                display.MotionNotifyEvent += HandleViewMotion;
                Label effect = new Label(Catalog.GetString("Slide transition: "));
                hhbox.PackStart(effect, false, false, 5);
                hhbox.PackStart(display.GetCombo(), false, false, 0);
                display.Show();

                hhbox.PackStart(Add(new RotateLeftAction(view.Item)), false, false, 0);
                hhbox.PackStart(Add(new RotateRightAction(view.Item)), false, false, 0);
                hhbox.BorderWidth = 15;

                tag_view = new TagView();
                hhbox.PackStart(tag_view, false, false, 0);

                //display = new ImageDisplay (view.Item);

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

                hhbox.ShowAll();
                //scroll.ShowControls ();

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

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

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

                notebook.CurrentPage = 0;
            } catch (System.Exception e) {
                System.Console.WriteLine(e);
            }
        }
Пример #36
0
 private void ParentChanged(IBrowsableCollection query)
 {
     this.query.Terms = ((PhotoQuery)query).Terms;
 }
Пример #37
0
        public SendEmail(IBrowsableCollection selection, Window parent_window) : base("mail_dialog.ui", "mail_dialog")
        {
            this.selection     = selection;
            this.parent_window = parent_window;

            foreach (var p in selection.Items)
            {
                if (FileFactory.NewForUri(p.DefaultVersion.Uri).QueryInfo("standard::content-type", FileQueryInfoFlags.None, null).ContentType != "image/jpeg")
                {
                    force_original = true;
                }
            }

            if (force_original)
            {
                original_size.Active   = true;
                tiny_size.Sensitive    = false;
                small_size.Sensitive   = false;
                medium_size.Sensitive  = false;
                large_size.Sensitive   = false;
                x_large_size.Sensitive = false;
            }
            else
            {
                switch (Preferences.Get <int> (Preferences.EXPORT_EMAIL_SIZE))
                {
                case 0:  original_size.Active = true; break;

                case 1:  tiny_size.Active = true; break;

                case 2:  small_size.Active = true; break;

                case 3:  medium_size.Active = true; break;

                case 4:  large_size.Active = true; break;

                case 5:  x_large_size.Active = true; break;

                default: break;
                }
            }


            tray_scrolled.Add(new TrayView(selection));

            Modal = false;

            // Calculate total original filesize
            foreach (var photo in selection.Items)
            {
                try {
                    Orig_Photo_Size += FileFactory.NewForUri(photo.DefaultVersion.Uri).QueryInfo("standard::size", FileQueryInfoFlags.None, null).Size;
                } catch {
                }
            }

            for (int k = 0; k < avg_scale_ref.Length; k++)
            {
                avg_scale[k] = avg_scale_ref[k];
            }


            // Calculate approximate size shrinking, use first photo, and shrink to medium size as base.
            var scalephoto = selection [0];

            if (scalephoto != null && !force_original)
            {
                // Get first photos file size
                long orig_size = FileFactory.NewForUri(scalephoto.DefaultVersion.Uri).QueryInfo("standard::size", FileQueryInfoFlags.None, null).Size;

                FilterSet filters = new FilterSet();
                filters.Add(new ResizeFilter((uint)(sizes [3])));
                long new_size;
                using (FilterRequest request = new FilterRequest(scalephoto.DefaultVersion.Uri)) {
                    filters.Convert(request);
                    new_size = FileFactory.NewForUri(request.Current).QueryInfo("standard::size", FileQueryInfoFlags.None, null).Size;
                }

                if (orig_size > 0)
                {
                    // Get the factor (scale) between original and resized medium size.
                    scale_percentage = 1 - ((float)(orig_size - new_size) / orig_size);

                    // What is the relation between the estimated medium scale factor, and reality?
                    double scale_scale = scale_percentage / avg_scale_ref[3];

                    //System.Console.WriteLine ("scale_percentage {0}, ref {1}, relative {2}",
                    //	scale_percentage, avg_scale_ref[3], scale_scale  );

                    // Re-Calculate the proper relation per size
                    for (int k = 0; k < avg_scale_ref.Length; k++)
                    {
                        avg_scale[k] = avg_scale_ref[k] * scale_scale;
                        //	System.Console.WriteLine ("avg_scale[{0}]={1} (was {2})",
                        //		k, avg_scale[k], avg_scale_ref[k]  );
                    }
                }
            }

            NumberOfPictures.Text  = selection.Count.ToString();
            TotalOriginalSize.Text = GLib.Format.SizeForDisplay(Orig_Photo_Size);

            UpdateEstimatedSize();

            ShowAll();

            //LoadHistory ();

            Response += HandleResponse;
        }
Пример #38
0
        public PhotoView(IBrowsableCollection query)
        {
            Query = query;

            commit_delay = new DelayedOperation(1000, new GLib.IdleHandler(CommitPendingChanges));
            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);

            inner_vbox = new VBox(false, 2);
            inner_hbox = new HBox(false, 2);

            frame.Add(inner_hbox);

            BrowsablePointer bp = new BrowsablePointer(query, -1);

            View = new PhotoImageView(bp);

            filmstrip             = new Filmstrip(bp);
            filmstrip.ThumbOffset = 1;
            filmstrip.Spacing     = 4;
            filmstrip.ThumbSize   = 75;
            PlaceFilmstrip((Orientation)Preferences.Get <int> (Preferences.FILMSTRIP_ORIENTATION), true);

            View.PhotoChanged += HandlePhotoChanged;

            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(View);
            photo_view_scrolled.Child.ButtonPressEvent += HandleButtonPressEvent;
            View.AddEvents((int)EventMask.KeyPressMask);
            inner_vbox.PackStart(photo_view_scrolled, true, true, 0);
            inner_hbox.PackStart(inner_vbox, true, true, 0);

            HBox lower_hbox = new HBox(false, 2);

            //inner_hbox.BorderWidth = 6;

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

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

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

            rating = new RatingEntry {
                HasFrame             = false,
                AlwaysShowEmptyStars = true
            };
            lower_hbox.PackStart(rating, false, false, 0);
            rating.Changed += HandleRatingChanged;

            SetColors();

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

            vbox.ShowAll();

            Realized += (o, e) => SetColors();
            Preferences.SettingChanged += OnPreferencesChanged;
        }
Пример #39
0
 public TrayView(IBrowsableCollection collection) : base(collection)
 {
     MaxColumns = 1;
 }
Пример #40
0
 void HandleCollectionChanged(IBrowsableCollection coll)
 {
     Position = ActiveItem;
     QueueDraw();
 }
Пример #41
0
 internal void HandleSelectionChanged(IBrowsableCollection collection)
 {
     // Don't show metadata when multiple photos are selected.
     Photo = (collection != null && collection.Count == 1) ? collection[0] : null;
 }
Пример #42
0
 public PhotoImageView(IBrowsableCollection query) : this(new BrowsablePointer(query, -1))
 {
     FSpot.ColorManagement.PhotoImageView = this;
 }
Пример #43
0
 protected void HandleCollectionItemsChanged(IBrowsableCollection collection, BrowsableEventArgs eventArgs)
 {
     foreach (int item in eventArgs.Items) {
         if (item == Index)
             SetIndex (Index, eventArgs.Changes);
     }
 }
Пример #44
0
 public ScalingIconView(IBrowsableCollection collection) : base(collection)
 {
 }
Пример #45
0
 public override void Run(IBrowsableCollection selection)
 {
     Run(SupportedService.Zooomr, selection, false);
 }
Пример #46
0
 public HtmlGallery(IBrowsableCollection selection, string path, string name) : base(selection, path, name)
 {
     requests = new ScaleRequest [] { new ScaleRequest("hq", 0, 0, false),
                                      new ScaleRequest("mq", 480, 320, false),
                                      new ScaleRequest("thumbs", 120, 90, false) };
 }
Пример #47
0
 public FlickrExport(SupportedService service, IBrowsableCollection selection, bool display_tags) : this()
 {
     Run(service, selection, display_tags);
 }
 public static Gdk.Pixbuf Load(IBrowsableCollection collection, int index)
 {
     IPhoto item = collection [index];
     return Load (item);
 }
 public override void Run(IBrowsableCollection selection)
 {
     Run(SupportedService.TwentyThreeHQ, selection, true);
 }
Пример #50
0
        public void Run(IBrowsableCollection selection)
        {
            dialog = new FacebookExportDialog(selection);

            if (selection.Items.Count() > max_photos_per_album)
            {
                HigMessageDialog mbox = new HigMessageDialog(dialog,
                                                             Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error,
                                                             Gtk.ButtonsType.Ok, Catalog.GetString("Too many images to export"),
                                                             string.Format(Catalog.GetString("Facebook only permits {0} photographs per album.  Please refine your selection and try again."), max_photos_per_album));
                mbox.Run();
                mbox.Destroy();
                return;
            }

            if (dialog.Run() != (int)ResponseType.Ok)
            {
                dialog.Destroy();
                return;
            }

            if (dialog.CreateAlbum)
            {
                string name = dialog.AlbumName;
                if (string.IsNullOrEmpty(name))
                {
                    HigMessageDialog mbox = new HigMessageDialog(dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal,
                                                                 Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Album must have a name"),
                                                                 Catalog.GetString("Please name your album or choose an existing album."));
                    mbox.Run();
                    mbox.Destroy();
                    return;
                }

                string description = dialog.AlbumDescription;
                string location    = dialog.AlbumLocation;

                try {
                    album = dialog.Account.Facebook.CreateAlbum(name, description, location);
                }
                catch (FacebookException fe) {
                    HigMessageDialog mbox = new HigMessageDialog(dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal,
                                                                 Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Creating a new album failed"),
                                                                 string.Format(Catalog.GetString("An error occurred creating a new album.\n\n{0}"), fe.Message));
                    mbox.Run();
                    mbox.Destroy();
                    return;
                }
            }
            else
            {
                album = dialog.ActiveAlbum;
            }

            if (dialog.Account != null)
            {
                dialog.Hide();

                command_thread      = new System.Threading.Thread(new System.Threading.ThreadStart(Upload));
                command_thread.Name = Mono.Unix.Catalog.GetString("Uploading Pictures");

                progress_dialog = new ThreadProgressDialog(command_thread, selection.Items.Count());
                progress_dialog.Start();
            }

            dialog.Destroy();
        }
		internal FolderGallery (IBrowsableCollection selection, string path, string gallery_name)
		{
			this.collection = selection;
			this.gallery_name = gallery_name;
			this.gallery_path = Path.Combine (path, gallery_name);
			this.requests = new ScaleRequest [] { ScaleRequest.Default };
		}
Пример #52
0
        public CDExportDialog(IBrowsableCollection selection, System.Uri dest)
            : base(Assembly.GetExecutingAssembly (), "CDExport.ui", "cd_export_dialog")
        {
            this.selection = selection;
            this.dest = dest;

            // Calculate the total size
            long total_size = 0;
            string path;
            System.IO.FileInfo file_info;

            foreach (IBrowsableItem item in selection.Items) {
                path = item.DefaultVersionUri.LocalPath;
                if (System.IO.File.Exists (path)) {
                    file_info = new System.IO.FileInfo (path);
                    total_size += file_info.Length;
                }
            }

            FSpot.Widgets.IconView view = new FSpot.Widgets.IconView (selection);
            view.DisplayDates = false;
            view.DisplayTags = false;
            view.DisplayRatings = false;

            this.Modal = false;
            this.TransientFor = null;

            size_label.Text = Format.SizeForDisplay (total_size);

            thumb_scrolledwindow.Add (view);
            this.ShowAll ();

            previous_frame.Visible = IsEmpty (dest);
            //LoadHistory ();
        }
		public HtmlGallery (IBrowsableCollection selection, string path, string name) : base (selection, path, name) 
		{ 
			requests = new ScaleRequest [] { new ScaleRequest ("hq", 0, 0, false),
							 new ScaleRequest ("mq", 480, 320, false),
							 new ScaleRequest ("thumbs", 120, 90, false) };
		}
Пример #54
0
 public PhotoImageView(IBrowsableCollection query) : this(new BrowsablePointer(query, -1))
 {
 }
Пример #55
0
		public SendEmail (IBrowsableCollection selection) : base ("mail_dialog")
		{
			this.selection = selection;

			for (int i = 0; i < selection.Count; i++) {
				Photo p = selection[i] as Photo;
				if (Gnome.Vfs.MimeType.GetMimeTypeForUri (p.DefaultVersionUri.ToString ()) != "image/jpeg")
					force_original = true;
			}

			if (force_original) {
				original_size.Active = true;
				tiny_size.Sensitive = false;
				small_size.Sensitive = false;
				medium_size.Sensitive = false;
				large_size.Sensitive = false;
				x_large_size.Sensitive = false;
			} else  
				switch (Preferences.Get<int> (Preferences.EXPORT_EMAIL_SIZE)) {
					case 0 :  original_size.Active = true; break;
					case 1 :  tiny_size.Active = true; break;
					case 2 :  small_size.Active = true; break;
					case 3 :  medium_size.Active = true; break;
					case 4 :  large_size.Active = true; break;
					case 5 :  x_large_size.Active = true; break;
					default: break;
				}

			rotate_check.Active = Preferences.Get<bool> (Preferences.EXPORT_EMAIL_ROTATE);
			rotate_check.Sensitive = original_size.Active && tiny_size.Sensitive;
			
			tray_scrolled.Add (new TrayView (selection));

			Dialog.Modal = false;

			// Calculate total original filesize 
			for (int i = 0; i < selection.Count; i++) {
				Photo photo = selection[i] as Photo;
				try {
					Orig_Photo_Size += (new Gnome.Vfs.FileInfo (photo.DefaultVersionUri.ToString ())).Size;
				} catch {
				}
			}

			for (int k = 0; k < avg_scale_ref.Length; k++)
				avg_scale[k] = avg_scale_ref[k];


			// Calculate approximate size shrinking, use first photo, and shrink to medium size as base.
			Photo scalephoto = selection [0] as Photo;
			if (scalephoto != null && !force_original) {
				
				// Get first photos file size
				long orig_size = (new Gnome.Vfs.FileInfo (scalephoto.DefaultVersionUri.ToString ())).Size;
				
				FilterSet filters = new FilterSet ();
				filters.Add (new ResizeFilter ((uint)(sizes [3])));
				long new_size;
				using (FilterRequest request = new FilterRequest (scalephoto.DefaultVersionUri)) {
					filters.Convert (request);
					new_size = (new Gnome.Vfs.FileInfo (request.Current.ToString ())).Size;
				}
				
				if (orig_size > 0) {
				
					// Get the factor (scale) between original and resized medium size.
					scale_percentage = 1 - ( (float) (orig_size - new_size) / orig_size);
					
					// What is the relation between the estimated medium scale factor, and reality?
					double scale_scale = scale_percentage / avg_scale_ref[3];
					
					//System.Console.WriteLine ("scale_percentage {0}, ref {1}, relative {2}", 
					//	scale_percentage, avg_scale_ref[3], scale_scale  );

					// Re-Calculate the proper relation per size
					for (int k = 0; k < avg_scale_ref.Length; k++) {
						avg_scale[k] = avg_scale_ref[k] * scale_scale;
					//	System.Console.WriteLine ("avg_scale[{0}]={1} (was {2})", 
					//		k, avg_scale[k], avg_scale_ref[k]  );
					}
				}

			}

			NumberOfPictures.Text 	= selection.Count.ToString();
			TotalOriginalSize.Text 	= SizeUtil.ToHumanReadable (Orig_Photo_Size);
			
			UpdateEstimatedSize();

			Dialog.ShowAll ();

			//LoadHistory ();

			Dialog.Response += HandleResponse;
		}
Пример #56
0
        protected void HandleCollectionChanged(IBrowsableCollection collection)
        {
            if (collection == null)
                throw new ArgumentNullException ("collection");
            int old_location = Index;
            int next_location = collection.IndexOf (item);

            if (old_location == next_location) {
                if (! Valid (next_location))
                    SetIndex (0, null);

                return;
            }

            if (Valid (next_location))
                SetIndex (next_location);
            else if (Valid (old_location))
                SetIndex (old_location);
            else if (Valid (old_location - 1))
                SetIndex (old_location - 1);
            else
                SetIndex (0);
        }
Пример #57
0
        public PhotoView(IBrowsableCollection query)
        {
            Query = query;

            commit_delay = new DelayedOperation (1000, new GLib.IdleHandler (CommitPendingChanges));
            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);

            inner_vbox = new VBox (false , 2);
            inner_hbox = new HBox (false , 2);

            frame.Add (inner_hbox);

            BrowsablePointer bp = new BrowsablePointer (query, -1);
            View = new PhotoImageView (bp);

            filmstrip = new Filmstrip (bp);
            filmstrip.ThumbOffset = 1;
            filmstrip.Spacing = 4;
            filmstrip.ThumbSize = 75;
            PlaceFilmstrip ((Orientation) Preferences.Get <int> (Preferences.FILMSTRIP_ORIENTATION), true);

            View.PhotoChanged += HandlePhotoChanged;

            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 (View);
            photo_view_scrolled.Child.ButtonPressEvent += HandleButtonPressEvent;
            View.AddEvents ((int) EventMask.KeyPressMask);
            inner_vbox.PackStart (photo_view_scrolled, true, true, 0);
            inner_hbox.PackStart (inner_vbox, true, true, 0);

            HBox lower_hbox = new HBox (false, 2);
            //inner_hbox.BorderWidth = 6;

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

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

            rating = new RatingEntry {
                HasFrame = false,
                AlwaysShowEmptyStars = true
            };
            lower_hbox.PackStart (rating, false, false, 0);
            rating.Changed += HandleRatingChanged;

            SetColors ();

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

            vbox.ShowAll ();

            Realized += (o, e) => SetColors();
            Preferences.SettingChanged += OnPreferencesChanged;
        }
Пример #58
0
        public FullScreenView(IBrowsableCollection collection, 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[] {
                    new ActionEntry(HideToolbar, Stock.Close,
                                    Catalog.GetString("Hide"),
                                    null,
                                    Catalog.GetString("Hide toolbar"),
                                    HideToolbarAction)
                });

                actions.Add(new[] {
                    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 WindowOpacityFader(this, 1.0, 600);
                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);
                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, 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();
                Decorated = false;
                Fullscreen();
                ButtonPressEvent += HandleButtonPressEvent;

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

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

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

                notebook.CurrentPage = 0;
            } catch (Exception e) {
                Log.Exception(e);
            }
        }
Пример #59
0
        static public Gdk.Pixbuf Load(IBrowsableCollection collection, int index)
        {
            IBrowsableItem item = collection [index];

            return(Load(item));
        }
Пример #60
0
        public SendEmail(IBrowsableCollection selection) : base("mail_dialog")
        {
            this.selection = selection;

            for (int i = 0; i < selection.Count; i++)
            {
                Photo p = selection[i] as Photo;
                if (Gnome.Vfs.MimeType.GetMimeTypeForUri(p.DefaultVersionUri.ToString()) != "image/jpeg")
                {
                    force_original = true;
                }
            }

            if (force_original)
            {
                original_size.Active   = true;
                tiny_size.Sensitive    = false;
                small_size.Sensitive   = false;
                medium_size.Sensitive  = false;
                large_size.Sensitive   = false;
                x_large_size.Sensitive = false;
            }
            else
            {
                switch (Preferences.Get <int> (Preferences.EXPORT_EMAIL_SIZE))
                {
                case 0:  original_size.Active = true; break;

                case 1:  tiny_size.Active = true; break;

                case 2:  small_size.Active = true; break;

                case 3:  medium_size.Active = true; break;

                case 4:  large_size.Active = true; break;

                case 5:  x_large_size.Active = true; break;

                default: break;
                }
            }

            rotate_check.Active    = Preferences.Get <bool> (Preferences.EXPORT_EMAIL_ROTATE);
            rotate_check.Sensitive = original_size.Active && tiny_size.Sensitive;

            tray_scrolled.Add(new TrayView(selection));

            Dialog.Modal = false;

            // Calculate total original filesize
            for (int i = 0; i < selection.Count; i++)
            {
                Photo photo = selection[i] as Photo;
                try {
                    Orig_Photo_Size += (new Gnome.Vfs.FileInfo(photo.DefaultVersionUri.ToString())).Size;
                } catch {
                }
            }

            for (int k = 0; k < avg_scale_ref.Length; k++)
            {
                avg_scale[k] = avg_scale_ref[k];
            }


            // Calculate approximate size shrinking, use first photo, and shrink to medium size as base.
            Photo scalephoto = selection [0] as Photo;

            if (scalephoto != null && !force_original)
            {
                // Get first photos file size
                long orig_size = (new Gnome.Vfs.FileInfo(scalephoto.DefaultVersionUri.ToString())).Size;

                FilterSet filters = new FilterSet();
                filters.Add(new ResizeFilter((uint)(sizes [3])));
                long new_size;
                using (FilterRequest request = new FilterRequest(scalephoto.DefaultVersionUri)) {
                    filters.Convert(request);
                    new_size = (new Gnome.Vfs.FileInfo(request.Current.ToString())).Size;
                }

                if (orig_size > 0)
                {
                    // Get the factor (scale) between original and resized medium size.
                    scale_percentage = 1 - ((float)(orig_size - new_size) / orig_size);

                    // What is the relation between the estimated medium scale factor, and reality?
                    double scale_scale = scale_percentage / avg_scale_ref[3];

                    //System.Console.WriteLine ("scale_percentage {0}, ref {1}, relative {2}",
                    //	scale_percentage, avg_scale_ref[3], scale_scale  );

                    // Re-Calculate the proper relation per size
                    for (int k = 0; k < avg_scale_ref.Length; k++)
                    {
                        avg_scale[k] = avg_scale_ref[k] * scale_scale;
                        //	System.Console.WriteLine ("avg_scale[{0}]={1} (was {2})",
                        //		k, avg_scale[k], avg_scale_ref[k]  );
                    }
                }
            }

            NumberOfPictures.Text  = selection.Count.ToString();
            TotalOriginalSize.Text = SizeUtil.ToHumanReadable(Orig_Photo_Size);

            UpdateEstimatedSize();

            Dialog.ShowAll();

            //LoadHistory ();

            Dialog.Response += HandleResponse;
        }