static void TextCellDataFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) { var addin = (Addin)model.GetValue (iter, COL_ADDIN); var markup = string.Format ( "<b>{0}</b>\n{1}", GLib.Markup.EscapeText (AddinHelpers.GetUnversionedId (addin)), GLib.Markup.EscapeText (addin.Name) ); var cellRendererText = (CellRendererText)cell; cellRendererText.Markup = markup; }
public void AddAddinReference() { var arc = (AddinReferenceCollection)CurrentNode.DataItem; var existingAddins = new HashSet <string> ( arc.Project.AddinReferences.Select(a => a.Id) ); var allAddins = arc.Project.AddinRegistry.GetAddins() .Where(a => !existingAddins.Contains(AddinHelpers.GetUnversionedId(a))) .ToArray(); if (allAddins.Length == 0) { MessageService.ShowMessage( GettextCatalog.GetString("You have already referenced all available addins") ); return; } var dialog = new AddAddinReferenceDialog(allAddins); Addin[] selectedAddins; try { if (MessageService.RunCustomDialog(dialog) != (int)Gtk.ResponseType.Ok) { return; } selectedAddins = dialog.GetSelectedAddins(); } finally { dialog.Destroy(); } //HACK: we have to ToList() or the event handlers attached to the //collection will all enumerate the list and get different copies var references = selectedAddins.Select(a => new AddinReference { Id = AddinHelpers.GetUnversionedId(a) }).ToList(); arc.Project.AddinReferences.AddRange(references); IdeApp.ProjectOperations.Save(arc.Project); }