[banshee] [MeeGo] Added a MeeGo client entry assembly



commit f7ac41cd3f0cb14c753248a593c0bafe158a7be4
Author: Aaron Bockover <abockover novell com>
Date:   Tue Apr 27 09:40:16 2010 -0400

    [MeeGo] Added a MeeGo client entry assembly
    
    This client wraps the Nereid client, but loads the Banshee.MeeGo
    extension assembly manually (before Mono.Addins) since calling
    AddinManager.Initialize takes way too long, and so the MeeGo toolbar
    gives up waiting since the MeeGo panel DBus name has not yet been
    acquired.
    
    This client creates the MeeGo panel immediately after gtk_init, so the
    MeeGo toolbar is satisfied that someone has acquired the DBus name for
    the media panel, and patiently waits for our slow startup.

 Banshee.sln                                        |    9 ++
 build/build.environment.mk                         |    3 +
 configure.ac                                       |    1 +
 src/Clients/Makefile.am                            |    3 +-
 .../MeeGo/Banshee.MeeGo.Client/MeeGoClient.cs      |   84 ++++++++++++++++++++
 src/Clients/MeeGo/Makefile.am                      |   10 +++
 src/Clients/MeeGo/MeeGo.csproj                     |   76 ++++++++++++++++++
 .../Banshee.MeeGo/Banshee.MeeGo.addin.xml          |    4 -
 .../Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs      |    6 --
 .../Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs    |   14 ++--
 10 files changed, 192 insertions(+), 18 deletions(-)
---
diff --git a/Banshee.sln b/Banshee.sln
index b7372a4..b39c422 100644
--- a/Banshee.sln
+++ b/Banshee.sln
@@ -24,6 +24,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Booter", "src\Clients\Boote
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Beroe", "src\Clients\Beroe\Beroe.csproj", "{E0E10333-9B05-4463-8A15-6738C186BF87}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeeGo", "src\Clients\MeeGo\MeeGo.csproj", "{FC44E7C6-D625-4FF1-BA85-F074871423EF}"
+EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{48EA1A64-29EE-4555-9E79-49453EB51976}"
 	ProjectSection(SolutionItems) = postProject
 	EndProjectSection
@@ -374,6 +376,12 @@ Global
 		{F38B53BA-8F85-4DC6-9B94-029C1CF96F24}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{F38B53BA-8F85-4DC6-9B94-029C1CF96F24}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
 		{F38B53BA-8F85-4DC6-9B94-029C1CF96F24}.Windows|Any CPU.Build.0 = Windows|Any CPU
