Exemplo n.º 1
0
 internal FSpotUploadProgress(
     Picture [] pictures,
     ThreadProgressDialog progress_dialog)
     : base(pictures)
 {
     this.progress_dialog = progress_dialog;
 }
Exemplo n.º 2
0
        private void HandleOkClicked(object sender, EventArgs args)
        {
            this.Hide();
            dialog.Hide();

            System.Threading.Thread command_thread = new System.Threading.Thread(new System.Threading.ThreadStart(doSharpening));
            command_thread.Name = "Sharpening";

            progressDialog = new ThreadProgressDialog(command_thread, 1);
            progressDialog.Start();
        }
Exemplo n.º 3
0
        void HandleOkClicked(object sender, EventArgs args)
        {
            Hide();
            dialog.Hide();

            var command_thread = new System.Threading.Thread(new System.Threading.ThreadStart(doSharpening))
            {
                Name = "Sharpening"
            };

            progressDialog = new ThreadProgressDialog(command_thread, 1);
            progressDialog.Start();
        }
Exemplo n.º 4
0
    public static Pixbuf Blur(Pixbuf src, int radius, ThreadProgressDialog dialog)
    {
        ImageSurface sourceSurface = Hyena.Gui.PixbufImageSurface.Create (src);
        ImageSurface destinationSurface = new ImageSurface (Format.Rgb24, src.Width, src.Height);

        // If we do it as a bunch of single lines (rectangles of one pixel) then we can give the progress
        // here instead of going deeper to provide the feedback
        for (int i=0; i < src.Height; i++) {
            GaussianBlurEffect.RenderBlurEffect (sourceSurface, destinationSurface, new[] { new Gdk.Rectangle (0, i, src.Width, 1) }, radius);

            if (dialog != null) {
                // This only half of the entire process
                double fraction = ((double)i / (double)(src.Height - 1)) * 0.75;
                dialog.Fraction = fraction;
            }
        }

        return destinationSurface.ToPixbuf ();
    }
Exemplo n.º 5
0
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok)
            {
                Dialog.Destroy();
                return;
            }

            if (scale_check != null)
            {
                scale = scale_check.Active;
                size  = size_spin.ValueAsInt;
            }
            else
            {
                scale = false;
            }

            browser    = browser_check.Active;
            export_tag = tag_check.Active;

            if (account != null)
            {
                album       = (PicasaAlbum)account.Picasa.GetAlbums() [Math.Max(0, album_optionmenu.Active)];
                photo_index = 0;

                Dialog.Destroy();

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

                progress_dialog = new ThreadProgressDialog(command_thread, items.Length);
                progress_dialog.Start();

                // Save these settings for next time
                Preferences.Set(SCALE_KEY, scale);
                Preferences.Set(SIZE_KEY, size);
                Preferences.Set(BROWSER_KEY, browser);
//				Preferences.Set (Preferences.EXPORT_GALLERY_META, meta);
                Preferences.Set(TAG_KEY, export_tag);
            }
        }
Exemplo n.º 6
0
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok)
            {
                export_dialog.Destroy();
                return;
            }

            if (scale_check != null)
            {
                scale = scale_check.Active;
                size  = size_spin.ValueAsInt;
            }
            else
            {
                scale = false;
            }

            browser = browser_check.Active;
            meta    = meta_check.Active;

            if (account != null)
            {
                //System.Console.WriteLine ("history = {0}", album_optionmenu.History);
                album       = account.Gallery.Albums [Math.Max(0, album_optionmenu.Active)];
                photo_index = 0;

                export_dialog.Destroy();

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

                progress_dialog = new ThreadProgressDialog(command_thread, items.Length);
                progress_dialog.Start();

                // Save these settings for next time
                Preferences.Set(SCALE_KEY, scale);
                Preferences.Set(SIZE_KEY, size);
                Preferences.Set(BROWSER_KEY, browser);
                Preferences.Set(META_KEY, meta);
            }
        }
Exemplo n.º 7
0
        public void Run(IBrowsableCollection selection)
        {
            this.selection = selection;
            dialog         = new CDExportDialog(selection, dest);

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

            clean = dialog.RemovePreviousPhotos;

            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();
        }
