diff options
Diffstat (limited to 'main')
2 files changed, 51 insertions, 10 deletions
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.UI.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.UI.cs index 08f0404871..a057219d7b 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.UI.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.UI.cs @@ -68,6 +68,7 @@ namespace MonoDevelop.PackageManagement Label installedLabel; Label updatesLabel; Label consolidateLabel; + HBox tabGroup; VBox projectsListViewVBox; Label projectsListViewLabel; ListView projectsListView; @@ -99,6 +100,8 @@ namespace MonoDevelop.PackageManagement packageSourceComboBox.MinWidth = 200; topHBox.PackStart (packageSourceComboBox); + tabGroup = new HBox (); + int tabLabelMinWidth = 60; browseLabel = new Label (); browseLabel.Text = GettextCatalog.GetString ("Browse"); @@ -106,33 +109,30 @@ namespace MonoDevelop.PackageManagement browseLabel.MinWidth = tabLabelMinWidth; browseLabel.MarginLeft = 10; browseLabel.CanGetFocus = true; - browseLabel.Accessible.Role = Xwt.Accessibility.Role.Button; - - topHBox.PackStart (browseLabel); + tabGroup.PackStart (browseLabel); installedLabel = new Label (); installedLabel.Text = GettextCatalog.GetString ("Installed"); installedLabel.Tag = installedLabel.Text; installedLabel.MinWidth = tabLabelMinWidth; installedLabel.CanGetFocus = true; - installedLabel.Accessible.Role = Xwt.Accessibility.Role.Button; - topHBox.PackStart (installedLabel); + tabGroup.PackStart (installedLabel); updatesLabel = new Label (); updatesLabel.Text = GettextCatalog.GetString ("Updates"); updatesLabel.Tag = updatesLabel.Text; updatesLabel.MinWidth = tabLabelMinWidth; updatesLabel.CanGetFocus = true; - updatesLabel.Accessible.Role = Xwt.Accessibility.Role.Button; - topHBox.PackStart (updatesLabel); + tabGroup.PackStart (updatesLabel); consolidateLabel = new Label (); consolidateLabel.Text = GettextCatalog.GetString ("Consolidate"); consolidateLabel.Tag = consolidateLabel.Text; consolidateLabel.MinWidth = tabLabelMinWidth; consolidateLabel.CanGetFocus = true; - consolidateLabel.Accessible.Role = Xwt.Accessibility.Role.Button; - topHBox.PackStart (consolidateLabel); + tabGroup.PackStart (consolidateLabel); + + topHBox.PackStart (tabGroup); packageSearchEntry = new SearchTextEntry (); packageSearchEntry.Name = "managePackagesDialogSearchEntry"; diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.cs index 136ef23a9a..85de94c6e3 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Gui/ManagePackagesDialog.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; using System.Linq; +using MonoDevelop.Components.AtkCocoaHelper; using MonoDevelop.Core; using MonoDevelop.Ide; using MonoDevelop.Projects; @@ -90,7 +91,6 @@ namespace MonoDevelop.PackageManagement consolidateLabel.Visible = viewModel.IsManagingSolution; UpdateDialogTitle (); UpdatePackageSearchEntryWithInitialText (initialSearch); - UpdatePackageResultsPageLabels (); InitializeListView (); UpdateAddPackagesButton (); @@ -113,6 +113,33 @@ namespace MonoDevelop.PackageManagement updatesLabel.KeyPressed += UpdatesLabelKeyPressed; consolidateLabel.ButtonPressed += ConsolidateLabelButtonPressed; consolidateLabel.KeyPressed += ConsolidateLabelKeyPressed; + UpdateTabAccessibility (); + UpdatePackageResultsPageLabels (); + } + + void UpdateTabAccessibility () + { + if (tabGroup.Surface.ToolkitEngine.Type == ToolkitType.Gtk) { + if (consolidateLabel.Parent.Surface.NativeWidget is Gtk.Container a11yGroup) { + a11yGroup.Accessible.SetRole (AtkCocoa.Roles.AXTabGroup); + var children = a11yGroup.Children; + var tabs = new List<Atk.Object> (children.Length); + foreach (var child in children) { + if (!child.Visible) + continue; + if (child is Gtk.EventBox box && box.Child is Gtk.Label) { + box.Accessible.SetTitleUIElement (box.Child.Accessible); + box.Child.Accessible.SetShouldIgnore (true); + } + var tab = child.Accessible; + tab.SetRole (AtkCocoa.Roles.AXRadioButton); + tab.SetSubRole (AtkCocoa.SubRoles.AXTabButton); + tab.SetValue (false); + tabs.Add (tab); + } + a11yGroup.Accessible.SetTabs (tabs.ToArray ()); + } + } } public bool ShowPreferencesForPackageSources { get; private set; } @@ -1110,12 +1137,26 @@ namespace MonoDevelop.PackageManagement { string text = (string)label.Tag; if (page == viewModel.PageSelected) { + UpdatePackageResultsLabelA11y (label, true); label.Markup = string.Format ("<b><u>{0}</u></b>", text); } else { + UpdatePackageResultsLabelA11y (label, false); label.Markup = text; } } + static void UpdatePackageResultsLabelA11y (Label label, bool active) + { + if (label.Surface.ToolkitEngine.Type == ToolkitType.Gtk) { + var widget = label.Surface.NativeWidget as Gtk.Widget; + if (widget != null) { + widget.Accessible.SetValue (active); + // FIXME: Accessible.SetValue has no effect, so set the role description instead + widget.Accessible.SetRole (AtkCocoa.Roles.AXRadioButton, active ? "selected tab" : "tab"); + } + } + } + void UpdatePackageResultsLabel (ManagePackagesPage page, Button label) { string text = (string)label.Tag; |