+		{FC44E7C6-D625-4FF1-BA85-F074871423EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{FC44E7C6-D625-4FF1-BA85-F074871423EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{FC44E7C6-D625-4FF1-BA85-F074871423EF}.Release|Any CPU.ActiveCfg = Debug|Any CPU
+		{FC44E7C6-D625-4FF1-BA85-F074871423EF}.Release|Any CPU.Build.0 = Debug|Any CPU
+		{FC44E7C6-D625-4FF1-BA85-F074871423EF}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
+		{FC44E7C6-D625-4FF1-BA85-F074871423EF}.Windows|Any CPU.Build.0 = Windows|Any CPU
 		{FCC1AE87-E10B-4B47-8ADE-D5F447E48518}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{FCC1AE87-E10B-4B47-8ADE-D5F447E48518}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{FCC1AE87-E10B-4B47-8ADE-D5F447E48518}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
@@ -394,6 +402,7 @@ Global
 		{B574AEB0-59F1-4FB7-A91A-8E5A651970CE} = {EB1FDF3F-048C-4010-80F5-D936A312580F}
 		{4B890CB0-F5C8-4B1B-A1B8-3813BF5126C0} = {EB1FDF3F-048C-4010-80F5-D936A312580F}
 		{E0E10333-9B05-4463-8A15-6738C186BF87} = {EB1FDF3F-048C-4010-80F5-D936A312580F}
+		{FC44E7C6-D625-4FF1-BA85-F074871423EF} = {EB1FDF3F-048C-4010-80F5-D936A312580F}
 		{A3701765-E571-413D-808C-9788A22791AF} = {48EA1A64-29EE-4555-9E79-49453EB51976}
 		{B28354F0-BA87-44E8-989F-B864A3C7C09F} = {48EA1A64-29EE-4555-9E79-49453EB51976}
 		{2ADB831A-A050-47D0-B6B9-9C19D60233BB} = {48EA1A64-29EE-4555-9E79-49453EB51976}
diff --git a/build/build.environment.mk b/build/build.environment.mk
index d7c4c8e..593b3ea 100644
--- a/build/build.environment.mk
+++ b/build/build.environment.mk
@@ -100,6 +100,8 @@ LINK_BANSHEE_THICKCLIENT_DEPS = $(REF_BANSHEE_THICKCLIENT) \
 	$(LINK_BANSHEE_THICKCLIENT)
 
 REF_NEREID = $(LINK_BANSHEE_THICKCLIENT_DEPS)
+LINK_NEREID = -r:$(DIR_BIN)/Nereid.exe $(REF_NEREID)
+REF_MEEGO = $(LINK_NEREID) $(LINK_EXTENSION_MEEGO)
 REF_HALIE = $(LINK_BANSHEE_SERVICES_DEPS)
 REF_BEROE = $(LINK_BANSHEE_SERVICES_DEPS)
 REF_BOOTER = $(LINK_BANSHEE_SERVICES_DEPS)
@@ -128,6 +130,7 @@ REF_EXTENSION_INTERNETARCHIVE = $(LINK_BANSHEE_THICKCLIENT_DEPS)
 REF_EXTENSION_LIBRARYWATCHER = $(LINK_BANSHEE_SERVICES_DEPS)
 REF_EXTENSION_MINIMODE = $(LINK_BANSHEE_THICKCLIENT_DEPS)
 REF_EXTENSION_MEEGO = $(LINK_BANSHEE_THICKCLIENT_DEPS)
+LINK_EXTENSION_MEEGO = -r:$(DIR_BIN)/Banshee.MeeGo.dll $(REF_EXTENSION_MEEGO)
 REF_EXTENSION_MULTIMEDIAKEYS = $(LINK_BANSHEE_SERVICES_DEPS)
 REF_EXTENSION_NOTIFICATIONAREA = $(LINK_BANSHEE_THICKCLIENT_DEPS)
 REF_EXTENSION_PLAYER_MIGRATION = $(LINK_BANSHEE_THICKCLIENT_DEPS)
diff --git a/configure.ac b/configure.ac
index 31b155f..f894fbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -260,6 +260,7 @@ src/Clients/Booter/banshee-1.darwin
 src/Clients/Halie/Makefile
 src/Clients/Muinshee/Makefile
 src/Clients/Nereid/Makefile
+src/Clients/MeeGo/Makefile
 
 src/Core/Makefile
 src/Core/Banshee.CollectionIndexer/Makefile
diff --git a/src/Clients/Makefile.am b/src/Clients/Makefile.am
index c0fea2a..c85adae 100644
--- a/src/Clients/Makefile.am
+++ b/src/Clients/Makefile.am
@@ -3,7 +3,8 @@ SUBDIRS = \
 	Booter \
 	Halie \
 	Muinshee \
-	Nereid
+	Nereid \
+	MeeGo
 
 MAINTAINERCLEANFILES = Makefile.in
 
diff --git a/src/Clients/MeeGo/Banshee.MeeGo.Client/MeeGoClient.cs b/src/Clients/MeeGo/Banshee.MeeGo.Client/MeeGoClient.cs
new file mode 100644
index 0000000..133c44a
--- /dev/null
+++ b/src/Clients/MeeGo/Banshee.MeeGo.Client/MeeGoClient.cs
@@ -0,0 +1,84 @@
+//
+// MeeGoClient.cs
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright 2010 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+// The MeeGo client is just a wrapper around the Nereid client.
+// This is done to ensure we can create the MeeGo panel instance as
+// soon as possible. The problem with loading the panel through the
+// /Banshee/ThickClient/GtkBaseClient/PostInitializeGtk extension
+// point is that Mono.Addins.AddinManager.Initialize is extremely
+// slow. Here's the scenario:
+//
+//   (a) Banshee is not running at all
+//   (b) User clicks "Media" icon in the MeeGo toolbar
+//   (c) Banshee is started via its MeeGo toolbar DBus service
+//   (d) Meanwhile, the MeeGo toolbar is waiting for someone to
+//       actually acquire the DBus name as specified in the
+//       service file
+//   (e) Banshee is taking forever to load (stuck in Mono.Addins), so
+//       the MeeGo extension has not yet run (it is an addin), and
+//       thus its /Banshee/ThickClient/GtkBaseClient/PostInitializeGtk
+//       extension is never instantiated (which is an instance of
+//       Banshee.MeeGo.MeeGoPanel), and in turn, mpl_panel_gtk_new
+//       is not invoked in time (ultimately not acquiring the DBus
+//       name in time), and so the MeeGo toolbar gives up, and stops
+//       showing the panel (even in its "loading" state)
+//
+// So to work around this, we provide a separate entry point assembly
+// for MeeGo, which can acquire the DBus name immediately after
+// gtk_init is called. This satisfies the MeeGo toolbar, and we then
+// can load the rest of Banshee as usual. When Mono.Addins loads the
+// MeeGo extension, the actual panel contents are created, and the
+// panel is populated (meanwhile the MeeGo panel UI is in 'startup'
+// state, showing a spinner). When the GTK main loop finally runs,
+// the panel UI shows up on screen.
+//
+
+using System;
+using System.IO;
+using System.Reflection;
+
+using Banshee.Base;
+
+namespace Banshee.MeeGo.Client
+{
+    public class MeeGoClient : Nereid.Client
+    {
+        public new static void Main (string [] args)
+        {
+            // Normally Mono.Addins would load the MeeGo extension from the
+            // Extensions directory, so we need to load this reference manually
+            Assembly.LoadFile (Paths.Combine (Path.GetDirectoryName (
+                Assembly.GetEntryAssembly ().Location), "Extensions", "Banshee.MeeGo.dll"));
+            Startup<MeeGoClient> (args);
+        }
+
+        protected override void InitializeGtk ()
+        {
+            base.InitializeGtk ();
+            new Banshee.MeeGo.MeeGoPanel ();
+        }
+    }
+}
diff --git a/src/Clients/MeeGo/Makefile.am b/src/Clients/MeeGo/Makefile.am
new file mode 100644
index 0000000..79b97fd
--- /dev/null
+++ b/src/Clients/MeeGo/Makefile.am
@@ -0,0 +1,10 @@
+ASSEMBLY = MeeGo
+TARGET = exe
+LINK = $(REF_MEEGO)
+SOURCES = Banshee.MeeGo.Client/MeeGoClient.cs 
+
+if HAVE_MEEGO
+include $(top_srcdir)/build/build.mk
+else
+EXTRA_DIST = $(SOURCES)
+endif
diff --git a/src/Clients/MeeGo/MeeGo.csproj b/src/Clients/MeeGo/MeeGo.csproj
new file mode 100644
index 0000000..b8c32e1
--- /dev/null
+++ b/src/Clients/MeeGo/MeeGo.csproj
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"; ToolsVersion="3.5">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <ProjectGuid>{FC44E7C6-D625-4FF1-BA85-F074871423EF}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <UseParentDirectoryAsNamespace>true</UseParentDirectoryAsNamespace>
+    <AssemblyName>MeeGo</AssemblyName>
+    <SchemaVersion>2.0</SchemaVersion>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <SourceAnalysisOverrideSettingsFile>C:\Documents and Settings\Administrator\Application Data\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile>
+    <Optimize>true</Optimize>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ReleaseVersion>1.3</ReleaseVersion>
+    <RootNamespace>MeeGo</RootNamespace>
+    <AssemblyOriginatorKeyFile>.</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <OutputPath>..\..\..\bin</OutputPath>
+    <WarningLevel>4</WarningLevel>
+    <Optimize>false</Optimize>
+    <ConsolePause>false</ConsolePause>
+    <Commandlineparameters>--debug --uninstalled</Commandlineparameters>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Windows|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <Externalconsole>true</Externalconsole>
+    <OutputPath>..\..\..\bin</OutputPath>
+    <WarningLevel>4</WarningLevel>
+    <Optimize>false</Optimize>
+  </PropertyGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\Core\Banshee.ThickClient\Banshee.ThickClient.csproj">
+      <Project>{AC839523-7BDF-4AB6-8115-E17921B96EC6}</Project>
+      <Name>Banshee.ThickClient</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\Nereid\Nereid.csproj">
+      <Project>{4F66A4DE-5204-4150-8D0B-CE21CA52E309}</Project>
+      <Name>Nereid</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\Extensions\Banshee.MeeGo\Banshee.MeeGo.csproj">
+      <Project>{4FBB954A-5CA9-44DC-97DA-7D549AC3EADB}</Project>
+      <Name>Banshee.MeeGo</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <ProjectExtensions>
+    <MonoDevelop>
+      <Properties>
+        <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="Makefile.am">
+          <BuildFilesVar Sync="true" Name="SOURCES" />
+          <DeployFilesVar />
+          <ResourcesVar />
+          <OthersVar />
+          <GacRefVar />
+          <AsmRefVar />
+          <ProjectRefVar />
+        </MonoDevelop.Autotools.MakefileInfo>
+      </Properties>
+    </MonoDevelop>
+  </ProjectExtensions>
+  <ItemGroup>
+    <Folder Include="Banshee.MeeGo.Client\" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Banshee.MeeGo.Client\MeeGoClient.cs" />
+  </ItemGroup>
+</Project>
diff --git a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo.addin.xml b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo.addin.xml
index eb5a5ef..b1f97e7 100644
--- a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo.addin.xml
+++ b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo.addin.xml
@@ -18,9 +18,5 @@
   <Extension path="/Banshee/ServiceManager/Service">
     <Service class="Banshee.MeeGo.MeeGoService"/>
   </Extension>
-  
-  <Extension path="/Banshee/ThickClient/GtkBaseClient/PostInitializeGtk">
-    <PostInitializeGtk class="Banshee.MeeGo.MeeGoPanel"/>
-  </Extension>
    
 </Addin>
diff --git a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs
index 2f0401e..13685fd 100644
--- a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs
+++ b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs
@@ -43,7 +43,6 @@ namespace Banshee.MeeGo
         private Window window_panel;
 
         public MediaPanelContents Contents { get; private set; }
-        public bool Enabled { get; private set; }
 
         public MeeGoPanel ()
         {
@@ -52,7 +51,6 @@ namespace Banshee.MeeGo
             }
 
             Instance = this;
-            Enabled = true;
 
             Hyena.Gui.Theming.ThemeEngine.SetCurrentTheme<MeeGoTheme> ();
 
@@ -82,10 +80,6 @@ namespace Banshee.MeeGo
 
         public void BuildContents ()
         {
-            if (!Enabled) {
-                return;
-            }
-
             var timer = Log.DebugTimerStart ();
             Contents = new MediaPanelContents ();
             Contents.ShowAll ();
diff --git a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs
index 57ad7e0..547b5ee 100644
--- a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs
+++ b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs
@@ -53,13 +53,6 @@ namespace Banshee.MeeGo
 
         void IExtensionService.Initialize ()
         {
-            // We need to create the MeeGo panel connection as soon as possible
-            // to keep mutter-moblin's toolbar from thinking we crashed (timing out).
-            // The contents of the panel will be constructed later on.
-            if (MeeGoPanel.Instance.Enabled) {
-                panel = MeeGoPanel.Instance;
-            }
-
             elements_service = ServiceManager.Get<GtkElementsService> ();
             interface_action_service = ServiceManager.Get<InterfaceActionService> ();
             source_manager = ServiceManager.SourceManager;
@@ -101,6 +94,13 @@ namespace Banshee.MeeGo
 
         private void Initialize ()
         {
+            // If Banshee is running from the MeeGo client entry assembly,
+            // the MeeGoPanel will have already been created. If not, we
+            // assume we're probably not really running in a MeeGo environment,
+            // so we just create the panel here (which is likely to just be
+            // a separate top-level window for testing).
+            panel = MeeGoPanel.Instance ?? new MeeGoPanel ();
+
             // regular metacity does not seem to like this at all, crashing
             // and complaining "Window manager warning: Buggy client sent a
             // _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x2e00020"



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