Exemplo n.º 8
0
    public static Pixbuf Blur(Pixbuf src, int radius, ThreadProgressDialog dialog)
    {
        ImageSurface sourceSurface      = Hyena.Gui.PixbufImageSurface.Create(src);
        ImageSurface destinationSurface = new ImageSurface(Format.Rgb24, src.Width, src.Height);

        // If we do it as a bunch of single lines (rectangles of one pixel) then we can give the progress
        // here instead of going deeper to provide the feedback
        for (int i = 0; i < src.Height; i++)
        {
            GaussianBlurEffect.RenderBlurEffect(sourceSurface, destinationSurface, new[] { new Gdk.Rectangle(0, i, src.Width, 1) }, radius);

            if (dialog != null)
            {
                // This only half of the entire process
                double fraction = ((double)i / (double)(src.Height - 1)) * 0.75;
                dialog.Fraction = fraction;
            }
        }

        return(destinationSurface.ToPixbuf());
    }
Exemplo n.º 9
0
        private void HandleResponse(object sender,
                                    Gtk.ResponseArgs args)
        {
            main_dialog.Destroy();

            if (Gtk.ResponseType.Ok != args.ResponseId)
            {
                Log.Information("Tabblo export was canceled.");
                return;
            }

            model.Serialize();

            Log.Information("Starting Tabblo export");

            Thread upload_thread =
                new Thread(new ThreadStart(Upload));

            progress_dialog = new ThreadProgressDialog(
                upload_thread, model.Photos.Length);
            progress_dialog.Start();
        }
Exemplo n.º 10
0
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok)
            {
                // FIXME this is to work around a bug in gtk+ where
                // the filesystem events are still listened to when
                // a FileChooserButton is destroyed but not finalized
                // and an event comes in that wants to update the child widgets.
                Dialog.Destroy();
                uri_chooser.Dispose();
                uri_chooser = null;
                return;
            }

            dest           = GLib.FileFactory.NewForUri(uri_chooser.Uri);
            open           = open_check.Active;
            scale          = scale_check.Active;
            exportTags     = export_tags_check.Active;
            exportTagIcons = export_tag_icons_check.Active;

            gallery_name = name_entry.Text;

            if (description_entry != null)
            {
                description = description_entry.Text;
            }

            if (scale)
            {
                size = size_spin.ValueAsInt;
            }

            command_thread      = new System.Threading.Thread(new System.Threading.ThreadStart(Upload));
            command_thread.Name = Catalog.GetString("Exporting Photos");

            progress_dialog = new ThreadProgressDialog(command_thread, 1);
            progress_dialog.Start();
        }
Exemplo n.º 11
0
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok) {
                if (command_thread != null && command_thread.IsAlive)
                    command_thread.Abort ();

                Dialog.Destroy ();
                return;
            }

            if (fr.CheckLogin() == null) {
                do_export_flickr.Sensitive = false;
                HigMessageDialog md =
                    new HigMessageDialog (Dialog,
                                  Gtk.DialogFlags.Modal |
                                  Gtk.DialogFlags.DestroyWithParent,
                                  Gtk.MessageType.Error, Gtk.ButtonsType.Ok,
                                  Catalog.GetString ("Unable to log on."),
                                  string.Format (Catalog.GetString ("F-Spot was unable to log on to {0}.  Make sure you have given the authentication using {0} web browser interface."),
                                         current_service.Name));
                md.Run ();
                md.Destroy ();
                return;
            }

            fr.ExportTags = tag_check.Active;
            fr.ExportTagHierarchy = hierarchy_check.Active;
            fr.ExportIgnoreTopLevel = ignore_top_level_check.Active;
            open = open_check.Active;
            scale = scale_check.Active;
            copy_metadata = !meta_check.Active;
            is_public = public_radio.Active;
            is_family = family_check.Active;
            is_friend = friend_check.Active;
            if (scale)
                size = size_spin.ValueAsInt;

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

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

            // Save these settings for next time
            Preferences.Set (SCALE_KEY, scale);
            Preferences.Set (SIZE_KEY, size);
            Preferences.Set (BROWSER_KEY, open);
            Preferences.Set (TAGS_KEY, tag_check.Active);
            Preferences.Set (STRIP_META_KEY, meta_check.Active);
            Preferences.Set (PUBLIC_KEY, public_radio.Active);
            Preferences.Set (FAMILY_KEY, family_check.Active);
            Preferences.Set (FRIENDS_KEY, friend_check.Active);
            Preferences.Set (TAG_HIERARCHY_KEY, hierarchy_check.Active);
            Preferences.Set (IGNORE_TOP_LEVEL_KEY, ignore_top_level_check.Active);
            Preferences.Set (current_service.PreferencePath, fr.Token);
        }
        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 ();
        }
