private void OnTagsCursorChanged(object o, EventArgs args) { TreePath path; TreeViewColumn column; this.TagTreeView.GetCursor(out path, out column); TreeIter iter; if (this.TagTreeView.Model.GetIter(out iter, path)) { this.loadingTag = true; this.activeTag = (TagDetails)this.TagTreeView.Model.GetValue(iter, 5); TagLabel.Text = this.activeTag.Tag; var similar = BooruApp.BooruApplication.Database.FindSimilarTags(this.activeTag.Tag, Math.Min(5, Math.Max(1, TagLabel.Text.Length - 1))).Where(x => x.Tag != this.activeTag.Tag).Distinct().ToList(); var gridChldren = this.SimilarTagBox.Children; foreach (var child in gridChldren) { this.SimilarTagBox.Remove(child); this.RecycleSimilarTagWidget(child); } if (similar.Count == 0) { Gtk.Button emptyLabelButton = new Gtk.Button(); emptyLabelButton.Label = "No similar tags found..."; emptyLabelButton.SetAlignment(0.0f, 0.5f); emptyLabelButton.FocusOnClick = false; emptyLabelButton.Relief = ReliefStyle.None; emptyLabelButton.Sensitive = false; this.SimilarTagBox.PackStart(emptyLabelButton, false, false, 0); } else { for (int i = 0; i < similar.Count; i++) { this.SimilarTagBox.PackStart(this.GetSimilarTagWidget(similar[i].Tag), false, false, 0); } } this.SimilarTagBox.ShowAll(); this.ReplaceEntry.StyleContext.RemoveClass("entryWrong"); this.typeButtons[(int)this.activeTag.Type].Active = true; this.impliesStore.Clear(); foreach (var implied in BooruApp.BooruApplication.Database.GetTagImplications(this.activeTag.Tag)) { this.impliesStore.AppendValues(implied); } this.loadingTag = false; } }
public void GetSelectedFix(IEnumerable<MonoDevelop.Stereo.Refactoring.QuickFixes.IRefactorTask> tasks) { if (Children.Contains(vTaskBox)) this.Remove(vTaskBox); global::Stetic.Gui.Initialize (this); // Container child MonoDevelop.Stereo.Gui.QuickFixesSelection.Gtk.Container+ContainerChild this.vTaskBox = new global::Gtk.VBox (); this.vTaskBox.Name = "vTaskBox"; this.vTaskBox.Spacing = 0; tasksCache.Clear(); foreach (IRefactorTask task in tasks) { tasksCache.Add(task.Title, task); var btn = new Button (); btn.CanFocus = true; btn.UseUnderline = true; btn.Label = task.Title; btn.SetAlignment(0.00f, 0.50f); this.vTaskBox.Add (btn); btn.Clicked += (sender, e) => { Selected = tasksCache[((Button)sender).Label]; Hide (); }; global::Gtk.Box.BoxChild w = ((global::Gtk.Box.BoxChild)(this.vTaskBox [btn])); w.Position = 0; w.Expand = false; w.Fill = false; } this.Add (this.vTaskBox); if ((this.Child != null)) { this.Child.ShowAll (); } Selected = null; this.Show(); }