[banshee] [MeeGo] we don't need to wait on MplPanelClient



commit e697f968c4c6edf03165e160c2fc3e0551979c67
Author: Aaron Bockover <abockover novell com>
Date:   Wed Mar 31 13:28:55 2010 -0400

    [MeeGo] we don't need to wait on MplPanelClient
    
    My understanding of how to add contents to the MeeGo panel was flawed.
    We do not need to wait on any signals (e.g. the private 'ready' signal)
    to add our contents to the panel. Therefore, the windowed version and
    embedded version of the panels are the same - when Banshee is ready to
    add contents, BuildContents will be called and all is well.
    
    However, after creating the MplPanelGtk instance, it seems to help to
    pump the main loop. This seems to prevent mutter-moblin from saying the
    panel is broken because we took too long to start up. Need to look into
    that issue more deeply.

 .../Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs      |   49 +++++++------------
 1 files changed, 18 insertions(+), 31 deletions(-)
---
diff --git a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs
index 4647f21..f24ffd1 100644
--- a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs
+++ b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs
@@ -38,7 +38,6 @@ namespace Banshee.MeeGo
     {
         public static MeeGoPanel Instance { get; private set; }
 
-        private bool waiting_for_embedded;
         private PanelGtk embedded_panel;
         private Window window_panel;
 
@@ -56,20 +55,14 @@ namespace Banshee.MeeGo
 
             try {
                 Log.Debug ("Attempting to create MeeGo toolbar panel");
-                waiting_for_embedded = true;
                 embedded_panel = new PanelGtk ("banshee", "media", null, "media-button", true);
-                embedded_panel.ReadyEvent += (o, e) => {
-                    lock (this) {
-                        Log.Debug ("MeeGo toolbar panel ready");
-                        waiting_for_embedded = false;
-                        BuildContents ();
-                    }
-                };
+                while (Application.EventsPending ()) {
+                    Application.RunIteration ();
+                }
             } catch (Exception e) {
                 if (!(e is DllNotFoundException)) {
                     Log.Exception ("Could not bind to MeeGo panel", e);
                 }
-                waiting_for_embedded = false;
                 window_panel = new Gtk.Window ("MeeGo Media Panel");
             }
 
@@ -82,28 +75,22 @@ namespace Banshee.MeeGo
 
         public void BuildContents ()
         {
-            lock (this) {
-                if (waiting_for_embedded) {
-                    return;
-                }
-
-                var timer = Log.DebugTimerStart ();
-                Contents = new MediaPanelContents ();
-                Contents.ShowAll ();
-                Log.DebugTimerPrint (timer, "MeeGo panel contents created: {0}");
+            var timer = Log.DebugTimerStart ();
+            Contents = new MediaPanelContents ();
+            Contents.ShowAll ();
+            Log.DebugTimerPrint (timer, "MeeGo panel contents created: {0}");
 
-                if (embedded_panel != null) {
-                    embedded_panel.SetChild (Contents);
-                } else if (window_panel != null) {
-                    window_panel.Add (Contents);
-                    window_panel.SetDefaultSize (1000, 500);
-                    window_panel.WindowPosition = WindowPosition.Center;
-                    window_panel.Show ();
-                    GLib.Timeout.Add (1000, () => {
-                        window_panel.Present ();
-                        return false;
-                    });
-                }
+            if (embedded_panel != null) {
+                embedded_panel.SetChild (Contents);
+            } else if (window_panel != null) {
+                window_panel.Add (Contents);
+                window_panel.SetDefaultSize (1000, 500);
+                window_panel.WindowPosition = WindowPosition.Center;
+                window_panel.Show ();
+                GLib.Timeout.Add (1000, () => {
+                    window_panel.Present ();
+                    return false;
+                });
             }
         }
 



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