[banshee] [GtkBaseClient] break up init phases around GTK



commit 43ab8c986d22062b4f3f578957c1cf32037e89e8
Author: Aaron Bockover <abockover novell com>
Date:   Tue Apr 27 09:42:57 2010 -0400

    [GtkBaseClient] break up init phases around GTK
    
    Instead of just an overridable InitializeGtk method, two new methods are
    added that can be overridden: PreInitializeGtk and PostInitializeGtk.
    Inside GtkBaseClient.Initialize, the following is the startup order
    around GTK:
    
      - PreInitializeGtk: noop by default
      - InitializeGtk: calls GLib.Thread.Init if needed, then
        Gtk.Application.Init (that's it)
      - Banshee.ServiceStack.Application.Initialize: this is where the
    	important stuff starts to happen - e.g.
    	Mono.Addins.AddinManager.Initialize, which takes 4.5 seconds on
    	netbooks - quite nasty, and it's before this call that we /must/
    	create the MeeGo panel)
      - PostInitializeGtk: creates instances of objects in addins bound to
    	the /Banshee/ThickClient/GtkBaseClient/PostInitializeGtk extension
    	point

 .../Banshee.Gui/GtkBaseClient.cs                   |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
index 02acde0..41db508 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
@@ -96,6 +96,10 @@ namespace Banshee.Gui
             }
         }
 
+        protected virtual void PreInitializeGtk ()
+        {
+        }
+
         protected virtual void InitializeGtk ()
         {
             Log.Debug ("Initializing GTK");
@@ -104,7 +108,11 @@ namespace Banshee.Gui
                 GLib.Thread.Init ();
             }
             Gtk.Application.Init ();
+        }
 
+        protected virtual void PostInitializeGtk ()
+        {
+            Log.Debug ("Post-Initializing GTK");
             foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes
                 ("/Banshee/ThickClient/GtkBaseClient/PostInitializeGtk")) {
                 try {
@@ -120,9 +128,10 @@ namespace Banshee.Gui
             // Set the process name so system process listings and commands are pretty
             ApplicationContext.TrySetProcessName (Application.InternalName);
 
-            Application.Initialize ();
-
+            PreInitializeGtk ();
             InitializeGtk ();
+            Application.Initialize ();
+            PostInitializeGtk ();
 
             Gtk.Window.DefaultIconName = default_icon_name;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]