FSpot.MainWindow.HandleTagEntryTagsAttached C# (CSharp) Method

HandleTagEntryTagsAttached() public method

public HandleTagEntryTagsAttached ( object o, string new_tags ) : void
o object
new_tags string
return void
		void HandleTagEntryTagsAttached (object o, string[] new_tags)
		{
			int[] selected_photos = SelectedIds ();
			if (selected_photos == null || new_tags == null || new_tags.Length == 0)
				return;

			Category default_category = null;
			Tag[] selection = tag_selection_widget.TagHighlight;
			if (selection.Length > 0) {
				if (selection [0] is Category)
					default_category = (Category)selection [0];
				else
					default_category = selection [0].Category;
			}
			Tag[] tags = new Tag [new_tags.Length];
			int i = 0;
			Database.BeginTransaction ();
			foreach (string tagname in new_tags) {
				Tag t = Database.Tags.GetTagByName (tagname);
				if (t == null) {
					t = Database.Tags.CreateCategory (default_category, tagname, true);
					Database.Tags.Commit (t);
				}
				tags [i++] = t;
			}
			AddTagExtended (selected_photos, tags);
			Database.CommitTransaction ();
		}
MainWindow