Exemplo n.º 13
0
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok) {
                // FIXME this is to work around a bug in gtk+ where
                // the filesystem events are still listened to when
                // a FileChooserButton is destroyed but not finalized
                // and an event comes in that wants to update the child widgets.
                Dialog.Destroy ();
                uri_chooser.Dispose ();
                uri_chooser = null;
                return;
            }

            dest = new Gnome.Vfs.Uri (uri_chooser.Uri);
            open = open_check.Active;
            scale = scale_check.Active;
            rotate = rotate_check.Active;
            exportTags = export_tags_check.Active;
            exportTagIcons = export_tag_icons_check.Active;

            gallery_name = name_entry.Text;

            if (description_entry != null)
                description = description_entry.Text;

            if (scale)
                size = size_spin.ValueAsInt;

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

            //FIXME: get the files/dirs count in a cleaner way than (* 5 + 2(zip) + 9)
            // selection * 5 (original, mq, lq, thumbs, comments)
            // 2: zipfiles
            // 9: directories + info.txt + .htaccess
            // this should actually be 1 anyway, because we transfer just one dir
            progress_dialog = new ThreadProgressDialog (command_thread, 1);
            progress_dialog.Start ();
        }
Exemplo n.º 14
0
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok) {
                Dialog.Destroy ();
                return;
            }

            if (scale_check != null) {
                scale = scale_check.Active;
                size = size_spin.ValueAsInt;
            } else
                scale = false;

            browser = browser_check.Active;
            rotate = rotate_check.Active;
            //			meta = meta_check.Active;
            export_tag = tag_check.Active;

            if (account != null) {
                album = (PicasaAlbum) account.Picasa.GetAlbums() [Math.Max (0, album_optionmenu.History)];
                photo_index = 0;

                Dialog.Destroy ();

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

                progress_dialog = new ThreadProgressDialog (command_thread, items.Length);
                progress_dialog.Start ();

                // Save these settings for next time
                Preferences.Set (SCALE_KEY, scale);
                Preferences.Set (SIZE_KEY, size);
                Preferences.Set (ROTATE_KEY, rotate);
                Preferences.Set (BROWSER_KEY, browser);
            //				Preferences.Set (Preferences.EXPORT_GALLERY_META, meta);
                Preferences.Set (TAG_KEY, export_tag);
            }
        }
