[banshee/stable-1.6] [GtkBaseClient] break up init phases around GTK



commit 52f3e0f1a66fd94aad4a8f7df61db1b459418069
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 0e3f988..84ea1cb 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
@@ -91,6 +91,10 @@ namespace Banshee.Gui
             }
         }
 
+        protected virtual void PreInitializeGtk ()
+        {
+        }
+
         protected virtual void InitializeGtk ()
         {
             Log.Debug ("Initializing GTK");
@@ -99,7 +103,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 {
@@ -115,9 +123,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]