[banshee/better-now-playing: 2/3] [NowPlaying] Hardcode a couple of context buttons onto NP toolbar
- From: Alex Launi <alexlauni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee/better-now-playing: 2/3] [NowPlaying] Hardcode a couple of context buttons onto NP toolbar
- Date: Tue, 25 May 2010 00:22:03 +0000 (UTC)
commit 9733c0ec03ab68a76edfba661c17756337ed4d87
Author: Alex Launi <alex launi gmail com>
Date: Mon May 24 18:10:09 2010 -0400
[NowPlaying] Hardcode a couple of context buttons onto NP toolbar
Instead of making mockups in inkscape I've hardcoded a couple of
radio buttons onto the toolbar to show what the interface will
look like for changing context sources in the Now Playing source.
.../Banshee.NowPlaying/Banshee.NowPlaying.csproj | 7 ++
.../Banshee.NowPlaying/Actions.cs | 62 ++++++++++++++++++++
.../Banshee.NowPlaying/NowPlayingSource.cs | 23 +++++++-
src/Extensions/Banshee.NowPlaying/Makefile.am | 1 +
.../Resources/ActiveSourceUI.xml | 3 +
5 files changed, 95 insertions(+), 1 deletions(-)
---
diff --git a/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.csproj b/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.csproj
index 3912cc9..46b47e8 100644
--- a/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.csproj
+++ b/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying.csproj
@@ -59,19 +59,24 @@
</ProjectReference>
<Reference Include="atk-sharp">
<SpecificVersion>False</SpecificVersion>
+ <Package>gtk-sharp-2.0</Package>
</Reference>
<Reference Include="glib-sharp">
<SpecificVersion>False</SpecificVersion>
+ <Package>glib-sharp-2.0</Package>
</Reference>
<Reference Include="Mono.Addins">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\bin\Mono.Addins.dll</HintPath>
+ <Package>mono-addins</Package>
</Reference>
+ <Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="gtk-sharp">
<SpecificVersion>False</SpecificVersion>
+ <Package>gtk-sharp-2.0</Package>
</Reference>
<Reference Include="Mono.Posix">
<SpecificVersion>False</SpecificVersion>
@@ -79,6 +84,7 @@
</Reference>
<Reference Include="gdk-sharp">
<SpecificVersion>False</SpecificVersion>
+ <Package>gtk-sharp-2.0</Package>
</Reference>
<Reference Include="Mono.Cairo">
<SpecificVersion>False</SpecificVersion>
@@ -109,6 +115,7 @@
<Compile Include="Banshee.NowPlaying\NowPlayingContents.cs" />
<Compile Include="Banshee.NowPlaying\NowPlayingTrackInfoDisplay.cs" />
<Compile Include="Banshee.NowPlaying\IVideoDisplay.cs" />
+ <Compile Include="Banshee.NowPlaying\Actions.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
diff --git a/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/Actions.cs b/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/Actions.cs
new file mode 100644
index 0000000..dcc12d8
--- /dev/null
+++ b/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/Actions.cs
@@ -0,0 +1,62 @@
+//
+// Actions.cs
+//
+// Author:
+// Alex Launi <alex launi gmail com>
+//
+// Copyright (c) 2010 Alex Launi
+//
+// 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 System.Collections.Generic;
+using System.Linq;
+
+using Mono.Unix;
+using Gtk;
+
+using Hyena;
+using Hyena.Widgets;
+
+using Banshee.ServiceStack;
+using Banshee.Collection.Database;
+using Banshee.Gui;
+
+namespace Banshee.NowPlaying
+{
+ public class Actions : BansheeActionGroup
+ {
+ public Actions () : base ("NowPlaying")
+ {
+ RadioAction act = new RadioAction ("StandardNpOpen", null, "Now Playing", null, 0);
+ act.IconName = "applications-multimedia";
+ Add (act);
+
+ act = new RadioAction ("LastFmOpen", null, "Last.fm recommendations", null, 1);
+ act.IconName = "lastfm-audioscrobbler";
+ Add (act);
+
+ act = new RadioAction ("WikipediaOpen", null, "Wikipedia", null, 2);
+ act.IconName = "wikipedia";
+ Add (act);
+
+ Register ();
+ }
+ }
+}
diff --git a/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs b/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs
index c4d15bb..562b4b0 100644
--- a/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs
+++ b/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs
@@ -44,9 +44,21 @@ namespace Banshee.NowPlaying
{
private TrackInfo transitioned_track;
private NowPlayingInterface now_playing_interface;
-
+
+ private UIManager ui_manager;
private Widget substitute_audio_display;
+ private const string button_xml = @"
+ <ui>
+ <toolbar name=""HeaderToolbar"">
+ <placeholder name=""SourceActions"">
+ <placeholder name=""ContextActions"">
+ <toolitem action=""{0}"" />
+ </placeholder>
+ </placeholder>
+ </toolbar>
+ </ui>";
+
public NowPlayingSource () : base ("now-playing", Catalog.GetString ("Now Playing"), 10, "now-playing")
{
Properties.SetString ("Icon.Name", "applications-multimedia");
@@ -59,6 +71,13 @@ namespace Banshee.NowPlaying
ServiceManager.PlaybackController.TrackStarted += OnPlaybackControllerTrackStarted;
ServiceManager.PlayerEngine.ConnectEvent (OnTrackInfoUpdated, PlayerEvent.TrackInfoUpdated);
ServiceManager.PlayerEngine.ConnectEvent (OnCreateVideoWindow, PlayerEvent.PrepareVideoWindow);
+
+ Actions = new Actions ();
+
+ ui_manager = ((InterfaceActionService) ServiceManager.Get<InterfaceActionService> ()).UIManager;
+ ui_manager.AddUiFromString (string.Format (button_xml, "StandardNpOpen"));
+ ui_manager.AddUiFromString (string.Format (button_xml, "LastFmOpen"));
+ ui_manager.AddUiFromString (string.Format (button_xml, "WikipediaOpen"));
}
private void OnCreateVideoWindow (PlayerEventArgs args)
@@ -141,5 +160,7 @@ namespace Banshee.NowPlaying
now_playing_interface.RelinquishFullscreen ();
}
}
+
+ public Actions Actions { get; private set; }
}
}
diff --git a/src/Extensions/Banshee.NowPlaying/Makefile.am b/src/Extensions/Banshee.NowPlaying/Makefile.am
index 8cb50c9..dca604b 100644
--- a/src/Extensions/Banshee.NowPlaying/Makefile.am
+++ b/src/Extensions/Banshee.NowPlaying/Makefile.am
@@ -4,6 +4,7 @@ LINK = $(REF_EXTENSION_NOWPLAYING)
INSTALL_DIR = $(EXTENSIONS_INSTALL_DIR)
SOURCES = \
+ Banshee.NowPlaying/Actions.cs \
Banshee.NowPlaying/FullscreenAdapter.cs \
Banshee.NowPlaying/FullscreenControls.cs \
Banshee.NowPlaying/FullscreenWindow.cs \
diff --git a/src/Extensions/Banshee.NowPlaying/Resources/ActiveSourceUI.xml b/src/Extensions/Banshee.NowPlaying/Resources/ActiveSourceUI.xml
index 6b938de..19d6404 100644
--- a/src/Extensions/Banshee.NowPlaying/Resources/ActiveSourceUI.xml
+++ b/src/Extensions/Banshee.NowPlaying/Resources/ActiveSourceUI.xml
@@ -1,6 +1,9 @@
<ui>
<toolbar name="HeaderToolbar">
<placeholder name="SourceActions">
+ <placeholder name="ContextActions">
+ </placeholder>
+ <separator />
<toolitem action="FullScreenAction" />
</placeholder>
</toolbar>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]