Exemplo n.º 15
0
		private void HandleResponse (object sender, Gtk.ResponseArgs args)
		{
			int size = 0;
			bool UserCancelled = false;
			bool rotate = true;

			// Lets remove the mail "create mail" dialog
			Dialog.Destroy();			

			if (args.ResponseId != Gtk.ResponseType.Ok) {
				return;
			}
			ProgressDialog progress_dialog = null;
		
			progress_dialog = new ProgressDialog (Catalog.GetString ("Preparing email"),
							      ProgressDialog.CancelButtonType.Stop,
							      selection.Count,
							      parent_window);
			
			size = GetScaleSize(); // Which size should we scale to. 0 --> Original
			
			// evaluate mailto command and define attachment args for cli
			System.Text.StringBuilder attach_arg = new System.Text.StringBuilder ();
			switch (Preferences.Get<string> (Preferences.GNOME_MAILTO_COMMAND)) {
				case "thunderbird %s":
				case "mozilla-thunderbird %s":
				case "seamonkey -mail -compose %s":
				case "icedove %s":
					attach_arg.Append(",");
				break;
				case "kmail %s":
					attach_arg.Append(" --attach ");
				break;
				default:  //evolution falls into default, since it supports mailto uri correctly
					attach_arg.Append("&attach=");
				break;
			}

			rotate = rotate_check.Active;  // Should we automatically rotate original photos.
			Preferences.Set (Preferences.EXPORT_EMAIL_ROTATE, rotate);

			// Initiate storage for temporary files to be deleted later
			tmp_paths = new System.Collections.ArrayList();
			
			// Create a tmp directory.
			tmp_mail_dir = System.IO.Path.GetTempFileName ();	// Create a tmp file	
			System.IO.File.Delete (tmp_mail_dir);			// Delete above tmp file
			System.IO.Directory.CreateDirectory (tmp_mail_dir);	// Create a directory with above tmp name
			
			System.Text.StringBuilder mail_attach = new System.Text.StringBuilder ();

			FilterSet filters = new FilterSet ();

			if (size != 0)
				filters.Add (new ResizeFilter ((uint) size));
			else if (rotate)
				filters.Add (new OrientationFilter ());
			filters.Add (new UniqueNameFilter (tmp_mail_dir));


			for (int i = 0; i < selection.Count; i++) {
				Photo photo = selection [i] as Photo;
				if ( (photo != null) && (!UserCancelled) ) {

					if (progress_dialog != null)
						UserCancelled = progress_dialog.Update (String.Format 
							(Catalog.GetString ("Exporting picture \"{0}\""), photo.Name));
							
					if (UserCancelled)
					 	break;
					 	
					try {
						// Prepare a tmp_mail file name
						FilterRequest request = new FilterRequest (photo.DefaultVersionUri);

						filters.Convert (request);
						request.Preserve(request.Current);

						mail_attach.Append(attach_arg.ToString() + request.Current.ToString ());
						
						// Mark the path for deletion
						tmp_paths.Add (request.Current.LocalPath);
					} catch (Exception e) {
						Console.WriteLine("Error preparing {0}: {1}", selection[photo_index].Name, e.Message);
						HigMessageDialog md = new HigMessageDialog (parent_window, 
											    DialogFlags.DestroyWithParent,
											    MessageType.Error,
											    ButtonsType.Close,
											    Catalog.GetString("Error processing image"), 
											    String.Format(Catalog.GetString("An error occured while processing \"{0}\": {1}"), selection[photo_index].Name, e.Message));
						md.Run();
						md.Destroy();
						UserCancelled = true;
					}
				}
			} // foreach
			
			if (progress_dialog != null) 
				progress_dialog.Destroy (); // No need to keep this window

			if (UserCancelled)
				DeleteTempFile();
			else {		
				// Send the mail :)
				string mail_subject = Catalog.GetString("my photos");
				switch (Preferences.Get<string> (Preferences.GNOME_MAILTO_COMMAND)) {
					// openSuSE
					case "thunderbird %s":
						System.Diagnostics.Process.Start("thunderbird", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
					break;
					case "icedove %s":
						System.Diagnostics.Process.Start("icedove", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
					break;
					case "mozilla-thunderbird %s":
						System.Diagnostics.Process.Start("mozilla-thunderbird", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
					break;
					case "seamonkey -mail -compose %s":
						System.Diagnostics.Process.Start("seamonkey", " -mail -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
					break;
					case "kmail %s":
						System.Diagnostics.Process.Start("kmail", "  --composer --subject \"" + mail_subject + "\"" + mail_attach);
					break;
					default: 
						GnomeUtil.UrlShow ("mailto:?subject=" + System.Web.HttpUtility.UrlEncode(mail_subject) + mail_attach);
					break;
				}
				                
				// Check if we have any temporary files to be deleted
				if (tmp_paths.Count > 0) {
					// Fetch timeout value from preferences. In seconds. Needs to be multiplied with 1000 to get msec
					uint delete_timeout;
					delete_timeout = (uint) (Preferences.Get<int> (Preferences.EXPORT_EMAIL_DELETE_TIMEOUT_SEC));
					delete_timeout = delete_timeout * 1000; // to get milliseconds.

					// Start a timer and when it occurs, delete the temp files.
					GLib.Timeout.Add (delete_timeout, new GLib.TimeoutHandler (DeleteTempFile));
				}
			}
		}
Exemplo n.º 16
0
        void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok)
            {
                if (command_thread != null && command_thread.IsAlive)
                {
                    command_thread.Abort();
                }

                Dialog.Destroy();
                return;
            }

            if (fr.CheckLogin(oauth_verification_code.Text) == null)
            {
                do_export_flickr.Sensitive = false;
                var md =
                    new HigMessageDialog(Dialog,
                                         Gtk.DialogFlags.Modal |
                                         Gtk.DialogFlags.DestroyWithParent,
                                         Gtk.MessageType.Error, Gtk.ButtonsType.Ok,
                                         Catalog.GetString("Unable to log on."),
                                         string.Format(Catalog.GetString("F-Spot was unable to log on to {0}.  Make sure you have given the authentication using {0} web browser interface."),
                                                       current_service.Name));
                md.Run();
                md.Destroy();
                return;
            }

            fr.ExportTags           = tag_check.Active;
            fr.ExportTagHierarchy   = hierarchy_check.Active;
            fr.ExportIgnoreTopLevel = ignore_top_level_check.Active;
            open      = open_check.Active;
            scale     = scale_check.Active;
            is_public = public_radio.Active;
            is_family = family_check.Active;
            is_friend = friend_check.Active;
            if (scale)
            {
                size = size_spin.ValueAsInt;
            }

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

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

            // Save these settings for next time
            Preferences.Set(SCALE_KEY, scale);
            Preferences.Set(SIZE_KEY, size);
            Preferences.Set(BROWSER_KEY, open);
            Preferences.Set(TAGS_KEY, tag_check.Active);
            Preferences.Set(PUBLIC_KEY, public_radio.Active);
            Preferences.Set(FAMILY_KEY, family_check.Active);
            Preferences.Set(FRIENDS_KEY, friend_check.Active);
            Preferences.Set(TAG_HIERARCHY_KEY, hierarchy_check.Active);
            Preferences.Set(IGNORE_TOP_LEVEL_KEY, ignore_top_level_check.Active);
            Preferences.Set(current_service.PreferencePath, fr.Token.Token);
            Preferences.Set(current_service.PreferencePath + "secret", fr.Token.TokenSecret);
            Preferences.Set(current_service.PreferencePath + "userId", fr.Token.UserId);
            Preferences.Set(current_service.PreferencePath + "userName", fr.Token.Username);
        }
Exemplo n.º 17
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();
        }
        private void HandleResponse(object sender,
		                             Gtk.ResponseArgs args)
        {
            main_dialog.Destroy ();

            if (Gtk.ResponseType.Ok != args.ResponseId) {
                Log.Information ("Tabblo export was canceled.");
                return;
            }

            model.Serialize ();

            Log.Information ("Starting Tabblo export");

            Thread upload_thread =
                    new Thread (new ThreadStart (Upload));
            progress_dialog = new ThreadProgressDialog (
                    upload_thread, model.Photos.Length);
            progress_dialog.Start ();
        }
Exemplo n.º 19
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 ();
        }
