public BugsViewWidget(BugzillaServer server) { this.Build(); this.server = server; bugsStore = new TreeStore( typeof(BugInfo), typeof(string), // Group typeof(int), // Id typeof(int), // Local priority typeof(string), // Status typeof(string), // Severity typeof(string), // Target Milestone typeof(int), // Age typeof(string), // Assignee typeof(string), // ColOS typeof(string), // Component typeof(string), // Summary typeof(int), // Weight typeof(Gdk.Color), // Back color typeof(Gdk.Color), // Font color typeof(string) // Summary ); bugsList.Model = bugsStore; /* CellRendererSpin spin = new CellRendererSpin (); * spin.Digits = 1; */ CellRendererText spin = new CellRendererText(); spin.Editable = true; spin.Edited += HandleSpinEdited; groupColumns = new TreeViewColumn [Enum.GetValues(typeof(GroupCommand)).Length - 1]; groupColumn = bugsList.AppendColumn("Category", new CellRendererText(), "text", ColGroup); bugsList.AppendColumn("Id", new CellRendererText(), "text", ColId); bugsList.AppendColumn("Prio", spin, "text", ColPriority); groupColumns [(int)GroupCommand.GroupByStatus] = bugsList.AppendColumn("Status", new CellRendererText(), "text", ColStatus); groupColumns [(int)GroupCommand.GroupBySeverity] = bugsList.AppendColumn("Severity", new CellRendererText(), "text", ColSeverity); groupColumns [(int)GroupCommand.GroupByMilestone] = bugsList.AppendColumn("Milestone", new CellRendererText(), "text", ColTargetMilestone); bugsList.AppendColumn("Age", new CellRendererText(), "text", ColAge); groupColumns [(int)GroupCommand.GroupByOwner] = bugsList.AppendColumn("Assigned", new CellRendererText(), "text", ColAssignee); bugsList.AppendColumn("OS", new CellRendererText(), "text", ColOS); groupColumns [(int)GroupCommand.GroupByComponent] = bugsList.AppendColumn("Component", new CellRendererText(), "text", ColComponent); groupColumns [(int)GroupCommand.GroupByTag] = bugsList.AppendColumn("Tags", new CellRendererText(), "text", ColTags); CellRendererText ct = new CellRendererText(); bugsList.AppendColumn("Summary", ct, "text", ColSummary); int n = 1; foreach (TreeViewColumn col in bugsList.Columns) { col.SortColumnId = n++; col.Clickable = true; col.Resizable = true; col.Reorderable = true; CellRendererText crt = (CellRendererText)col.CellRenderers[0]; col.AddAttribute(crt, "weight", ColWeight); col.AddAttribute(crt, "background-gdk", ColBackColor); col.AddAttribute(crt, "foreground-gdk", ColFontColor); } bugsList.DragBegin += HandleBugsListDragBegin; bugsList.DragDataReceived += HandleBugsListDragDataReceived; bugsList.DragEnd += HandleBugsListDragEnd; bugsList.DragMotion += HandleBugsListDragMotion; bugsList.Selection.Mode = SelectionMode.Multiple; bugsList.Selection.Changed += HandleBugsListSelectionChanged; Gtk.TargetEntry[] targets = new Gtk.TargetEntry [] { new TargetEntry("bug", TargetFlags.Widget, 0) }; // bugsList.EnableModelDragSource (Gdk.ModifierType.None, targets, Gdk.DragAction.Move); Gtk.Drag.SourceSet(bugsList, Gdk.ModifierType.Button1Mask, targets, Gdk.DragAction.Move); bugsList.EnableModelDragDest(targets, Gdk.DragAction.Move); ActionCommand setPrioHigh = new ActionCommand(LocalCommands.SetPriorityHigh, GettextCatalog.GetString("Set High Priority (Bottom)")); ActionCommand setPrioMed = new ActionCommand(LocalCommands.SetPriorityMed, GettextCatalog.GetString("Set Medium Priority (Bottom)")); ActionCommand setPrioLow = new ActionCommand(LocalCommands.SetPriorityLow, GettextCatalog.GetString("Set Low Priority (Bottom)")); ActionCommand setPrioHighTop = new ActionCommand(LocalCommands.SetPriorityHighTop, GettextCatalog.GetString("Set High Priority (Top)")); ActionCommand setPrioMedTop = new ActionCommand(LocalCommands.SetPriorityMedTop, GettextCatalog.GetString("Set Medium Priority (Top)")); ActionCommand setPrioLowTop = new ActionCommand(LocalCommands.SetPriorityLowTop, GettextCatalog.GetString("Set Low Priority (Top)")); ActionCommand toggleRead = new ActionCommand(LocalCommands.ToggleNewMarker, GettextCatalog.GetString("Mark as Changed")); ActionCommand openInBrowser = new ActionCommand(LocalCommands.OpenInBrowser, GettextCatalog.GetString("Open in Browser")); ActionCommand refreshBugInfo = new ActionCommand(LocalCommands.RefreshFromSever, GettextCatalog.GetString("Refresh From Server")); ActionCommand setTagCommand = new ActionCommand(LocalCommands.TagsList, GettextCatalog.GetString("Set tag")); ActionCommand clearTagsCommand = new ActionCommand(LocalCommands.ClearTags, GettextCatalog.GetString("Clear Tags")); ActionCommand editTagsCommand = new ActionCommand(LocalCommands.EditTags, GettextCatalog.GetString("Edit Tags")); setTagCommand.CommandArray = true; setTagCommand.ActionType = ActionType.Check; menuSet = new CommandEntrySet(); menuSet.Add(openInBrowser); menuSet.AddSeparator(); menuSet.Add(setPrioHighTop); menuSet.Add(setPrioHigh); menuSet.Add(setPrioMedTop); menuSet.Add(setPrioMed); menuSet.Add(setPrioLowTop); menuSet.Add(setPrioLow); menuSet.AddSeparator(); CommandEntrySet tagsSet = menuSet.AddItemSet(GettextCatalog.GetString("Tags")); tagsSet.Add(setTagCommand); tagsSet.AddSeparator(); tagsSet.Add(clearTagsCommand); tagsSet.Add(editTagsCommand); menuSet.Add(toggleRead); menuSet.AddSeparator(); menuSet.Add(refreshBugInfo); // Manage menu ActionCommand newServer = new ActionCommand(LocalCommands.NewServer, GettextCatalog.GetString("Add Server...")); ActionCommand deleteServer = new ActionCommand(LocalCommands.DeleteServer, GettextCatalog.GetString("Remove Server")); ActionCommand editServer = new ActionCommand(LocalCommands.EditServer, GettextCatalog.GetString("Edit Server")); CommandEntrySet adminMenuSet = new CommandEntrySet(); adminMenuSet.Add(newServer); adminMenuSet.Add(deleteServer); adminMenuSet.Add(editServer); // Edit button MenuButton editButton = new MenuButton(); editButton.Relief = ReliefStyle.None; editButton.Label = GettextCatalog.GetString("Manage"); editButton.MenuCreator = delegate { return(IdeApp.CommandService.CreateMenu(adminMenuSet)); }; hboxHeader.PackStart(editButton, false, false, 0); Box.BoxChild ch = (Box.BoxChild)hboxHeader [editButton]; ch.Position = 1; editButton.ShowAll(); // Group by button CommandEntrySet groupByMenuSet = new CommandEntrySet(); groupByMenuSet.Add(new ActionCommand(GroupCommand.GroupByNothing, GettextCatalog.GetString("Don't group"))); groupByMenuSet.AddSeparator(); groupByMenuSet.Add(new ActionCommand(GroupCommand.GroupByComponent, GettextCatalog.GetString("Component"))); groupByMenuSet.Add(new ActionCommand(GroupCommand.GroupByMilestone, GettextCatalog.GetString("Target Milestone"))); groupByMenuSet.Add(new ActionCommand(GroupCommand.GroupByOwner, GettextCatalog.GetString("Assigned To"))); groupByMenuSet.Add(new ActionCommand(GroupCommand.GroupBySeverity, GettextCatalog.GetString("Severity"))); groupByMenuSet.Add(new ActionCommand(GroupCommand.GroupByStatus, GettextCatalog.GetString("Status"))); groupByMenuSet.Add(new ActionCommand(GroupCommand.GroupByTag, GettextCatalog.GetString("Tag"))); MenuButton groupButton = new MenuButton(); groupButton.Relief = ReliefStyle.None; groupButton.Label = GettextCatalog.GetString("Group By"); groupButton.MenuCreator = delegate { return(IdeApp.CommandService.CreateMenu(groupByMenuSet)); }; hboxHeader.PackStart(groupButton, false, false, 0); ch = (Box.BoxChild)hboxHeader [groupButton]; ch.Position = 4; groupButton.ShowAll(); // Load data FillServers(); FillServer(null); }