diff options
author | Matt Ward <matt.ward@xamarin.com> | 2016-03-11 17:48:29 +0300 |
---|---|---|
committer | Lluis Sanchez <lluis@xamarin.com> | 2016-03-21 18:43:22 +0300 |
commit | 816e739f36c66fa22a295ce56b6264d0793a740b (patch) | |
tree | bc2a86210b4bdc7d4c5e28b05b395c733b7e8081 /main/src/core/MonoDevelop.Ide | |
parent | 2979c8cb36f77c384279691b9432f8082b5c672e (diff) |
Branding service improvements
The BrandingService's ApplicationName is no longer readonly. If the
UpdateApplicationName method is used to update the name then the
ApplicationNameChanged event will fire. This can be used to update
any part of the UI that is showing the old application name.
Moved the default name of the dialog image to a class so it can
be updated at runtime.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide')
4 files changed, 31 insertions, 2 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/StatusArea.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/StatusArea.cs index bf0070f28a..62be5cca43 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/StatusArea.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/StatusArea.cs @@ -107,6 +107,8 @@ namespace MonoDevelop.Components.MainToolbar StatusBarContextHandler ctxHandler; bool progressBarVisible; + string currentApplicationName = String.Empty; + Queue<Message> messageQueue; public StatusBar MainContext { @@ -346,10 +348,14 @@ namespace MonoDevelop.Components.MainToolbar TaskService.Errors.TasksAdded += updateHandler; TaskService.Errors.TasksRemoved += updateHandler; + + currentApplicationName = BrandingService.ApplicationName; + BrandingService.ApplicationNameChanged += ApplicationNameChanged; box.Destroyed += delegate { TaskService.Errors.TasksAdded -= updateHandler; TaskService.Errors.TasksRemoved -= updateHandler; + BrandingService.ApplicationNameChanged -= ApplicationNameChanged; }; ebox.VisibleWindow = false; @@ -368,6 +374,16 @@ namespace MonoDevelop.Components.MainToolbar return ebox; } + void ApplicationNameChanged (object sender, EventArgs e) + { + if (renderArg.CurrentText == currentApplicationName) { + LoadText (BrandingService.ApplicationName, false); + LoadPixbuf (null); + QueueDraw (); + } + currentApplicationName = BrandingService.ApplicationName; + } + protected override void OnRealized () { base.OnRealized (); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/AboutMonoDevelopTabPage.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/AboutMonoDevelopTabPage.cs index e79bd0cc61..70287f70e0 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/AboutMonoDevelopTabPage.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/AboutMonoDevelopTabPage.cs @@ -43,11 +43,11 @@ namespace MonoDevelop.Ide.Gui.Dialogs { BorderWidth = 0; - var aboutFile = BrandingService.GetFile ("AboutImage.png"); + var aboutFile = BrandingService.GetFile (AboutDialogImage.Name); if (aboutFile != null) imageSep = Xwt.Drawing.Image.FromFile (aboutFile); else - imageSep = Xwt.Drawing.Image.FromResource ("AboutImage.png"); + imageSep = Xwt.Drawing.Image.FromResource (AboutDialogImage.Name); PackStart (new ImageView (imageSep), false, false, 0); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CommonAboutDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CommonAboutDialog.cs index b7a4e7aa90..5fa9cc68c5 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CommonAboutDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CommonAboutDialog.cs @@ -47,6 +47,11 @@ using System.Collections.Generic; namespace MonoDevelop.Ide.Gui.Dialogs { + public static class AboutDialogImage + { + public static string Name = "AboutImage.png"; + } + internal class CommonAboutDialog : Dialog { public CommonAboutDialog () diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs index 58d6768512..d1bd9678c9 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs @@ -214,6 +214,7 @@ namespace MonoDevelop.Ide.Gui HeightRequest = normalBounds.Height; DeleteEvent += new Gtk.DeleteEventHandler (OnClosing); + BrandingService.ApplicationNameChanged += ApplicationNameChanged; SetAppIcons (); @@ -555,6 +556,11 @@ namespace MonoDevelop.Ide.Gui return IdeApp.ProjectOperations.CurrentSelectedProject.Name + " - " + BrandingService.ApplicationName; return BrandingService.ApplicationName; } + + void ApplicationNameChanged (object sender, EventArgs e) + { + SetWorkbenchTitle (); + } public Properties GetStoredMemento (IViewContent content) { @@ -721,6 +727,8 @@ namespace MonoDevelop.Ide.Gui return false; CloseAllViews (); + + BrandingService.ApplicationNameChanged -= ApplicationNameChanged; PropertyService.Set ("SharpDevelop.Workbench.WorkbenchMemento", this.Memento); IdeApp.OnExited (); |