Exemplo n.º 20
0
    unsafe public static Pixbuf UnsharpMask(Pixbuf src,
                                            double radius,
                                            double amount,
                                            double threshold,
                                            ThreadProgressDialog progressDialog)
    {
        // Make sure the pixbuf has an alpha channel before we try to blur it
        src = src.AddAlpha(false, 0, 0, 0);

        Pixbuf result = Blur(src, (int)radius, progressDialog);

        int sourceRowstride = src.Rowstride;
        int sourceHeight    = src.Height;
        int sourceChannels  = src.NChannels;
        int sourceWidth     = src.Width;

        int resultRowstride = result.Rowstride;
        int resultWidth     = result.Width;
        int resultChannels  = result.NChannels;

        byte[] srcRow  = new byte[sourceRowstride];
        byte[] destRow = new byte[resultRowstride];

        byte *sourcePixels = (byte *)src.Pixels;
        byte *resultPixels = (byte *)result.Pixels;

        for (int row = 0; row < sourceHeight; row++)
        {
            Pixbuf_GetRow(sourcePixels, row, sourceRowstride, sourceWidth, sourceChannels, srcRow);
            Pixbuf_GetRow(resultPixels, row, resultRowstride, resultWidth, resultChannels, destRow);

            int diff;
            for (int i = 0; i < sourceWidth * sourceChannels; i++)
            {
                diff = srcRow [i] - destRow [i];
                if (Math.Abs(2 * diff) < threshold)
                {
                    diff = 0;
                }

                int val = (int)(srcRow [i] + amount * diff);

                if (val > 255)
                {
                    val = 255;
                }
                else if (val < 0)
                {
                    val = 0;
                }

                destRow [i] = (byte)val;
            }

            Pixbuf_SetRow(resultPixels, destRow, row, resultRowstride, resultWidth, resultChannels);

            // This is the other half of the progress so start and halfway
            if (progressDialog != null)
            {
                progressDialog.Fraction = ((double)row / ((double)sourceHeight - 1)) * 0.25 + 0.75;
            }
        }

        return(result);
    }
Exemplo n.º 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 ();
        }
