[banshee] New Wikipedia context pane extension; requires --enable-webkit,
- From: Gabriel Burt <gburt src gnome org>
- To: svn-commits-list gnome org
- Subject: [banshee] New Wikipedia context pane extension; requires --enable-webkit,
- Date: Tue, 12 May 2009 19:12:56 -0400 (EDT)
commit 859259dcf42dbba597b43e833f1e0b7697f05cfc
Author: Gabriel Burt <gabriel burt gmail com>
Date: Fri May 8 19:59:56 2009 -0500
New Wikipedia context pane extension; requires --enable-webkit,
replacing --enable-mediaweb
---
Banshee.sln | 5 +
build/m4/banshee/mediaweb.m4 | 14 ---
build/m4/banshee/webkit.m4 | 14 +++
configure.ac | 7 +-
.../Banshee.Wikipedia/Banshee.Wikipedia.addin.xml | 23 +++++
.../Banshee.Wikipedia/Banshee.Wikipedia.csproj | 74 ++++++++++++++++
.../Banshee.Wikipedia/ContextPage.cs | 67 +++++++++++++++
.../Banshee.Wikipedia/WikipediaView.cs | 90 ++++++++++++++++++++
src/Extensions/Banshee.Wikipedia/Makefile.am | 16 ++++
src/Extensions/Makefile.am | 3 +-
10 files changed, 295 insertions(+), 18 deletions(-)
diff --git a/Banshee.sln b/Banshee.sln
index 5a1223e..db2182f 100644
--- a/Banshee.sln
+++ b/Banshee.sln
@@ -66,6 +66,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.PlayQueue", "src\Ex
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.Lastfm", "src\Extensions\Banshee.Lastfm\Banshee.Lastfm.csproj", "{02FD8195-9796-4AF5-A9D2-D310721963F4}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.Wikipedia", "src\Extensions\Banshee.Wikipedia\Banshee.Wikipedia.csproj", "{BF5D1722-269B-452E-B577-AEBA0CB894BA}"
+EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.NowPlaying", "src\Extensions\Banshee.NowPlaying\Banshee.NowPlaying.csproj", "{16FB0D3A-53FA-4B8E-B02B-4AF66E87829A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.Bookmarks", "src\Extensions\Banshee.Bookmarks\Banshee.Bookmarks.csproj", "{0130499B-8A93-4CD9-8F3C-593B231609C7}"
@@ -125,6 +127,8 @@ Global
{01818BD5-9A0C-4C89-84FB-08D0E968778F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{02FD8195-9796-4AF5-A9D2-D310721963F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{02FD8195-9796-4AF5-A9D2-D310721963F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BF5D1722-269B-452E-B577-AEBA0CB894BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BF5D1722-269B-452E-B577-AEBA0CB894BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0DF72691-E61C-4E9C-A1F1-2F7F17958630}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0DF72691-E61C-4E9C-A1F1-2F7F17958630}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E1A7F20-E49B-4F9D-AEA0-2B1AD64326AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -245,6 +249,7 @@ Global
{8E8D7EAD-3B7A-4F7D-8146-75AFCB9DEE83} = {4DD1DE63-F20B-4FC3-8FDA-F0BDF4183722}
{74B2E4CC-2701-4C8B-A11D-6E4443F4B21B} = {4DD1DE63-F20B-4FC3-8FDA-F0BDF4183722}
{02FD8195-9796-4AF5-A9D2-D310721963F4} = {4DD1DE63-F20B-4FC3-8FDA-F0BDF4183722}
+ {BF5D1722-269B-452E-B577-AEBA0CB894BA} = {4DD1DE63-F20B-4FC3-8FDA-F0BDF4183722}
{16FB0D3A-53FA-4B8E-B02B-4AF66E87829A} = {4DD1DE63-F20B-4FC3-8FDA-F0BDF4183722}
{0130499B-8A93-4CD9-8F3C-593B231609C7} = {4DD1DE63-F20B-4FC3-8FDA-F0BDF4183722}
{F38B53BA-8F85-4DC6-9B94-029C1CF96F24} = {4DD1DE63-F20B-4FC3-8FDA-F0BDF4183722}
diff --git a/build/m4/banshee/mediaweb.m4 b/build/m4/banshee/mediaweb.m4
deleted file mode 100644
index 8785982..0000000
--- a/build/m4/banshee/mediaweb.m4
+++ /dev/null
@@ -1,14 +0,0 @@
-AC_DEFUN([BANSHEE_CHECK_MEDIAWEB],
-[
- AC_ARG_ENABLE(mediaweb, AC_HELP_STRING([--enable-mediaweb], [Enable MediaWeb support - unfinished, broken]), , enable_mediaweb="no")
-
- if test "x$enable_mediaweb" = "xyes"; then
- PKG_CHECK_MODULES(WEBKIT, webkit-sharp-1.0 >= 0.2,
- enable_webkit=yes, enable_webkit=no)
- AC_SUBST(WEBKIT_LIBS)
- AM_CONDITIONAL(HAVE_WEBKIT, true)
- else
- AM_CONDITIONAL(HAVE_WEBKIT, false)
- fi
-])
-
diff --git a/build/m4/banshee/webkit.m4 b/build/m4/banshee/webkit.m4
new file mode 100644
index 0000000..c274b12
--- /dev/null
+++ b/build/m4/banshee/webkit.m4
@@ -0,0 +1,14 @@
+AC_DEFUN([BANSHEE_CHECK_WEBKIT],
+[
+ AC_ARG_ENABLE(webkit, AC_HELP_STRING([--enable-webkit], [Enable experimental Wikipedia and MediaWeb extensions- unfinished, likely broken]), , enable_webkit="no")
+
+ if test "x$enable_webkit" = "xyes"; then
+ PKG_CHECK_MODULES(WEBKIT, webkit-sharp-1.0 >= 0.2,
+ enable_webkit=yes, enable_webkit=no)
+ AC_SUBST(WEBKIT_LIBS)
+ AM_CONDITIONAL(HAVE_WEBKIT, true)
+ else
+ AM_CONDITIONAL(HAVE_WEBKIT, false)
+ fi
+])
+
diff --git a/configure.ac b/configure.ac
index f587e68..e5df3c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,8 +60,8 @@ BANSHEE_CHECK_BOO
dnl Monodoc (optional through --disable-docs)
SHAMROCK_CHECK_MONODOC
-dnl MediaWeb (optional through --enable-mediaweb)
-BANSHEE_CHECK_MEDIAWEB
+dnl webkit (optional through --enable-webkit)
+BANSHEE_CHECK_WEBKIT
dnl Moonlight (optional through --enable-moonlight)
BANSHEE_CHECK_MOONLIGHT
@@ -251,6 +251,7 @@ src/Extensions/Banshee.SqlDebugConsole/Makefile
src/Extensions/Banshee.Sample/Makefile
src/Extensions/Banshee.Torrent/Makefile
src/Extensions/Banshee.RemoteAudio/Makefile
+src/Extensions/Banshee.Wikipedia/Makefile
])
cat <<EOF
@@ -296,7 +297,7 @@ EOF
# Unstable/in-development features; only show them if they were manually enabled
if test "x$enable_moonlight" = "xyes"; then br=yes; echo " Moonlight Effects: ${enable_moonlight}"; fi
if test "x$enable_remote_audio" = "xyes"; then br=yes; echo " Remote Audio: ${enable_remote_audio}"; fi
-if test "x$enable_mediaweb" = "xyes"; then br=yes; echo " MediaWeb: ${enable_mediaweb}"; fi
+if test "x$enable_webkit" = "xyes"; then br=yes; echo " WebKit: ${enable_webkit}"; fi
if test "x$enable_torrent" = "xyes"; then br=yes; echo " Torrent Podcasts: ${enable_torrent}"; fi
if test -d ${expanded_libdir}/${PACKAGE}; then
diff --git a/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia.addin.xml b/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia.addin.xml
new file mode 100644
index 0000000..1825ed9
--- /dev/null
+++ b/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia.addin.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Addin
+ id="Banshee.Wikipedia"
+ version="1.0"
+ compatVersion="1.0"
+ copyright="© 2009 Novell Inc. Licensed under the MIT X11 license."
+ name="Wikipedia"
+ category="User Interface"
+ description="View artist information from Wikipedia in the context pane"
+ author="Gabriel Burt"
+ url="http://banshee-project.org/"
+ defaultEnabled="true">
+
+ <Dependencies>
+ <Addin id="Banshee.Services" version="1.0"/>
+ <Addin id="Banshee.ThickClient" version="1.0"/>
+ </Dependencies>
+
+ <Extension path="/Banshee/ThickClient/ContextPage">
+ <ContextPage class="Banshee.Wikipedia.ContextPage"/>
+ </Extension>
+
+</Addin>
diff --git a/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia.csproj b/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia.csproj
new file mode 100644
index 0000000..1da56e8
--- /dev/null
+++ b/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia.csproj
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <ProjectGuid>{BF5D1722-269B-452E-B577-AEBA0CB894BA}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <UseParentDirectoryAsNamespace>true</UseParentDirectoryAsNamespace>
+ <AssemblyName>Banshee.Wikipedia</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>..\..\..\bin</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
+ <AssemblyKeyFile>.</AssemblyKeyFile>
+ <CustomCommands>
+ <CustomCommands>
+ <Command type="Build" command="make" workingdir="${SolutionDir}" />
+ <Command type="Execute" command="make run" workingdir="${SolutionDir}" />
+ </CustomCommands>
+ </CustomCommands>
+ </PropertyGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Core\Banshee.Core\Banshee.Core.csproj">
+ <Project>{2ADB831A-A050-47D0-B6B9-9C19D60233BB}</Project>
+ <Name>Banshee.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Core\Banshee.Services\Banshee.Services.csproj">
+ <Project>{B28354F0-BA87-44E8-989F-B864A3C7C09F}</Project>
+ <Name>Banshee.Services</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Libraries\Hyena\Hyena.csproj">
+ <Project>{95374549-9553-4C1E-9D89-667755F90E12}</Project>
+ <Name>Hyena</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Core\Banshee.ThickClient\Banshee.ThickClient.csproj">
+ <Project>{AC839523-7BDF-4AB6-8115-E17921B96EC6}</Project>
+ <Name>Banshee.ThickClient</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="webkit-sharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=eaa1d335d2e19745" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Banshee.Wikipedia.addin.xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Banshee.Wikipedia\ContextPage.cs" />
+ <Compile Include="Banshee.Wikipedia\WikipediaView.cs" />
+ </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 Sync="true" Name="RESOURCES" />
+ <OthersVar />
+ <GacRefVar />
+ <AsmRefVar />
+ <ProjectRefVar />
+ </MonoDevelop.Autotools.MakefileInfo>
+ </Properties>
+ </MonoDevelop>
+ </ProjectExtensions>
+</Project>
\ No newline at end of file
diff --git a/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia/ContextPage.cs b/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia/ContextPage.cs
new file mode 100644
index 0000000..eda92e2
--- /dev/null
+++ b/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia/ContextPage.cs
@@ -0,0 +1,67 @@
+//
+// ContextPage.cs
+//
+// Author:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2009 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.
+//
+
+using System;
+using Mono.Unix;
+using Gtk;
+
+using Hyena;
+
+using Banshee.ContextPane;
+
+namespace Banshee.Wikipedia
+{
+ public class ContextPage : BaseContextPage
+ {
+ public ContextPage ()
+ {
+ Id = "wikipedia";
+ Name = Catalog.GetString ("Wikipedia");
+ IconNames = new string[] { "wikipedia", "browser", "internet" };
+ }
+
+ public override void SetTrack (Banshee.Collection.TrackInfo track)
+ {
+ if (view.SetArtist (track.ArtistName) && State != ContextState.Loaded) {
+ State = ContextState.Loading;
+ }
+ }
+
+ private WikipediaView view;
+ public override Widget Widget {
+ get {
+ if (view == null) {
+ view = new WikipediaView ();
+ view.view.LoadFinished += delegate { State = ContextState.Loaded; };
+ view.ShowAll ();
+ }
+ return view;
+ }
+ }
+ }
+}
diff --git a/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia/WikipediaView.cs b/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia/WikipediaView.cs
new file mode 100644
index 0000000..9d5561d
--- /dev/null
+++ b/src/Extensions/Banshee.Wikipedia/Banshee.Wikipedia/WikipediaView.cs
@@ -0,0 +1,90 @@
+//
+// WikipediaView.cs
+//
+// Author:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2009 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.
+//
+
+using System;
+using Mono.Unix;
+using Gtk;
+
+using WebKit;
+
+using Hyena;
+
+using Banshee.ServiceStack;
+using Banshee.MediaEngine;
+using Banshee.Collection;
+
+using Banshee.Gui;
+
+namespace Banshee.Wikipedia
+{
+ public class WikipediaView : Gtk.ScrolledWindow
+ {
+ // Translators: this is used for looking up artist pages on Wikipedia; change to your wikipedia language if you want
+ private string url_format = Catalog.GetString ("http://en.wikipedia.org/wiki/{0}");
+
+ internal WebKit.WebView view;
+
+ public WikipediaView ()
+ {
+ view = new WebView ();
+
+ view.ConsoleMessage += delegate (object o, ConsoleMessageArgs args) {
+ Log.Debug (args.Message);
+ };
+
+ /*view.LoadProgressChanged += delegate (object o, LoadProgressChangedArgs args) {
+ Log.DebugFormat ("LoadProgress: {0}", args.Progress);
+ };*/
+
+ Add (view);
+ }
+
+ private string last_artist;
+ public bool SetArtist (string artist)
+ {
+ if (!String.IsNullOrEmpty (artist) && artist != last_artist) {
+ last_artist = artist;
+ OpenItem (artist);
+ return true;
+ }
+ return false;
+ }
+
+ private void OpenItem (string item)
+ {
+ OpenUrl (String.Format (url_format, System.Web.HttpUtility.UrlEncode (item.Replace (' ', '_'))));
+ }
+
+ private void OpenUrl (string uri)
+ {
+ Hyena.Log.DebugFormat ("Opening {0}", uri);
+ //Open (uri);
+ view.ExecuteScript (String.Format ("document.location = \"{0}\";", uri));
+ }
+ }
+}
diff --git a/src/Extensions/Banshee.Wikipedia/Makefile.am b/src/Extensions/Banshee.Wikipedia/Makefile.am
new file mode 100644
index 0000000..cf3eaed
--- /dev/null
+++ b/src/Extensions/Banshee.Wikipedia/Makefile.am
@@ -0,0 +1,16 @@
+ASSEMBLY = Banshee.Wikipedia
+TARGET = library
+LINK = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_WEBKIT)
+
+SOURCES = \
+ Banshee.Wikipedia/ContextPage.cs \
+ Banshee.Wikipedia/WikipediaView.cs
+
+RESOURCES = Banshee.Wikipedia.addin.xml
+
+if HAVE_WEBKIT
+include $(top_srcdir)/build/build.mk
+else
+EXTRA_DIST = $(SOURCES) $(RESOURCES)
+endif
+
diff --git a/src/Extensions/Makefile.am b/src/Extensions/Makefile.am
index 2c297a5..60b39a2 100644
--- a/src/Extensions/Makefile.am
+++ b/src/Extensions/Makefile.am
@@ -20,6 +20,7 @@ SUBDIRS = \
Banshee.Sample \
Banshee.SqlDebugConsole \
Banshee.Torrent \
- Banshee.RemoteAudio
+ Banshee.RemoteAudio \
+ Banshee.Wikipedia
MAINTAINERCLEANFILES = Makefile.in
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]