diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2019-07-24 10:06:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-24 10:06:47 +0300 |
commit | 4be6942827b79d31e70b2dc8ca64eeb98f18cc4b (patch) | |
tree | a86e824dbe4178159647a7f5c5d99decae2faaad /main/src | |
parent | ff1d7577ac801a11a23711389edc3935e72ba329 (diff) | |
parent | 861c58a28922bebcd7ff2246a1f7c04c2c33e6f3 (diff) |
Merge pull request #8260 from mono/fix948301-infobar-alignment
[Ide] Fix InfoBar button alignments
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/InfoBar.cs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/InfoBar.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/InfoBar.cs index 157cf72bb9..d34803143b 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/InfoBar.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/InfoBar.cs @@ -55,8 +55,17 @@ namespace MonoDevelop.Ide.Gui.Components mainBox.PackStart (new ImageView (ImageService.GetIcon (Stock.Information, Gtk.IconSize.Menu)), marginLeft: 11); mainBox.PackStart (descriptionLabel = new Label (description)); + int firstItem = 0; if (items.Length > 0 && items[0].Kind == InfoBarItemKind.Hyperlink) { + firstItem = 1; + var link = new InfoBarLink { + Text = items [0].Title, + }; + link.AddAction (items [0].Action); + if (items [0].CloseAfter) + link.AddAction (() => Dispose ()); mainBox.PackStart (new Label ("–")); + mainBox.PackStart (link); } var closeButton = new InfoBarCloseButton { @@ -65,7 +74,10 @@ namespace MonoDevelop.Ide.Gui.Components }; closeButton.AddAction (() => Dispose ()); - foreach (var item in items) { + var widgets = new List<Widget> (items.Length); + + for (int i = items.Length - 1; i >= firstItem; i--) { + var item = items [i]; // TODO: abstract this into a factory. Widget toAdd = null; switch (item.Kind) @@ -101,10 +113,12 @@ namespace MonoDevelop.Ide.Gui.Components } if (toAdd != null) - mainBox.PackStart (toAdd); + widgets.Add (toAdd); } mainBox.PackEnd (closeButton); + foreach (var widget in widgets) + mainBox.PackEnd (widget); if (IdeApp.Preferences == null || IdeApp.Preferences.UserInterfaceTheme == Theme.Light) { Content = new FrameBox (mainBox) { |