Navigation Menu

Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Commit

Permalink
[WelcomePage] Show it when the app goes idle
Browse files Browse the repository at this point in the history
Do not trigger showing the welcome page until the app is idle,
so as to not load the welcome page when a solution is passed to the app.

This improves startup time for solutions/documents loaded from finder

Fixes VSTS #652347 - Welcome page should not show when loading a solution from finder
  • Loading branch information
Therzok committed Oct 16, 2018
1 parent 616b3d9 commit 29a4486
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions main/src/addins/MacPlatform/MacPlatform.cs
Expand Up @@ -600,7 +600,7 @@ void GlobalSetup ()

ApplicationEvents.OpenDocuments += delegate (object sender, ApplicationDocumentEventArgs e) {
//OpenFiles may pump the mainloop, but can't do that from an AppleEvent, so use a brief timeout
GLib.Timeout.Add (10, delegate {
GLib.Timeout.Add (0, delegate {
IdeApp.ReportTimeToCode = true;
IdeApp.OpenFiles (e.Documents.Select (
doc => new FileOpenInformation (doc.Key, null, doc.Value, 1, OpenDocumentOptions.DefaultInternal))
Expand All @@ -611,7 +611,7 @@ void GlobalSetup ()
};

ApplicationEvents.OpenUrls += delegate (object sender, ApplicationUrlEventArgs e) {
GLib.Timeout.Add (10, delegate {
GLib.Timeout.Add (0, delegate {
IdeApp.ReportTimeToCode = true;
// Open files via the monodevelop:// URI scheme, compatible with the
// common TextMate scheme: http://blog.macromates.com/2007/the-textmate-url-scheme/
Expand Down
13 changes: 6 additions & 7 deletions main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs
Expand Up @@ -205,7 +205,7 @@ static IdeApp ()
}
}

public static void Initialize (ProgressMonitor monitor)
public static void Initialize (ProgressMonitor monitor, bool hideWelcomePage)
{
// Already done in IdeSetup, but called again since unit tests don't use IdeSetup.
DispatchService.Initialize ();
Expand Down Expand Up @@ -233,8 +233,8 @@ public static void Initialize (ProgressMonitor monitor)
};

FileService.ErrorHandler = FileServiceErrorHandler;
monitor.BeginTask (GettextCatalog.GetString("Loading Workbench"), 6);

monitor.BeginTask (GettextCatalog.GetString("Loading Workbench"), 5);
Counters.Initialization.Trace ("Loading Commands");

commandService.LoadCommands ("/MonoDevelop/Ide/Commands");
Expand All @@ -248,10 +248,9 @@ public static void Initialize (ProgressMonitor monitor)
Counters.Initialization.Trace ("Initializing Workbench");
workbench.Initialize (monitor);
monitor.Step (1);

MonoDevelop.Ide.WelcomePage.WelcomePageService.Initialize ();
MonoDevelop.Ide.WelcomePage.WelcomePageService.ShowWelcomePage ();

Counters.Initialization.Trace ("Initializing WelcomePage service");
MonoDevelop.Ide.WelcomePage.WelcomePageService.Initialize ();
monitor.Step (1);

Counters.Initialization.Trace ("Restoring Workbench State");
Expand All @@ -261,7 +260,7 @@ public static void Initialize (ProgressMonitor monitor)
Counters.Initialization.Trace ("Flushing GUI events");
DispatchService.RunPendingEvents ();
Counters.Initialization.Trace ("Flushed GUI events");

MessageService.RootWindow = workbench.RootWindow;
Xwt.MessageDialog.RootWindow = Xwt.Toolkit.CurrentEngine.WrapWindow (workbench.RootWindow);

Expand Down
10 changes: 9 additions & 1 deletion main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs
Expand Up @@ -71,6 +71,7 @@ public class IdeStartup: IApplication
static Stopwatch startupSectionTimer = new Stopwatch ();
static Stopwatch timeToCodeTimer = new Stopwatch ();
static Dictionary<string, long> sectionTimings = new Dictionary<string, long> ();
static bool hideWelcomePage;

static TimeToCodeMetadata ttcMetadata;

Expand Down Expand Up @@ -278,8 +279,9 @@ int Run (MonoDevelopOptions options)
// which is then replaced with a second empty Apple menu.
// XBC #33699
Counters.Initialization.Trace ("Initializing IdeApp");
IdeApp.Initialize (monitor);

hideWelcomePage = startupInfo.HasFiles;
IdeApp.Initialize (monitor, hideWelcomePage);
sectionTimings ["AppInitialization"] = startupSectionTimer.ElapsedMilliseconds;
startupSectionTimer.Restart ();

Expand Down Expand Up @@ -453,6 +455,12 @@ Assembly MSBuildAssemblyResolve (object sender, ResolveEventArgs args)
static bool OnIdle ()
{
Composition.CompositionManager.InitializeAsync ().Ignore ();
// OpenDocuments appears when the app is idle.
LoggingService.LogWarning ("Showing welcome page");
if (!hideWelcomePage) {
WelcomePage.WelcomePageService.ShowWelcomePage ();
Counters.Initialization.Trace ("Showed welcome page");
}
return false;
}

Expand Down

0 comments on commit 29a4486

Please sign in to comment.