Exemplo n.º 22
0
    public static unsafe Pixbuf UnsharpMask(Pixbuf src,
                                             double radius,
                                             double amount,
                                             double threshold,
                                             ThreadProgressDialog progressDialog)
    {
        // Make sure the pixbuf has an alpha channel before we try to blur it
        src = src.AddAlpha (false, 0, 0, 0);

        Pixbuf result = Blur (src, (int)radius, progressDialog);

        int sourceRowstride = src.Rowstride;
        int sourceHeight = src.Height;
        int sourceChannels = src.NChannels;
        int sourceWidth = src.Width;

        int resultRowstride = result.Rowstride;
        int resultWidth = result.Width;
        int resultChannels = result.NChannels;

        byte[] srcRow = new byte[sourceRowstride];
        byte[] destRow = new byte[resultRowstride];

        byte* sourcePixels = (byte*)src.Pixels;
        byte* resultPixels = (byte*)result.Pixels;

        for (int row=0; row < sourceHeight; row++) {
            Pixbuf_GetRow (sourcePixels, row, sourceRowstride, sourceWidth, sourceChannels, srcRow);
            Pixbuf_GetRow (resultPixels, row, resultRowstride, resultWidth, resultChannels, destRow);

            int diff;
            for (int i=0; i < sourceWidth*sourceChannels; i++) {
                diff = srcRow [i] - destRow [i];
                if (Math.Abs (2 * diff) < threshold)
                    diff = 0;

                int val = (int)(srcRow [i] + amount * diff);

                if (val > 255)
                    val = 255;
                else if (val < 0)
                    val = 0;

                destRow [i] = (byte)val;
            }

            Pixbuf_SetRow (resultPixels, destRow, row, resultRowstride, resultWidth, resultChannels);

            // This is the other half of the progress so start and halfway
            if (progressDialog != null)
                progressDialog.Fraction = ((double)row / ((double) sourceHeight - 1) ) * 0.25 + 0.75;
        }

        return result;
    }
Exemplo n.º 23
0
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok) {
                // FIXME this is to work around a bug in gtk+ where
                // the filesystem events are still listened to when
                // a FileChooserButton is destroyed but not finalized
                // and an event comes in that wants to update the child widgets.
                Dialog.Destroy ();
                uri_chooser.Dispose ();
                uri_chooser = null;
                return;
            }

            dest = GLib.FileFactory.NewForUri (uri_chooser.Uri);
            open = open_check.Active;
            scale = scale_check.Active;
            exportTags = export_tags_check.Active;
            exportTagIcons = export_tag_icons_check.Active;

            gallery_name = name_entry.Text;

            if (description_entry != null)
                description = description_entry.Text;

            if (scale)
                size = size_spin.ValueAsInt;

            command_thread = new System.Threading.Thread (new System.Threading.ThreadStart (Upload));
            command_thread.Name = Catalog.GetString ("Exporting Photos");

            progress_dialog = new ThreadProgressDialog (command_thread, 1);
            progress_dialog.Start ();
        }
Exemplo n.º 24
0
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok) {
                export_dialog.Destroy ();
                return;
            }

            if (scale_check != null) {
                scale = scale_check.Active;
                size = size_spin.ValueAsInt;
            } else
                scale = false;

            browser = browser_check.Active;
            meta = meta_check.Active;
            rotate = rotate_check.Active;

            if (account != null) {
                //System.Console.WriteLine ("history = {0}", album_optionmenu.History);
                album = (Album) account.Gallery.Albums [Math.Max (0, album_optionmenu.History)];
                photo_index = 0;

                export_dialog.Destroy ();

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

                progress_dialog = new ThreadProgressDialog (command_thread, items.Length);
                progress_dialog.Start ();

                // Save these settings for next time
                Preferences.Set (SCALE_KEY, scale);
                Preferences.Set (SIZE_KEY, size);
                Preferences.Set (BROWSER_KEY, browser);
                Preferences.Set (META_KEY, meta);
                Preferences.Set (ROTATE_KEY, rotate);
            }
        }
Exemplo n.º 25
0
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok) {
                Dialog.Destroy ();
                return;
            }

            if (scale_check != null) {
                scale = scale_check.Active;
                size = size_spin.ValueAsInt;
            } else
                scale = false;

            browser = browser_check.Active;

            if (account != null) {
                album = (Album) account.SmugMug.GetAlbums() [Math.Max (0, album_optionmenu.Active)];
                photo_index = 0;

                Dialog.Destroy ();

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

                progress_dialog = new ThreadProgressDialog (command_thread, items.Length);
                progress_dialog.Start ();

                // Save these settings for next time
                Preferences.Set (SCALE_KEY, scale);
                Preferences.Set (SIZE_KEY, size);
                Preferences.Set (BROWSER_KEY, browser);
            }
        }
Exemplo n.º 26
0
        private bool SaveFiles()
        {
            index_list = GetSelectedItems ();
            this.Dialog.Hide ();

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

            progress_dialog = new ThreadProgressDialog (command_thread, 1);
            progress_dialog.Start ();

            while (command_thread.IsAlive) {
                if (Application.EventsPending ())
                    Application.RunIteration ();

            }

            return true;
        }