FSpot.MainWindow.HandleDeleteCommand C# (CSharp) Method

HandleDeleteCommand() public method

public HandleDeleteCommand ( object sender, EventArgs args ) : void
sender object
args System.EventArgs
return void
		public void HandleDeleteCommand (object sender, EventArgs args)
		{
			// Don't steal characters from any text entries
			if (Window.Focus is Gtk.Entry && Gtk.Global.CurrentEvent is Gdk.EventKey) {
				Window.Focus.ProcessEvent (Gtk.Global.CurrentEvent);
				return;
			}

			Photo[] photos = SelectedPhotos ();
			string header = Catalog.GetPluralString ("Delete the selected photo permanently?",
				                "Delete the {0} selected photos permanently?",
				                photos.Length);
			header = String.Format (header, photos.Length);
			string msg = Catalog.GetPluralString ("This deletes all versions of the selected photo from your drive.",
				             "This deletes all versions of the selected photos from your drive.",
				             photos.Length);
			string ok_caption = Catalog.GetPluralString ("_Delete photo", "_Delete photos", photos.Length);

			if (ResponseType.Ok == HigMessageDialog.RunHigConfirmation (GetToplevel (sender),
				    DialogFlags.DestroyWithParent,
				    MessageType.Warning,
				    header, msg, ok_caption)) {

				uint timer = Log.DebugTimerStart ();
				foreach (Photo photo in photos) {
					foreach (uint id in photo.VersionIds) {
						try {
							photo.DeleteVersion (id, true);
						} catch (Exception e) {
							DeleteException (e, photo.VersionUri (id).ToString ());
						}
					}
				}
				Database.Photos.Remove (photos);

				UpdateQuery ();
				Log.DebugTimerPrint (timer, "HandleDeleteCommand took {0}");
			}
		}
MainWindow