banshee r4445 - in branches/banshee/gburt: . build src/Clients/Muinshee src/Clients/Muinshee/Muinshee src/Clients/Nereid/Nereid src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs src/Core/Banshee.ThickClient/Banshee.Gui.Widgets src/Libraries/Hyena.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView src/Libraries/Hyena.Gui/Hyena.Widgets
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4445 - in branches/banshee/gburt: . build src/Clients/Muinshee src/Clients/Muinshee/Muinshee src/Clients/Nereid/Nereid src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Sources src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Collection.Gui src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs src/Core/Banshee.ThickClient/Banshee.Gui.Widgets src/Libraries/Hyena.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView src/Libraries/Hyena.Gui/Hyena.Widgets
- Date: Thu, 28 Aug 2008 22:43:32 +0000 (UTC)
Author: gburt
Date: Thu Aug 28 22:43:32 2008
New Revision: 4445
URL: http://svn.gnome.org/viewvc/banshee?rev=4445&view=rev
Log:
2008-08-28 Gabriel Burt <gabriel burt gmail com>
* src/Clients/Nereid/Nereid/PlayerInterface.cs:
* src/Clients/Muinshee/Muinshee/PlayerInterface.cs:
* src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs: Move a lot
of method up to BaseClientWindow from Nereid's PlayerInterface so can be
used by Muinshee too.
* src/Clients/Muinshee/Makefile.am:
* src/Clients/Muinshee/Muinshee.mdp: Add and remove files.
* src/Clients/Nereid/Nereid/Client.cs:
* src/Clients/Muinshee/Muinshee/Client.cs:
* src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs: Factor our a
lot of common functionality into the parent class.
* src/Clients/Muinshee/Muinshee/ViewContainer.cs: Deleted
* src/Clients/Muinshee/Muinshee/MuinsheeActions.cs: Set disc icon on Play
Album action, and launch the Dialogs when the actions are activated.
* src/Clients/Muinshee/Muinshee/MuinsheeTrackInfoDisplay.cs:
* src/Clients/Muinshee/Muinshee/AlbumDialog.cs:
* src/Clients/Muinshee/Muinshee/SongDialog.cs:
* src/Clients/Muinshee/Muinshee/BaseDialog.cs: Split dialog classes out,
and implement query, queue, and play functionality.
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellTrack.cs:
Implement ITextCell.
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs:
Factored out from TrackListView.
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs:
Inherit from BaseTrackListview.
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TerseTrackListView.cs:
Inherit from BaseTrackListview, getting us lots of goodies - DnD, context
menu, o-to-play, and double-click to play.
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackFilterListView.cs:
Hide the header, and move RowActivated handler to virtual method.
* src/Core/Banshee.ThickClient/Makefile.am:
* src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp: Add new files.
* src/Core/Banshee.ThickClient/Banshee.Gui/PersistentWindowController.cs:
New class that can save and restore the size and/or position of a
Gtk.Window.
* src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs:
Lazily load the missing pixbufs.
* src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/BansheeDialog.cs: Add
another convenience override.
* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumListModel.cs:
Whitespace.
* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs:
Add nifty IndexOfFirst (TrackInfo) class that uses the super-powers of
MetadataHash.
* src/Core/Banshee.Services/Banshee.Sources/Source.cs: Make the
CurrentStatusFormat public.
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ITextCell.cs: New inteface that
has a FontWeight property.
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs: Implement
ITextCell.
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs:
Instead of checking for ColumnCellText objects and setting their weight,
do the same for all ITextCell instances.
* src/Libraries/Hyena.Gui/Hyena.Gui.mdp:
* src/Libraries/Hyena.Gui/Makefile.am:
* src/Libraries/Hyena.Gui/Hyena.Widgets/ImageButton.cs: New convenience
class for a Button that has an image and a label in it.
* build/build.environment.mk: Add vars to enable linking against the
PlayQueue.
* Makefile.am: Temporarily start Banshee with the Muine client. This
needs to be reworked so that the previously used client is automatically
used.
Added:
branches/banshee/gburt/src/Clients/Muinshee/Muinshee/AlbumDialog.cs
branches/banshee/gburt/src/Clients/Muinshee/Muinshee/BaseDialog.cs
branches/banshee/gburt/src/Clients/Muinshee/Muinshee/MuinsheeTrackInfoDisplay.cs
branches/banshee/gburt/src/Clients/Muinshee/Muinshee/SongDialog.cs
branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs
branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui/PersistentWindowController.cs
branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ITextCell.cs
branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Widgets/ImageButton.cs
Removed:
branches/banshee/gburt/src/Clients/Muinshee/Muinshee/ViewContainer.cs
Modified:
branches/banshee/gburt/ChangeLog
branches/banshee/gburt/Makefile.am
branches/banshee/gburt/build/build.environment.mk
branches/banshee/gburt/src/Clients/Muinshee/Makefile.am
branches/banshee/gburt/src/Clients/Muinshee/Muinshee.mdp
branches/banshee/gburt/src/Clients/Muinshee/Muinshee/Client.cs
branches/banshee/gburt/src/Clients/Muinshee/Muinshee/MuinsheeActions.cs
branches/banshee/gburt/src/Clients/Muinshee/Muinshee/PlayerInterface.cs
branches/banshee/gburt/src/Clients/Nereid/Nereid/Client.cs
branches/banshee/gburt/src/Clients/Nereid/Nereid/PlayerInterface.cs
branches/banshee/gburt/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumListModel.cs
branches/banshee/gburt/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs
branches/banshee/gburt/src/Core/Banshee.Services/Banshee.Sources/Source.cs
branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellTrack.cs
branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TerseTrackListView.cs
branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackFilterListView.cs
branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs
branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/BansheeDialog.cs
branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs
branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp
branches/banshee/gburt/src/Core/Banshee.ThickClient/Makefile.am
branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Gui.mdp
branches/banshee/gburt/src/Libraries/Hyena.Gui/Makefile.am
Modified: branches/banshee/gburt/Makefile.am
==============================================================================
--- branches/banshee/gburt/Makefile.am (original)
+++ branches/banshee/gburt/Makefile.am Thu Aug 28 22:43:32 2008
@@ -62,7 +62,7 @@
run:
@pushd bin; \
- $(MONO) --debug $(BANSHEE_DEV_MONO_OPTIONS) Nereid.exe --debug --uninstalled $(BANSHEE_DEV_OPTIONS); \
+ $(MONO) --debug $(BANSHEE_DEV_MONO_OPTIONS) Muinshee.exe --debug --uninstalled $(BANSHEE_DEV_OPTIONS); \
popd;
gdb:
Modified: branches/banshee/gburt/build/build.environment.mk
==============================================================================
--- branches/banshee/gburt/build/build.environment.mk (original)
+++ branches/banshee/gburt/build/build.environment.mk Thu Aug 28 22:43:32 2008
@@ -120,6 +120,9 @@
REF_EXTENSION_MULTIMEDIAKEYS = $(LINK_BANSHEE_SERVICES_DEPS)
REF_EXTENSION_NOTIFICATIONAREA = $(LINK_BANSHEE_THICKCLIENT_DEPS)
REF_EXTENSION_PLAYQUEUE = $(LINK_BANSHEE_THICKCLIENT_DEPS)
+LINK_EXTENSION_PLAYQUEUE = -r:$(DIR_BIN)/Banshee.PlayQueue.dll
+LINK_EXTENSION_PLAYQUEUE_DEPS = $(REF_EXTENSION_PLAYQUEUE) \
+ $(LINK_EXTENSION_PLAYQUEUE)
REF_EXTENSION_LASTFM = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_MONO_MEDIA) $(LINK_LASTFM) $(LINK_LASTFM_GUI)
REF_EXTENSION_NOWPLAYING = $(LINK_BANSHEE_THICKCLIENT_DEPS)
LINK_EXTENSION_NOWPLAYING = -r:$(DIR_BIN)/Banshee.NowPlaying.dll
Modified: branches/banshee/gburt/src/Clients/Muinshee/Makefile.am
==============================================================================
--- branches/banshee/gburt/src/Clients/Muinshee/Makefile.am (original)
+++ branches/banshee/gburt/src/Clients/Muinshee/Makefile.am Thu Aug 28 22:43:32 2008
@@ -1,11 +1,17 @@
ASSEMBLY = Muinshee
TARGET = exe
-LINK = $(REF_NEREID)
+LINK = $(REF_NEREID) $(LINK_EXTENSION_PLAYQUEUE_DEPS)
SOURCES = \
+ Muinshee/AlbumDialog.cs \
+ Muinshee/BaseDialog.cs \
Muinshee/Client.cs \
Muinshee/MuinsheeActions.cs \
+ Muinshee/MuinsheeTrackInfoDisplay.cs \
Muinshee/PlayerInterface.cs \
- Muinshee/ViewContainer.cs
+ Muinshee/SongDialog.cs
+
+RESOURCES = \
+ Resources/GlobalUI.xml
include $(top_srcdir)/build/build.mk
Modified: branches/banshee/gburt/src/Clients/Muinshee/Muinshee.mdp
==============================================================================
--- branches/banshee/gburt/src/Clients/Muinshee/Muinshee.mdp (original)
+++ branches/banshee/gburt/src/Clients/Muinshee/Muinshee.mdp Thu Aug 28 22:43:32 2008
@@ -9,9 +9,12 @@
</Configurations>
<Contents>
<File name="Muinshee/PlayerInterface.cs" subtype="Code" buildaction="Compile" />
- <File name="Muinshee/ViewContainer.cs" subtype="Code" buildaction="Compile" />
<File name="Muinshee/Client.cs" subtype="Code" buildaction="Compile" />
<File name="Muinshee/MuinsheeActions.cs" subtype="Code" buildaction="Compile" />
+ <File name="Muinshee/BaseDialog.cs" subtype="Code" buildaction="Compile" />
+ <File name="Muinshee/MuinsheeTrackInfoDisplay.cs" subtype="Code" buildaction="Compile" />
+ <File name="Muinshee/SongDialog.cs" subtype="Code" buildaction="Compile" />
+ <File name="Muinshee/AlbumDialog.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
@@ -23,6 +26,7 @@
<ProjectReference type="Project" localcopy="False" refto="Hyena" />
<ProjectReference type="Project" localcopy="False" refto="Hyena.Gui" />
<ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <ProjectReference type="Project" localcopy="True" refto="Banshee.PlayQueue" />
</References>
<GtkDesignInfo gtkVersion="2.12.1" />
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am" ExecuteTargetName="run">
Added: branches/banshee/gburt/src/Clients/Muinshee/Muinshee/AlbumDialog.cs
==============================================================================
--- (empty file)
+++ branches/banshee/gburt/src/Clients/Muinshee/Muinshee/AlbumDialog.cs Thu Aug 28 22:43:32 2008
@@ -0,0 +1,104 @@
+//
+// MuinsheeActions.cs
+//
+// Authors:
+// Brad Taylor <brad getcoded net>
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 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 Hyena.Data;
+using Hyena.Widgets;
+
+using Banshee.Gui;
+using Banshee.Widgets;
+using Banshee.Gui.Dialogs;
+using Banshee.Playlist;
+using Banshee.Collection;
+using Banshee.Collection.Gui;
+using Banshee.ServiceStack;
+using Banshee.Configuration;
+using Banshee.Collection.Database;
+using Banshee.PlaybackController;
+using Banshee.MediaEngine;
+
+namespace Muinshee
+{
+ internal class MuinsheeAlbumView : AlbumListView
+ {
+ public MuinsheeAlbumView ()
+ {
+ HeaderVisible = false;
+ ForceDragSourceSet = false;
+ }
+
+ protected override void OnRowActivated (object o, EventArgs args)
+ {
+ }
+ }
+
+ public class AlbumDialog : BaseDialog
+ {
+ private static DatabaseAlbumListModel album_model;
+
+ static AlbumDialog () {
+ // TODO set the Album filter as the one/only current filter
+ foreach (IFilterListModel filter in Music.CurrentFilters) {
+ if (filter is DatabaseAlbumListModel) {
+ album_model = filter as DatabaseAlbumListModel;
+ }
+ }
+ }
+
+ public AlbumDialog (PlaylistSource queue) : base (queue, Catalog.GetString ("Play Album"), "album")
+ {
+ }
+
+ protected override Widget GetItemWidget ()
+ {
+ AlbumListView album_view = new AlbumListView ();
+ album_view.SetModel (album_model);
+ return album_view;
+ }
+
+ protected override void Queue ()
+ {
+ QueueSource.AddAllTracks (Music);
+ }
+
+ protected override TrackInfo FirstTrack {
+ get { return Music.TrackModel[0]; }
+ }
+
+ public override void Destroy ()
+ {
+ album_model.Selection.Clear ();
+ base.Destroy ();
+ }
+
+ }
+}
Added: branches/banshee/gburt/src/Clients/Muinshee/Muinshee/BaseDialog.cs
==============================================================================
--- (empty file)
+++ branches/banshee/gburt/src/Clients/Muinshee/Muinshee/BaseDialog.cs Thu Aug 28 22:43:32 2008
@@ -0,0 +1,141 @@
+//
+// BaseDialog.cs
+//
+// Authors:
+// Brad Taylor <brad getcoded net>
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 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 Hyena.Data;
+using Hyena.Widgets;
+
+using Banshee.Gui;
+using Banshee.Widgets;
+using Banshee.Gui.Dialogs;
+using Banshee.Playlist;
+using Banshee.Collection;
+using Banshee.Collection.Gui;
+using Banshee.ServiceStack;
+using Banshee.Configuration;
+using Banshee.Collection.Database;
+using Banshee.PlaybackController;
+using Banshee.MediaEngine;
+
+namespace Muinshee
+{
+ public abstract class BaseDialog : BansheeDialog
+ {
+ private SearchEntry search_entry;
+ private PlaylistSource queue;
+ private PersistentWindowController window_controller;
+
+ public BaseDialog (PlaylistSource queue, string title, string addType) : base (title)
+ {
+ this.queue = queue;
+ VBox.Spacing = 6;
+
+ HBox filter_box = new HBox ();
+ filter_box.Spacing = 6;
+
+ Label search_label = new Label ("_Search:");
+ filter_box.PackStart (search_label, false, false, 0);
+
+ search_entry = new SearchEntry ();
+ search_entry.Show ();
+ search_entry.Changed += OnFilterChanged;
+ search_entry.Ready = true;
+ OnFilterChanged (null, null);
+ filter_box.PackStart (search_entry, true, true, 0);
+
+ VBox.PackStart (filter_box, false, false, 0);
+
+ Hyena.Widgets.ScrolledWindow sw = new Hyena.Widgets.ScrolledWindow ();
+ sw.Add (GetItemWidget ());
+ VBox.PackStart (sw, true, true, 0);
+
+ AddDefaultCloseButton ();
+
+ Button queue_button = new ImageButton (Catalog.GetString ("Queue"), "stock_timer");
+ AddActionWidget (queue_button, Gtk.ResponseType.Apply);
+
+ Button play_button = new ImageButton (Catalog.GetString ("Play"), "media-playback-start");
+ AddButton (play_button, Gtk.ResponseType.Ok, true);
+
+ window_controller = new PersistentWindowController (this, String.Format ("muinshee.{0}", addType), 500, 475, WindowPersistOptions.Size);
+ window_controller.Restore ();
+ ShowAll ();
+ }
+
+ public void TryRun ()
+ {
+ try {
+ int response = Run ();
+ if (response == (int)ResponseType.Apply) {
+ Queue ();
+ } else if (response == (int)ResponseType.Ok) {
+ Play ();
+ }
+ } finally {
+ Destroy ();
+ }
+ }
+
+ private void OnFilterChanged (object o, EventArgs args)
+ {
+ Music.FilterQuery = search_entry.Query;
+ }
+
+ private void Play ()
+ {
+ TrackInfo to_play = FirstTrack;
+ Hyena.Log.InformationFormat ("first to play is {0}", to_play);
+ Queue ();
+ if (to_play != null) {
+ int i = QueueSource.DatabaseTrackModel.IndexOfFirst (to_play);
+ Hyena.Log.InformationFormat ("but in queue is index {0}", i);
+ if (i != -1) {
+ ServiceManager.PlayerEngine.OpenPlay (QueueSource.TrackModel[i]);
+ }
+ }
+ }
+
+ protected abstract void Queue ();
+ protected abstract Widget GetItemWidget ();
+ protected abstract TrackInfo FirstTrack { get; }
+
+ protected PlaylistSource QueueSource { get { return queue; } }
+
+ protected static Banshee.Library.MusicLibrarySource Music { get { return ServiceManager.SourceManager.MusicLibrary; } }
+
+ public override void Destroy ()
+ {
+ OnFilterChanged (null, null);
+ base.Destroy ();
+ }
+ }
+}
Modified: branches/banshee/gburt/src/Clients/Muinshee/Muinshee/Client.cs
==============================================================================
--- branches/banshee/gburt/src/Clients/Muinshee/Muinshee/Client.cs (original)
+++ branches/banshee/gburt/src/Clients/Muinshee/Muinshee/Client.cs Thu Aug 28 22:43:32 2008
@@ -43,165 +43,15 @@
{
public class Client : Banshee.Gui.GtkBaseClient
{
- private static string user_gtkrc = Path.Combine (Paths.ApplicationData, "gtkrc");
public static void Main (string [] args)
{
- if (CheckHelpVersion ()) {
- return;
- }
-
- // Check for single instance
- DBusConnection.Connect ();
- if (DBusConnection.InstanceAlreadyRunning) {
- // Try running our friend Halie, the DBus command line client
- AppDomain.CurrentDomain.ExecuteAssembly (Path.Combine (Path.GetDirectoryName (
- Assembly.GetEntryAssembly ().Location), "Halie.exe"));
- Gdk.Global.InitCheck (ref args);
- Gdk.Global.NotifyStartupComplete ();
- return;
- }
-
- Hyena.Log.InformationFormat ("Running Banshee {0}", Application.Version);
-
- // This could go into GtkBaseClient, but it's probably something we
- // should really only support at each client level
- if (File.Exists (user_gtkrc) && !ApplicationContext.CommandLine.Contains ("no-gtkrc")) {
- Gtk.Rc.AddDefaultFile (user_gtkrc);
- }
-
- // Ugly hack to avoid stupid themes that set this to 0, causing a huge
- // bug when constructing the "add to playlist" popup menu (BGO #524706)
- Gtk.Rc.ParseString ("gtk-menu-popup-delay = 225");
-
- // Boot the client
- Banshee.Gui.GtkBaseClient.Entry<Client> ();
+ Startup<Muinshee.Client> (args);
}
protected override void OnRegisterServices ()
{
// Register the main interface
- ServiceManager.RegisterService<PlayerInterface> ();
- }
-
- private static bool CheckHelpVersion ()
- {
- if (ApplicationContext.CommandLine.ContainsStart ("help")) {
- ShowHelp ();
- return true;
- } else if (ApplicationContext.CommandLine.Contains ("version")) {
- ShowVersion ();
- return true;
- }
-
- return false;
- }
-
- private static void ShowHelp ()
- {
- Console.WriteLine ("Usage: {0} [options...] [files|URIs...]", "banshee-1");
- Console.WriteLine ();
-
- Layout commands = new Layout (
- new LayoutGroup ("help", Catalog.GetString ("Help Options"),
- new LayoutOption ("help", Catalog.GetString ("Show this help")),
- new LayoutOption ("help-playback", Catalog.GetString ("Show options for controlling playback")),
- new LayoutOption ("help-query-track", Catalog.GetString ("Show options for querying the playing track")),
- new LayoutOption ("help-query-player", Catalog.GetString ("Show options for querying the playing engine")),
- new LayoutOption ("help-ui", Catalog.GetString ("Show options for the user interface")),
- new LayoutOption ("help-debug", Catalog.GetString ("Show options for developers and debugging")),
- new LayoutOption ("help-all", Catalog.GetString ("Show all option groups")),
- new LayoutOption ("version", Catalog.GetString ("Show version information"))
- ),
-
- new LayoutGroup ("playback", Catalog.GetString ("Playback Control Options"),
- new LayoutOption ("next", Catalog.GetString ("Play the next track, optionally restarting if the 'restart' value is set")),
- new LayoutOption ("previous", Catalog.GetString ("Play the previous track, optionally restarting if the 'restart value is set")),
- new LayoutOption ("play-enqueued", Catalog.GetString ("Automatically start playing any tracks enqueued on the command line")),
- new LayoutOption ("play", Catalog.GetString ("Start playback")),
- new LayoutOption ("pause", Catalog.GetString ("Pause playback")),
- new LayoutOption ("stop", Catalog.GetString ("Completely stop playback")),
- new LayoutOption ("stop-when-finished", Catalog.GetString (
- "Enable or disable playback stopping after the currently playing track (value should be either 'true' or 'false')")),
- new LayoutOption ("set-volume=LEVEL", Catalog.GetString ("Set the playback volume (0-100)")),
- new LayoutOption ("set-position=POS", Catalog.GetString ("Seek to a specific point (seconds, float)"))
- ),
-
- new LayoutGroup ("query-player", Catalog.GetString ("Player Engine Query Options"),
- new LayoutOption ("query-current-state", Catalog.GetString ("Current player state")),
- new LayoutOption ("query-last-state", Catalog.GetString ("Last player state")),
- new LayoutOption ("query-can-pause", Catalog.GetString ("Query whether the player can be paused")),
- new LayoutOption ("query-can-seek", Catalog.GetString ("Query whether the player can seek")),
- new LayoutOption ("query-volume", Catalog.GetString ("Player volume")),
- new LayoutOption ("query-position", Catalog.GetString ("Player position in currently playing track"))
- ),
-
- new LayoutGroup ("query-track", Catalog.GetString ("Playing Track Metadata Query Options"),
- new LayoutOption ("query-uri", Catalog.GetString ("URI")),
- new LayoutOption ("query-artist", Catalog.GetString ("Artist Name")),
- new LayoutOption ("query-album", Catalog.GetString ("Album Title")),
- new LayoutOption ("query-title", Catalog.GetString ("Track Title")),
- new LayoutOption ("query-duration", Catalog.GetString ("Duration")),
- new LayoutOption ("query-track-number", Catalog.GetString ("Track Number")),
- new LayoutOption ("query-track-count", Catalog.GetString ("Track Count")),
- new LayoutOption ("query-disc", Catalog.GetString ("Disc Number")),
- new LayoutOption ("query-year", Catalog.GetString ("Year")),
- new LayoutOption ("query-rating", Catalog.GetString ("Rating"))
- ),
-
- new LayoutGroup ("ui", Catalog.GetString ("User Interface Options"),
- new LayoutOption ("show|--present", Catalog.GetString ("Present the user interface on the active workspace")),
- new LayoutOption ("hide", Catalog.GetString ("Hide the user interface")),
- new LayoutOption ("no-present", Catalog.GetString ("Do not present the user interface, regardless of any other options"))
- ),
-
- new LayoutGroup ("debugging", Catalog.GetString ("Debugging and Development Options"),
- new LayoutOption ("debug", Catalog.GetString ("Enable general debugging features")),
- new LayoutOption ("debug-sql", Catalog.GetString ("Enable debugging output of SQL queries")),
- new LayoutOption ("debug-addins", Catalog.GetString ("Enable debugging output of Mono.Addins")),
- new LayoutOption ("db=FILE", Catalog.GetString ("Specify an alternate database to use")),
- new LayoutOption ("uninstalled", Catalog.GetString ("Optimize instance for running uninstalled; " +
- "most notably, this will create an alternate Mono.Addins database in the working directory")),
- new LayoutOption ("disable-dbus", Catalog.GetString ("Disable DBus support completely")),
- new LayoutOption ("no-gtkrc", String.Format (Catalog.GetString (
- "Skip loading a custom gtkrc file ({0}) if it exists"),
- user_gtkrc.Replace (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "~")))
- )
- );
-
- if (ApplicationContext.CommandLine.Contains ("help-all")) {
- Console.WriteLine (commands);
- return;
- }
-
- List<string> errors = null;
-
- foreach (KeyValuePair<string, string> argument in ApplicationContext.CommandLine.Arguments) {
- switch (argument.Key) {
- case "help": Console.WriteLine (commands.ToString ("help")); break;
- case "help-debug": Console.WriteLine (commands.ToString ("debugging")); break;
- case "help-query-track": Console.WriteLine (commands.ToString ("query-track")); break;
- case "help-query-player": Console.WriteLine (commands.ToString ("query-player")); break;
- case "help-ui": Console.WriteLine (commands.ToString ("ui")); break;
- case "help-playback": Console.WriteLine (commands.ToString ("playback")); break;
- default:
- if (argument.Key.StartsWith ("help")) {
- (errors ?? errors = new List<string> ()).Add (argument.Key);
- }
- break;
- }
- }
-
- if (errors != null) {
- Console.WriteLine (commands.LayoutLine (String.Format (Catalog.GetString (
- "The following help arguments are invalid: {0}"),
- Hyena.Collections.CollectionExtensions.Join (errors, "--", null, ", "))));
- }
- }
-
- private static void ShowVersion ()
- {
- Console.WriteLine ("Banshee {0} ({1}) http://banshee-project.org", Application.DisplayVersion, Application.Version);
- Console.WriteLine ("Copyright 2005-{0} Novell, Inc. and Contributors.", DateTime.Now.Year);
+ ServiceManager.RegisterService<Muinshee.PlayerInterface> ();
}
public override string ClientId {
Modified: branches/banshee/gburt/src/Clients/Muinshee/Muinshee/MuinsheeActions.cs
==============================================================================
--- branches/banshee/gburt/src/Clients/Muinshee/Muinshee/MuinsheeActions.cs (original)
+++ branches/banshee/gburt/src/Clients/Muinshee/Muinshee/MuinsheeActions.cs Thu Aug 28 22:43:32 2008
@@ -35,31 +35,41 @@
namespace Muinshee
{
public class MuinsheeActions : BansheeActionGroup
- {
- public MuinsheeActions () : base ("muinshee")
+ {
+ private Banshee.Playlist.PlaylistSource queue;
+
+ public MuinsheeActions (Banshee.Playlist.PlaylistSource queue) : base ("muinshee")
{
+ this.queue = queue;
AddImportant (
new ActionEntry (
"PlaySongAction", Stock.Add,
- Catalog.GetString ("_Play Song"),
- null, Catalog.GetString ("Add a song to the playlist"), OnPlaySong
+ Catalog.GetString ("Play _Song"), "S",
+ Catalog.GetString ("Add a song to the playlist"), OnPlaySong
),
new ActionEntry (
- "PlayAlbumAction", Stock.Add,
- Catalog.GetString ("_Play Album"),
- null, Catalog.GetString ("Add an album to the playlist"), OnPlayAlbum
+ "PlayAlbumAction", null,
+ Catalog.GetString ("Play _Album"), "A",
+ Catalog.GetString ("Add an album to the playlist"), OnPlayAlbum
)
);
+
+ this["PlayAlbumAction"].IconName = "media-optical";
+
+ // TODO disable certain actions
+ // Actions.TrackActions.UpdateActions (false, false, "SearchMenu");
AddUiFromFile ("GlobalUI.xml");
}
private void OnPlaySong (object sender, EventArgs args)
{
+ new SongDialog (queue).TryRun ();
}
private void OnPlayAlbum (object sender, EventArgs args)
{
+ new AlbumDialog (queue).TryRun ();
}
}
}
Added: branches/banshee/gburt/src/Clients/Muinshee/Muinshee/MuinsheeTrackInfoDisplay.cs
==============================================================================
--- (empty file)
+++ branches/banshee/gburt/src/Clients/Muinshee/Muinshee/MuinsheeTrackInfoDisplay.cs Thu Aug 28 22:43:32 2008
@@ -0,0 +1,55 @@
+//
+// MuinsheeTrackDisplay.cs
+//
+// Authors:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 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 Banshee.Collection.Gui;
+
+namespace Muinshee
+{
+ public class MuinsheeTrackInfoDisplay : Banshee.Gui.Widgets.ClassicTrackInfoDisplay
+ {
+ private Gdk.Pixbuf idle_album;
+
+ public MuinsheeTrackInfoDisplay () : base ()
+ {
+ }
+
+ protected override bool CanRenderIdle {
+ get { return true; }
+ }
+
+ protected override void RenderIdle (Cairo.Context cr)
+ {
+ idle_album = idle_album ?? Banshee.Gui.IconThemeUtils.LoadIcon (ArtworkSizeRequest, "media-optical");
+ ArtworkRenderer.RenderThumbnail (cr, idle_album, false, Allocation.X, Allocation.Y,
+ ArtworkSizeRequest, ArtworkSizeRequest,
+ false, 0, true, BackgroundColor);
+ }
+ }
+}
Modified: branches/banshee/gburt/src/Clients/Muinshee/Muinshee/PlayerInterface.cs
==============================================================================
--- branches/banshee/gburt/src/Clients/Muinshee/Muinshee/PlayerInterface.cs (original)
+++ branches/banshee/gburt/src/Clients/Muinshee/Muinshee/PlayerInterface.cs Thu Aug 28 22:43:32 2008
@@ -52,65 +52,74 @@
using Banshee.Collection.Gui;
using Banshee.Sources.Gui;
+using Banshee.PlayQueue;
+
namespace Muinshee
{
- public class PlayerInterface : BaseClientWindow, IClientWindow, IDBusObjectName, IService, IDisposable, IHasSourceView
+ public class PlayerInterface : BaseClientWindow, IClientWindow, IDBusObjectName, IService, IDisposable
{
// Major Layout Components
- private VBox primary_vbox;
+ private VBox content_vbox;
+ private VBox main_vbox;
private Toolbar header_toolbar;
- private Toolbar footer_toolbar;
- private HPaned views_pane;
- private ViewContainer view_container;
private MuinsheeActions actions;
// Major Interaction Components
- private SourceView source_view;
- private CompositeTrackSourceContents composite_view;
- private ObjectListSourceContents object_view;
- private Label status_label;
+ private TerseTrackListView track_view;
+ private Label list_label;
- public PlayerInterface () : base (Catalog.GetString ("Banshee Media Player"))
+ public PlayerInterface () : base (Catalog.GetString ("Banshee Media Player"), "muinshee", -1, 450)
{
}
-
+
protected override void Initialize ()
{
- actions = new MuinsheeActions ();
+ FindPlayQueue ();
+ }
+
+ private void FindPlayQueue ()
+ {
+ Banshee.ServiceStack.ServiceManager.SourceManager.SourceAdded += delegate (SourceAddedArgs args) {
+ if (args.Source is Banshee.PlayQueue.PlayQueueSource) {
+ InitPlayQueue (args.Source as Banshee.PlayQueue.PlayQueueSource);
+ }
+ };
+
+ foreach (Source src in ServiceManager.SourceManager.Sources) {
+ if (src is Banshee.PlayQueue.PlayQueueSource) {
+ InitPlayQueue (src as Banshee.PlayQueue.PlayQueueSource);
+ }
+ }
+ }
+
+ private void InitPlayQueue (PlayQueueSource play_queue)
+ {
+ actions = new MuinsheeActions (play_queue);
+ actions.Actions.AddActionGroup (actions);
+ ServiceManager.SourceManager.SetActiveSource (play_queue);
+ play_queue.TrackModel.Reloaded += HandleTrackModelReloaded;
BuildPrimaryLayout ();
ConnectEvents ();
- ActionService.SourceActions.SourceView = this;
-
- composite_view.TrackView.HasFocus = true;
-
+ // FIXME
+ //AddAccelGroup (ActionService.UIManager.AccelGroup);
+
+ track_view.SetModel (play_queue.TrackModel);
+
Show ();
}
-
- protected override void UpdateTitle ()
- {
- TrackInfo track = ServiceManager.PlayerEngine.CurrentTrack;
- if (track != null) {
- // Translators: this is the window title when a track is playing
- // {0} is the track title, {1} is the artist name
- Title = String.Format (Catalog.GetString ("{0} by {1}"),
- track.DisplayTrackTitle, track.DisplayArtistName);
- } else {
- Title = Catalog.GetString ("Banshee Media Player");
- }
-
- OnTitleChanged ();
- }
-
+
#region System Overrides
public override void Dispose ()
{
lock (this) {
Hide ();
- actions.Dispose ();
+ if (actions != null) {
+ actions.Dispose ();
+ }
base.Dispose ();
Gtk.Application.Quit ();
}
@@ -122,18 +131,26 @@
private void BuildPrimaryLayout ()
{
- primary_vbox = new VBox ();
+ main_vbox = new VBox ();
Widget menu = new MainMenu ();
menu.Show ();
- primary_vbox.PackStart (menu, false, false, 0);
+ main_vbox.PackStart (menu, false, false, 0);
BuildHeader ();
+
+ content_vbox = new VBox ();
+ content_vbox.Spacing = 6;
+ Alignment content_align = new Alignment (0f, 0f, 1f, 1f);
+ content_align.LeftPadding = content_align.RightPadding = 6;
+ content_align.Child = content_vbox;
+ main_vbox.PackStart (content_align, true, true, 0);
+
+ BuildTrackInfo ();
BuildViews ();
- BuildFooter ();
- primary_vbox.Show ();
- Add (primary_vbox);
+ main_vbox.ShowAll ();
+ Add (main_vbox);
}
private void BuildHeader ()
@@ -142,340 +159,81 @@
toolbar_alignment.TopPadding = 3;
toolbar_alignment.BottomPadding = 3;
- header_toolbar = (Toolbar)ActionService.UIManager.GetWidget ("/HeaderToolbar");
+ header_toolbar = (Toolbar)ActionService.UIManager.GetWidget ("/MuinsheeHeaderToolbar");
header_toolbar.ShowArrow = false;
header_toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
toolbar_alignment.Add (header_toolbar);
toolbar_alignment.ShowAll ();
- primary_vbox.PackStart (toolbar_alignment, false, false, 0);
+ main_vbox.PackStart (toolbar_alignment, false, false, 0);
Widget next_button = new NextButton (ActionService);
next_button.Show ();
- ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/NextArrowButton", next_button);
-
- ConnectedSeekSlider seek_slider = new ConnectedSeekSlider ();
- seek_slider.Show ();
- ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/SeekSlider", seek_slider);
-
- TrackInfoDisplay track_info_display = new ClassicTrackInfoDisplay ();
- track_info_display.Show ();
- ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/TrackInfoDisplay", track_info_display, true);
+ ActionService.PopulateToolbarPlaceholder (header_toolbar, "/MuinsheeHeaderToolbar/NextArrowButton", next_button);
ConnectedVolumeButton volume_button = new ConnectedVolumeButton ();
volume_button.Show ();
- ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/VolumeButton", volume_button);
+ ActionService.PopulateToolbarPlaceholder (header_toolbar, "/MuinsheeHeaderToolbar/VolumeButton", volume_button);
}
- private void BuildViews ()
+ private const int info_height = 64;
+ private void BuildTrackInfo ()
{
- VBox source_box = new VBox ();
-
- views_pane = new HPaned ();
- PersistentPaneController.Control (views_pane, SourceViewWidth);
- view_container = new ViewContainer ();
-
- source_view = new SourceView ();
- composite_view = new CompositeTrackSourceContents ();
-
- Hyena.Widgets.ScrolledWindow source_scroll = new Hyena.Widgets.ScrolledWindow ();
- source_scroll.AddWithFrame (source_view);
-
- composite_view.TrackView.HeaderVisible = false;
- view_container.Content = composite_view;
-
- source_box.PackStart (source_scroll, true, true, 0);
- source_box.PackStart (new UserJobTileHost (), false, false, 0);
-
- source_view.SetSizeRequest (125, -1);
- view_container.SetSizeRequest (425, -1);
-
- views_pane.Pack1 (source_box, false, false);
- views_pane.Pack2 (view_container, true, false);
-
- source_box.ShowAll ();
- view_container.Show ();
- views_pane.Show ();
-
- primary_vbox.PackStart (views_pane, true, true, 0);
+ TrackInfoDisplay track_info_display = new MuinsheeTrackInfoDisplay ();
+ if (track_info_display.HeightRequest < info_height) {
+ track_info_display.HeightRequest = info_height;
+ }
+ track_info_display.Show ();
+ content_vbox.PackStart (track_info_display, false, false, 0);
+
+ ConnectedSeekSlider seek_slider = new ConnectedSeekSlider (SeekSliderLayout.Horizontal);
+ seek_slider.LeftPadding = seek_slider.RightPadding = 0;
+ content_vbox.PackStart (seek_slider, false, false, 0);
}
- private void BuildFooter ()
+ private void BuildViews ()
{
- footer_toolbar = (Toolbar)ActionService.UIManager.GetWidget ("/FooterToolbar");
- footer_toolbar.ShowArrow = false;
- footer_toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
-
- EventBox status_event_box = new EventBox ();
- status_event_box.ButtonPressEvent += delegate (object o, ButtonPressEventArgs args) {
- Source source = ServiceManager.SourceManager.ActiveSource;
- if (source != null) {
- source.CycleStatusFormat ();
- UpdateSourceInformation ();
- }
- };
- status_label = new Label ();
- status_event_box.Add (status_label);
-
- Alignment status_align = new Alignment (0.5f, 0.5f, 1.0f, 1.0f);
- status_align.Add (status_event_box);
-
- RepeatActionButton repeat_button = new RepeatActionButton ();
- repeat_button.SizeAllocated += delegate (object o, Gtk.SizeAllocatedArgs args) {
- status_align.LeftPadding = (uint)args.Allocation.Width;
- };
-
- ActionService.PopulateToolbarPlaceholder (footer_toolbar, "/FooterToolbar/StatusBar", status_align, true);
- ActionService.PopulateToolbarPlaceholder (footer_toolbar, "/FooterToolbar/RepeatButton", repeat_button);
-
- footer_toolbar.ShowAll ();
- primary_vbox.PackStart (footer_toolbar, false, true, 0);
+ track_view = new TerseTrackListView ();
+ track_view.HasFocus = true;
+ track_view.ColumnController.Insert (new Column (null, "indicator", new ColumnCellStatusIndicator (null), 0.05, true, 20, 20), 0);
+
+ Hyena.Widgets.ScrolledWindow sw = new Hyena.Widgets.ScrolledWindow ();
+ sw.Add (track_view);
+ /*window.Add (view);
+ window.HscrollbarPolicy = PolicyType.Automatic;
+ window.VscrollbarPolicy = PolicyType.Automatic;*/
+
+ list_label = new Label ();
+ list_label.Xalign = 0f;
+ content_vbox.PackStart (list_label, false, false, 0);
+ content_vbox.PackStart (sw, true, true, 0);
+ content_vbox.PackStart (new UserJobTileHost (), false, false, 0);
+ track_view.SetSizeRequest (425, -1);
}
#endregion
#region Events and Logic Setup
- private void ConnectEvents ()
+ protected override void ConnectEvents ()
{
- // Service events
- ServiceManager.SourceManager.ActiveSourceChanged += OnActiveSourceChanged;
+ base.ConnectEvents ();
ServiceManager.SourceManager.SourceUpdated += OnSourceUpdated;
- ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
- PlayerEvent.StartOfStream |
- PlayerEvent.TrackInfoUpdated |
- PlayerEvent.EndOfStream);
-
- ActionService.TrackActions ["SearchForSameArtistAction"].Activated += OnProgrammaticSearch;
- ActionService.TrackActions ["SearchForSameAlbumAction"].Activated += OnProgrammaticSearch;
-
- // UI events
- view_container.SearchEntry.Changed += OnSearchEntryChanged;
- views_pane.SizeRequested += delegate {
- SourceViewWidth.Set (views_pane.Position);
- };
-
- source_view.RowActivated += delegate {
- Source source = ServiceManager.SourceManager.ActiveSource;
- if (source is ITrackModelSource) {
- ServiceManager.PlaybackController.NextSource = (ITrackModelSource)source;
- // Allow changing the play source without stopping the current song by
- // holding ctrl when activating a source. After the song is done, playback will
- // continue from the new source.
- if (GtkUtilities.NoImportantModifiersAreSet (Gdk.ModifierType.ControlMask)) {
- ServiceManager.PlaybackController.Next ();
- }
- }
- };
-
header_toolbar.ExposeEvent += OnToolbarExposeEvent;
- footer_toolbar.ExposeEvent += OnToolbarExposeEvent;
}
#endregion
#region Service Event Handlers
- private void OnProgrammaticSearch (object o, EventArgs args)
- {
- Source source = ServiceManager.SourceManager.ActiveSource;
- view_container.SearchEntry.Ready = false;
- view_container.SearchEntry.Query = source.FilterQuery;
- view_container.SearchEntry.Ready = true;
- }
-
- private Source previous_source = null;
- private TrackListModel previous_track_model = null;
- private void OnActiveSourceChanged (SourceEventArgs args)
- {
- Banshee.Base.ThreadAssist.ProxyToMain (delegate {
- Source source = ServiceManager.SourceManager.ActiveSource;
-
- view_container.SearchSensitive = source != null && source.CanSearch;
-
- if (source == null) {
- return;
- }
-
- view_container.Title = source.Name;
- view_container.SearchEntry.Ready = false;
- view_container.SearchEntry.CancelSearch ();
-
- if (source.FilterQuery != null) {
- view_container.SearchEntry.Query = source.FilterQuery;
- view_container.SearchEntry.ActivateFilter ((int)source.FilterType);
- }
-
- if (view_container.Content != null) {
- view_container.Content.ResetSource ();
- }
-
- if (previous_track_model != null) {
- previous_track_model.Reloaded -= HandleTrackModelReloaded;
- previous_track_model = null;
- }
-
- if (source is ITrackModelSource) {
- previous_track_model = (source as ITrackModelSource).TrackModel;
- previous_track_model.Reloaded += HandleTrackModelReloaded;
- }
-
- if (previous_source != null) {
- previous_source.Properties.PropertyChanged -= OnSourcePropertyChanged;
- }
-
- previous_source = source;
- previous_source.Properties.PropertyChanged += OnSourcePropertyChanged;
-
- UpdateSourceContents (source);
-
- UpdateSourceInformation ();
- view_container.SearchEntry.Ready = true;
- });
- }
-
- private void OnSourcePropertyChanged (object o, PropertyChangeEventArgs args)
- {
- if (args.PropertyName == "Nereid.SourceContents") {
- UpdateSourceContents (previous_source);
- }
- }
-
- private void UpdateSourceContents (Source source)
- {
- if (source == null) {
- return;
- }
-
- // Connect the source models to the views if possible
- ISourceContents contents = source.GetInheritedProperty<bool> ("Nereid.SourceContentsPropagate")
- ? source.GetInheritedProperty<ISourceContents> ("Nereid.SourceContents")
- : source.Properties.Get<ISourceContents> ("Nereid.SourceContents");
-
- if (contents != null) {
- if (view_container.Content != contents) {
- view_container.Content = contents;
- }
- view_container.Content.SetSource (source);
- view_container.Show ();
- } else if (source is ITrackModelSource) {
- view_container.Content = composite_view;
- view_container.Content.SetSource (source);
- view_container.Show ();
- } else if (source is Hyena.Data.IObjectListModel) {
- if (object_view == null) {
- object_view = new ObjectListSourceContents ();
- }
-
- view_container.Content = object_view;
- view_container.Content.SetSource (source);
- view_container.Show ();
- } else {
- view_container.Hide ();
- }
-
- // Associate the view with the model
- if (view_container.Visible && view_container.Content is ITrackModelSourceContents) {
- ITrackModelSourceContents track_content = view_container.Content as ITrackModelSourceContents;
- source.Properties.Set<IListView<TrackInfo>> ("Track.IListView", track_content.TrackView);
- }
-
- view_container.Header.Visible = source.Properties.Contains ("Nereid.SourceContents.HeaderVisible") ?
- source.Properties.Get<bool> ("Nereid.SourceContents.HeaderVisible") : true;
-
- view_container.ClearFooter ();
- Widget footer_widget = null;
-
- if (source.Properties.Contains ("Nereid.SourceContents.FooterWidget")) {
- footer_widget = source.Properties.Get<Widget> ("Nereid.SourceContents.FooterWidget");
- }
-
- if (footer_widget != null) {
- view_container.SetFooter (footer_widget);
- }
- }
-
private void OnSourceUpdated (SourceEventArgs args)
{
if (args.Source == ServiceManager.SourceManager.ActiveSource) {
UpdateSourceInformation ();
- view_container.Title = args.Source.Name;
}
}
- private void OnPlayerEvent (PlayerEventArgs args)
- {
- UpdateTitle ();
- }
-
-#endregion
-
-#region UI Event Handlers
-
- private void OnSearchEntryChanged (object o, EventArgs args)
- {
- Source source = ServiceManager.SourceManager.ActiveSource;
- if (source == null)
- return;
-
- source.FilterType = (TrackFilterType)view_container.SearchEntry.ActiveFilterID;
- source.FilterQuery = view_container.SearchEntry.Query;
- }
-
- private void OnToolbarExposeEvent (object o, ExposeEventArgs args)
- {
- Toolbar toolbar = (Toolbar)o;
-
- // This forces the toolbar to look like it's just a regular part
- // of the window since the stock toolbar look makes Banshee look ugly.
- Style.ApplyDefaultBackground (toolbar.GdkWindow, true, State,
- args.Event.Area, toolbar.Allocation.X, toolbar.Allocation.Y,
- toolbar.Allocation.Width, toolbar.Allocation.Height);
-
- // Manually expose all the toolbar's children
- foreach (Widget child in toolbar.Children) {
- toolbar.PropagateExpose (child, args.Event);
- }
- }
-
-#endregion
-
-#region Implement Interfaces
-
- // IHasTrackSelection
- /*public IEnumerable<TrackInfo> GetSelectedTracks ()
- {
- return new ModelSelection<TrackInfo> (composite_view.TrackModel, composite_view.TrackView.Selection);
- }
-
- public Hyena.Collections.SelectionProxy TrackSelectionProxy {
- get { return composite_view.TrackView.SelectionProxy; }
- }
-
- public DatabaseTrackListModel TrackModel {
- get { return composite_view.TrackModel as DatabaseTrackListModel; }
- }*/
-
- // IHasSourceView
- public Source HighlightedSource {
- get { return source_view.HighlightedSource; }
- }
-
- public void BeginRenameSource (Source source)
- {
- source_view.BeginRenameSource (source);
- }
-
- public void ResetHighlight ()
- {
- source_view.ResetHighlight ();
- }
-
- public override Box ViewContainer {
- get { return view_container; }
- }
-
#endregion
#region Gtk.Window Overrides
@@ -491,47 +249,6 @@
(o as Widget).FocusOutEvent -= OnEntryFocusOutEvent;
}
-
- protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
- {
- bool focus_search = false;
-
- if (Focus is Gtk.Entry && (GtkUtilities.NoImportantModifiersAreSet () &&
- evnt.Key != Gdk.Key.Control_L && evnt.Key != Gdk.Key.Control_R)) {
- if (accel_group_active) {
- RemoveAccelGroup (ActionService.UIManager.AccelGroup);
- accel_group_active = false;
-
- // Reinstate the AccelGroup as soon as the focus leaves the entry
- Focus.FocusOutEvent += OnEntryFocusOutEvent;
- }
- } else {
- if (!accel_group_active) {
- AddAccelGroup (ActionService.UIManager.AccelGroup);
- accel_group_active = true;
- }
- }
-
- switch (evnt.Key) {
- case Gdk.Key.f:
- if (Gdk.ModifierType.ControlMask == (evnt.State & Gdk.ModifierType.ControlMask)) {
- focus_search = true;
- }
- break;
-
- case Gdk.Key.S: case Gdk.Key.s:
- case Gdk.Key.F3: case Gdk.Key.slash:
- focus_search = true;
- break;
- }
-
- if (focus_search && !view_container.SearchEntry.HasFocus && !source_view.EditingRow) {
- view_container.SearchEntry.HasFocus = true;
- return true;
- }
-
- return base.OnKeyPressEvent (evnt);
- }
#endregion
@@ -544,33 +261,20 @@
private void UpdateSourceInformation ()
{
- Source source = ServiceManager.SourceManager.ActiveSource;
- if (source == null) {
- status_label.Text = String.Empty;
- return;
+ DatabaseSource source = ServiceManager.SourceManager.ActiveSource as DatabaseSource;
+ if (source != null) {
+ System.Text.StringBuilder sb = new System.Text.StringBuilder ();
+ Source.DurationStatusFormatters[source.CurrentStatusFormat] (sb, source.Duration);
+ list_label.Markup = String.Format ("<b>{0}</b> ({1})",
+ source.Name, String.Format (Catalog.GetString ("{0} remaining"), sb.ToString ())
+ );
}
-
- status_label.Text = source.GetStatusText ();
}
#endregion
#region Configuration Schemas
- public static readonly SchemaEntry<int> SourceViewWidth = new SchemaEntry<int> (
- "player_window", "source_view_width",
- 175,
- "Source View Width",
- "Width of Source View Column."
- );
-
- public static readonly SchemaEntry<bool> ShowCoverArt = new SchemaEntry<bool> (
- "player_window", "show_cover_art",
- true,
- "Show cover art",
- "Show cover art below source view if available"
- );
-
#endregion
IDBusExportable IDBusExportable.Parent {
@@ -578,11 +282,11 @@
}
string IDBusObjectName.ExportObjectName {
- get { return "ClientWindow"; }
+ get { return "MuinsheeClientWindow"; }
}
string IService.ServiceName {
- get { return "NereidPlayerInterface"; }
+ get { return "MuinsheePlayerInterface"; }
}
}
}
Added: branches/banshee/gburt/src/Clients/Muinshee/Muinshee/SongDialog.cs
==============================================================================
--- (empty file)
+++ branches/banshee/gburt/src/Clients/Muinshee/Muinshee/SongDialog.cs Thu Aug 28 22:43:32 2008
@@ -0,0 +1,79 @@
+//
+// SongDialog.cs
+//
+// Authors:
+// Brad Taylor <brad getcoded net>
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 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 Hyena.Data;
+using Hyena.Widgets;
+
+using Banshee.Gui;
+using Banshee.Widgets;
+using Banshee.Gui.Dialogs;
+using Banshee.Playlist;
+using Banshee.Collection;
+using Banshee.Collection.Gui;
+using Banshee.ServiceStack;
+using Banshee.Configuration;
+using Banshee.Collection.Database;
+using Banshee.PlaybackController;
+using Banshee.MediaEngine;
+
+namespace Muinshee
+{
+ public class SongDialog : BaseDialog
+ {
+ public SongDialog (PlaylistSource queue) : base (queue, Catalog.GetString ("Play Song"), "song")
+ {
+ }
+
+ protected override Widget GetItemWidget ()
+ {
+ TerseTrackListView track_list = new TerseTrackListView ();
+ track_list.SetModel (Music.DatabaseTrackModel);
+ return track_list;
+ }
+
+ protected override void Queue ()
+ {
+ QueueSource.AddSelectedTracks (Music);
+ }
+
+ protected override TrackInfo FirstTrack {
+ get { return Music.TrackModel[Music.TrackModel.Selection.FirstIndex]; }
+ }
+
+ public override void Destroy ()
+ {
+ Music.TrackModel.Selection.Clear ();
+ base.Destroy ();
+ }
+ }
+}
Modified: branches/banshee/gburt/src/Clients/Nereid/Nereid/Client.cs
==============================================================================
--- branches/banshee/gburt/src/Clients/Nereid/Nereid/Client.cs (original)
+++ branches/banshee/gburt/src/Clients/Nereid/Nereid/Client.cs Thu Aug 28 22:43:32 2008
@@ -43,167 +43,16 @@
{
public class Client : Banshee.Gui.GtkBaseClient
{
- private static string user_gtkrc = Path.Combine (Paths.ApplicationData, "gtkrc");
public static void Main (string [] args)
{
- if (CheckHelpVersion ()) {
- return;
- }
-
- // Check for single instance
- DBusConnection.Connect ();
- if (DBusConnection.InstanceAlreadyRunning) {
- // Try running our friend Halie, the DBus command line client
- AppDomain.CurrentDomain.ExecuteAssembly (Path.Combine (Path.GetDirectoryName (
- Assembly.GetEntryAssembly ().Location), "Halie.exe"));
- Gdk.Global.InitCheck (ref args);
- Gdk.Global.NotifyStartupComplete ();
- return;
- }
-
- Hyena.Log.InformationFormat ("Running Banshee {0}", Application.Version);
-
- // This could go into GtkBaseClient, but it's probably something we
- // should really only support at each client level
- if (File.Exists (user_gtkrc) && !ApplicationContext.CommandLine.Contains ("no-gtkrc")) {
- Gtk.Rc.AddDefaultFile (user_gtkrc);
- }
-
- // Ugly hack to avoid stupid themes that set this to 0, causing a huge
- // bug when constructing the "add to playlist" popup menu (BGO #524706)
- Gtk.Rc.ParseString ("gtk-menu-popup-delay = 225");
-
- // Boot the client
- Banshee.Gui.GtkBaseClient.Entry<Client> ();
+ Startup<Nereid.Client> (args);
}
protected override void OnRegisterServices ()
{
- // Register the main interface
- ServiceManager.RegisterService<PlayerInterface> ();
+ ServiceManager.RegisterService<Nereid.PlayerInterface> ();
}
-
- private static bool CheckHelpVersion ()
- {
- if (ApplicationContext.CommandLine.ContainsStart ("help")) {
- ShowHelp ();
- return true;
- } else if (ApplicationContext.CommandLine.Contains ("version")) {
- ShowVersion ();
- return true;
- }
-
- return false;
- }
-
- private static void ShowHelp ()
- {
- Console.WriteLine ("Usage: {0} [options...] [files|URIs...]", "banshee-1");
- Console.WriteLine ();
-
- Layout commands = new Layout (
- new LayoutGroup ("help", Catalog.GetString ("Help Options"),
- new LayoutOption ("help", Catalog.GetString ("Show this help")),
- new LayoutOption ("help-playback", Catalog.GetString ("Show options for controlling playback")),
- new LayoutOption ("help-query-track", Catalog.GetString ("Show options for querying the playing track")),
- new LayoutOption ("help-query-player", Catalog.GetString ("Show options for querying the playing engine")),
- new LayoutOption ("help-ui", Catalog.GetString ("Show options for the user interface")),
- new LayoutOption ("help-debug", Catalog.GetString ("Show options for developers and debugging")),
- new LayoutOption ("help-all", Catalog.GetString ("Show all option groups")),
- new LayoutOption ("version", Catalog.GetString ("Show version information"))
- ),
-
- new LayoutGroup ("playback", Catalog.GetString ("Playback Control Options"),
- new LayoutOption ("next", Catalog.GetString ("Play the next track, optionally restarting if the 'restart' value is set")),
- new LayoutOption ("previous", Catalog.GetString ("Play the previous track, optionally restarting if the 'restart value is set")),
- new LayoutOption ("play-enqueued", Catalog.GetString ("Automatically start playing any tracks enqueued on the command line")),
- new LayoutOption ("play", Catalog.GetString ("Start playback")),
- new LayoutOption ("pause", Catalog.GetString ("Pause playback")),
- new LayoutOption ("stop", Catalog.GetString ("Completely stop playback")),
- new LayoutOption ("stop-when-finished", Catalog.GetString (
- "Enable or disable playback stopping after the currently playing track (value should be either 'true' or 'false')")),
- new LayoutOption ("set-volume=LEVEL", Catalog.GetString ("Set the playback volume (0-100)")),
- new LayoutOption ("set-position=POS", Catalog.GetString ("Seek to a specific point (seconds, float)"))
- ),
-
- new LayoutGroup ("query-player", Catalog.GetString ("Player Engine Query Options"),
- new LayoutOption ("query-current-state", Catalog.GetString ("Current player state")),
- new LayoutOption ("query-last-state", Catalog.GetString ("Last player state")),
- new LayoutOption ("query-can-pause", Catalog.GetString ("Query whether the player can be paused")),
- new LayoutOption ("query-can-seek", Catalog.GetString ("Query whether the player can seek")),
- new LayoutOption ("query-volume", Catalog.GetString ("Player volume")),
- new LayoutOption ("query-position", Catalog.GetString ("Player position in currently playing track"))
- ),
-
- new LayoutGroup ("query-track", Catalog.GetString ("Playing Track Metadata Query Options"),
- new LayoutOption ("query-uri", Catalog.GetString ("URI")),
- new LayoutOption ("query-artist", Catalog.GetString ("Artist Name")),
- new LayoutOption ("query-album", Catalog.GetString ("Album Title")),
- new LayoutOption ("query-title", Catalog.GetString ("Track Title")),
- new LayoutOption ("query-duration", Catalog.GetString ("Duration")),
- new LayoutOption ("query-track-number", Catalog.GetString ("Track Number")),
- new LayoutOption ("query-track-count", Catalog.GetString ("Track Count")),
- new LayoutOption ("query-disc", Catalog.GetString ("Disc Number")),
- new LayoutOption ("query-year", Catalog.GetString ("Year")),
- new LayoutOption ("query-rating", Catalog.GetString ("Rating"))
- ),
-
- new LayoutGroup ("ui", Catalog.GetString ("User Interface Options"),
- new LayoutOption ("show|--present", Catalog.GetString ("Present the user interface on the active workspace")),
- new LayoutOption ("hide", Catalog.GetString ("Hide the user interface")),
- new LayoutOption ("no-present", Catalog.GetString ("Do not present the user interface, regardless of any other options"))
- ),
-
- new LayoutGroup ("debugging", Catalog.GetString ("Debugging and Development Options"),
- new LayoutOption ("debug", Catalog.GetString ("Enable general debugging features")),
- new LayoutOption ("debug-sql", Catalog.GetString ("Enable debugging output of SQL queries")),
- new LayoutOption ("debug-addins", Catalog.GetString ("Enable debugging output of Mono.Addins")),
- new LayoutOption ("db=FILE", Catalog.GetString ("Specify an alternate database to use")),
- new LayoutOption ("uninstalled", Catalog.GetString ("Optimize instance for running uninstalled; " +
- "most notably, this will create an alternate Mono.Addins database in the working directory")),
- new LayoutOption ("disable-dbus", Catalog.GetString ("Disable DBus support completely")),
- new LayoutOption ("no-gtkrc", String.Format (Catalog.GetString (
- "Skip loading a custom gtkrc file ({0}) if it exists"),
- user_gtkrc.Replace (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "~")))
- )
- );
-
- if (ApplicationContext.CommandLine.Contains ("help-all")) {
- Console.WriteLine (commands);
- return;
- }
-
- List<string> errors = null;
-
- foreach (KeyValuePair<string, string> argument in ApplicationContext.CommandLine.Arguments) {
- switch (argument.Key) {
- case "help": Console.WriteLine (commands.ToString ("help")); break;
- case "help-debug": Console.WriteLine (commands.ToString ("debugging")); break;
- case "help-query-track": Console.WriteLine (commands.ToString ("query-track")); break;
- case "help-query-player": Console.WriteLine (commands.ToString ("query-player")); break;
- case "help-ui": Console.WriteLine (commands.ToString ("ui")); break;
- case "help-playback": Console.WriteLine (commands.ToString ("playback")); break;
- default:
- if (argument.Key.StartsWith ("help")) {
- (errors ?? errors = new List<string> ()).Add (argument.Key);
- }
- break;
- }
- }
-
- if (errors != null) {
- Console.WriteLine (commands.LayoutLine (String.Format (Catalog.GetString (
- "The following help arguments are invalid: {0}"),
- Hyena.Collections.CollectionExtensions.Join (errors, "--", null, ", "))));
- }
- }
-
- private static void ShowVersion ()
- {
- Console.WriteLine ("Banshee {0} ({1}) http://banshee-project.org", Application.DisplayVersion, Application.Version);
- Console.WriteLine ("Copyright 2005-{0} Novell, Inc. and Contributors.", DateTime.Now.Year);
- }
-
+
public override string ClientId {
get { return "nereid"; }
}
Modified: branches/banshee/gburt/src/Clients/Nereid/Nereid/PlayerInterface.cs
==============================================================================
--- branches/banshee/gburt/src/Clients/Nereid/Nereid/PlayerInterface.cs (original)
+++ branches/banshee/gburt/src/Clients/Nereid/Nereid/PlayerInterface.cs Thu Aug 28 22:43:32 2008
@@ -69,7 +69,7 @@
private ObjectListSourceContents object_view;
private Label status_label;
- public PlayerInterface () : base (Catalog.GetString ("Banshee Media Player"))
+ public PlayerInterface () : base (Catalog.GetString ("Banshee Media Player"), "player_window", 1024, 700)
{
}
@@ -85,21 +85,6 @@
Show ();
}
- protected override void UpdateTitle ()
- {
- TrackInfo track = ServiceManager.PlayerEngine.CurrentTrack;
- if (track != null) {
- // Translators: this is the window title when a track is playing
- // {0} is the track title, {1} is the artist name
- Title = String.Format (Catalog.GetString ("{0} by {1}"),
- track.DisplayTrackTitle, track.DisplayArtistName);
- } else {
- Title = Catalog.GetString ("Banshee Media Player");
- }
-
- OnTitleChanged ();
- }
-
#region System Overrides
public override void Dispose ()
@@ -232,15 +217,13 @@
#region Events and Logic Setup
- private void ConnectEvents ()
+ protected override void ConnectEvents ()
{
+ base.ConnectEvents ();
+
// Service events
ServiceManager.SourceManager.ActiveSourceChanged += OnActiveSourceChanged;
ServiceManager.SourceManager.SourceUpdated += OnSourceUpdated;
- ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
- PlayerEvent.StartOfStream |
- PlayerEvent.TrackInfoUpdated |
- PlayerEvent.EndOfStream);
ActionService.TrackActions ["SearchForSameArtistAction"].Activated += OnProgrammaticSearch;
ActionService.TrackActions ["SearchForSameAlbumAction"].Activated += OnProgrammaticSearch;
@@ -398,12 +381,7 @@
view_container.Title = args.Source.Name;
}
}
-
- private void OnPlayerEvent (PlayerEventArgs args)
- {
- UpdateTitle ();
- }
-
+
#endregion
#region UI Event Handlers
@@ -418,40 +396,10 @@
source.FilterQuery = view_container.SearchEntry.Query;
}
- private void OnToolbarExposeEvent (object o, ExposeEventArgs args)
- {
- Toolbar toolbar = (Toolbar)o;
-
- // This forces the toolbar to look like it's just a regular part
- // of the window since the stock toolbar look makes Banshee look ugly.
- Style.ApplyDefaultBackground (toolbar.GdkWindow, true, State,
- args.Event.Area, toolbar.Allocation.X, toolbar.Allocation.Y,
- toolbar.Allocation.Width, toolbar.Allocation.Height);
-
- // Manually expose all the toolbar's children
- foreach (Widget child in toolbar.Children) {
- toolbar.PropagateExpose (child, args.Event);
- }
- }
-
#endregion
#region Implement Interfaces
- // IHasTrackSelection
- /*public IEnumerable<TrackInfo> GetSelectedTracks ()
- {
- return new ModelSelection<TrackInfo> (composite_view.TrackModel, composite_view.TrackView.Selection);
- }
-
- public Hyena.Collections.SelectionProxy TrackSelectionProxy {
- get { return composite_view.TrackView.SelectionProxy; }
- }
-
- public DatabaseTrackListModel TrackModel {
- get { return composite_view.TrackModel as DatabaseTrackListModel; }
- }*/
-
// IHasSourceView
public Source HighlightedSource {
get { return source_view.HighlightedSource; }
Modified: branches/banshee/gburt/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumListModel.cs
==============================================================================
--- branches/banshee/gburt/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumListModel.cs (original)
+++ branches/banshee/gburt/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseAlbumListModel.cs Thu Aug 28 22:43:32 2008
@@ -42,7 +42,7 @@
{
public class DatabaseAlbumListModel : DatabaseFilterListModel<DatabaseAlbumInfo, AlbumInfo>
{
- public DatabaseAlbumListModel ( Banshee.Sources.DatabaseSource source, DatabaseTrackListModel trackModel, BansheeDbConnection connection, string uuid)
+ public DatabaseAlbumListModel (Banshee.Sources.DatabaseSource source, DatabaseTrackListModel trackModel, BansheeDbConnection connection, string uuid)
: base (Banshee.Query.BansheeQuery.AlbumField.Name, Banshee.Query.BansheeQuery.AlbumField.Label,
source, trackModel, connection, DatabaseAlbumInfo.Provider, new AlbumInfo (null), uuid)
{
Modified: branches/banshee/gburt/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs
==============================================================================
--- branches/banshee/gburt/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs (original)
+++ branches/banshee/gburt/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs Thu Aug 28 22:43:32 2008
@@ -314,6 +314,11 @@
return (int) cache.IndexOf (track as DatabaseTrackInfo);
}
+ public int IndexOfFirst (TrackInfo track)
+ {
+ return IndexOf (cache.GetSingle ("AND MetadataHash = ? ORDER BY OrderID", track.MetadataHash));
+ }
+
private DateTime random_began_at = DateTime.MinValue;
private DateTime last_random = DateTime.MinValue;
private static string random_fragment = "AND (LastPlayedStamp < ? OR LastPlayedStamp IS NULL) AND (LastSkippedStamp < ? OR LastSkippedStamp IS NULL) ORDER BY RANDOM()";
Modified: branches/banshee/gburt/src/Core/Banshee.Services/Banshee.Sources/Source.cs
==============================================================================
--- branches/banshee/gburt/src/Core/Banshee.Services/Banshee.Sources/Source.cs (original)
+++ branches/banshee/gburt/src/Core/Banshee.Services/Banshee.Sources/Source.cs Thu Aug 28 22:43:32 2008
@@ -549,7 +549,7 @@
get { return duration_status_formatters.Count; }
}
- protected virtual int CurrentStatusFormat {
+ public virtual int CurrentStatusFormat {
get { return ConfigurationClient.Get<int> (String.Format ("sources.{0}", ConfigurationId), "status_format", 0); }
set { ConfigurationClient.Set<int> (String.Format ("sources.{0}", ConfigurationId), "status_format", value); }
}
Added: branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs
==============================================================================
--- (empty file)
+++ branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/BaseTrackListView.cs Thu Aug 28 22:43:32 2008
@@ -0,0 +1,130 @@
+//
+// BaseTrackListView.cs
+//
+// Author:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2007-2008 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.Data;
+using Hyena.Data.Gui;
+using Hyena.Gui;
+
+using Banshee.Sources;
+using Banshee.ServiceStack;
+using Banshee.MediaEngine;
+using Banshee.Playlist;
+
+using Banshee.Gui;
+
+namespace Banshee.Collection.Gui
+{
+ public class BaseTrackListView : ListView<TrackInfo>
+ {
+ public BaseTrackListView () : base ()
+ {
+ RulesHint = true;
+ RowSensitivePropertyName = "CanPlay";
+ RowBoldPropertyName = "IsPlaying";
+
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.StateChange);
+
+ ForceDragSourceSet = true;
+ Reorderable = true;
+
+ RowActivated += delegate (object o, RowActivatedArgs<TrackInfo> args) {
+ ITrackModelSource source = ServiceManager.SourceManager.ActiveSource as ITrackModelSource;
+ if (source != null && source.TrackModel == Model) {
+ ServiceManager.PlaybackController.Source = source;
+ ServiceManager.PlayerEngine.OpenPlay (args.RowValue);
+ }
+ };
+ }
+
+ protected override bool OnKeyPressEvent (Gdk.EventKey press)
+ {
+ // Have o act the same as enter - activate the selection
+ if (GtkUtilities.NoImportantModifiersAreSet () && press.Key == Gdk.Key.o && ActivateSelection ()) {
+ return true;
+ }
+ return base.OnKeyPressEvent (press);
+ }
+
+ protected override bool OnPopupMenu ()
+ {
+ ServiceManager.Get<InterfaceActionService> ().TrackActions["TrackContextMenuAction"].Activate ();
+ return true;
+ }
+
+ private void OnPlayerEvent (PlayerEventArgs args)
+ {
+ QueueDraw ();
+ }
+
+#region Drag and Drop
+
+ protected override void OnDragSourceSet ()
+ {
+ base.OnDragSourceSet ();
+ Drag.SourceSetIconName (this, "audio-x-generic");
+ }
+
+ protected override bool OnDragDrop (Gdk.DragContext context, int x, int y, uint time_)
+ {
+ y = TranslateToListY (y);
+ if (Gtk.Drag.GetSourceWidget (context) == this) {
+ PlaylistSource playlist = ServiceManager.SourceManager.ActiveSource as PlaylistSource;
+ if (playlist != null) {
+ //Gtk.Drag.
+ int row = GetRowAtY (y);
+ if (row != GetRowAtY (y + RowHeight / 2)) {
+ row += 1;
+ }
+
+ if (playlist.TrackModel.Selection.Contains (row)) {
+ // can't drop within the selection
+ return false;
+ }
+
+ playlist.ReorderSelectedTracks (row);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ protected override void OnDragDataGet (Gdk.DragContext context, SelectionData selection_data, uint info, uint time)
+ {
+ if (info != (int)ListViewDragDropTarget.TargetType.ModelSelection || Selection.Count <= 0) {
+ return;
+ }
+ }
+
+#endregion
+ }
+}
Modified: branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellTrack.cs
==============================================================================
--- branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellTrack.cs (original)
+++ branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellTrack.cs Thu Aug 28 22:43:32 2008
@@ -30,12 +30,16 @@
using Gtk;
using Cairo;
+using Hyena.Gui;
using Hyena.Data.Gui;
+using Hyena.Gui.Theming;
namespace Banshee.Collection.Gui
{
- public class ColumnCellTrack : ColumnCell
+ public class ColumnCellTrack : ColumnCell, ITextCell
{
+ private Pango.Weight font_weight = Pango.Weight.Normal;
+
public ColumnCellTrack () : base (null, true)
{
}
@@ -61,26 +65,31 @@
}
TrackInfo track = (TrackInfo)BoundObject;
-
- Pango.Layout layout = context.Layout;
-
- int x = 5, y = 0;
- int lw, lh;
-
- layout.Width = (int)((cellWidth - 2 * x) * Pango.Scale.PangoScale);
- layout.Ellipsize = Pango.EllipsizeMode.End;
- layout.FontDescription = context.Widget.PangoContext.FontDescription.Copy ();
- layout.SetMarkup (String.Format ("<b>{0}</b>\n<small><i>{1}</i></small>",
+
+ context.Layout.Width = (int)((cellWidth - 8) * Pango.Scale.PangoScale);
+ context.Layout.Ellipsize = Pango.EllipsizeMode.End;
+ //context.Layout.FontDescription = context.Widget.PangoContext.FontDescription.Copy ();
+ context.Layout.FontDescription.Weight = font_weight;
+ context.Layout.SetMarkup (String.Format ("<b>{0}</b>\n<small><i>{1}</i></small>",
GLib.Markup.EscapeText (track.DisplayTrackTitle),
GLib.Markup.EscapeText (track.DisplayArtistName)));
+
+ int text_width;
+ int text_height;
+ context.Layout.GetPixelSize (out text_width, out text_height);
+
+ context.Context.MoveTo (4, ((int)cellHeight - text_height) / 2);
+ Cairo.Color color = context.Theme.Colors.GetWidgetColor (
+ context.TextAsForeground ? GtkColorClass.Foreground : GtkColorClass.Text, state);
+ color.A = (!context.Sensitive) ? 0.3 : 1.0;
+ context.Context.Color = color;
- layout.GetPixelSize (out lw, out lh);
-
- y = (int)((cellHeight - lh) / 2);
-
- Style.PaintLayout (context.Widget.Style, context.Drawable, state, true,
- context.Area, context.Widget, "text",
- context.Area.X + x, context.Area.Y + y, layout);
+ PangoCairoHelper.ShowLayout (context.Context, context.Layout);
+ }
+
+ public Pango.Weight FontWeight {
+ get { return font_weight; }
+ set { font_weight = value; }
}
}
}
Modified: branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TerseTrackListView.cs
==============================================================================
--- branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TerseTrackListView.cs (original)
+++ branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TerseTrackListView.cs Thu Aug 28 22:43:32 2008
@@ -37,22 +37,21 @@
namespace Banshee.Collection.Gui
{
- public class TerseTrackListView : ListView<TrackInfo>
+ public class TerseTrackListView : BaseTrackListView
{
private ColumnController column_controller;
public TerseTrackListView () : base ()
{
- ColumnCellTrack renderer = new ColumnCellTrack ();
-
column_controller = new ColumnController ();
+
+ ColumnCellTrack renderer = new ColumnCellTrack ();
column_controller.Add (new Column ("Track", renderer, 1.0));
ColumnController = column_controller;
RowHeightProvider = renderer.ComputeRowHeight;
HeaderVisible = false;
- RulesHint = true;
}
}
}
Modified: branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackFilterListView.cs
==============================================================================
--- branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackFilterListView.cs (original)
+++ branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackFilterListView.cs Thu Aug 28 22:43:32 2008
@@ -47,11 +47,15 @@
column_controller = new ColumnController ();
ForceDragSourceSet = true;
+ HeaderVisible = false;
- RowActivated += delegate {
- ServiceManager.PlaybackController.NextSource = (ServiceManager.SourceManager.ActiveSource as Banshee.Sources.ITrackModelSource);
- ServiceManager.PlaybackController.Next ();
- };
+ RowActivated += OnRowActivated;
+ }
+
+ protected virtual void OnRowActivated (object o, EventArgs args)
+ {
+ ServiceManager.PlaybackController.NextSource = (ServiceManager.SourceManager.ActiveSource as Banshee.Sources.ITrackModelSource);
+ ServiceManager.PlaybackController.Next ();
}
// TODO add context menu for artists/albums...probably need a Banshee.Gui/ArtistActions.cs file. Should
Modified: branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs
==============================================================================
--- branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs (original)
+++ branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/TrackListView.cs Thu Aug 28 22:43:32 2008
@@ -43,39 +43,13 @@
namespace Banshee.Collection.Gui
{
- public class TrackListView : ListView<TrackInfo>
+ public class TrackListView : BaseTrackListView
{
private ColumnController default_column_controller;
public TrackListView () : base ()
{
default_column_controller = new DefaultColumnController ();
-
- RulesHint = true;
- RowSensitivePropertyName = "CanPlay";
- RowBoldPropertyName = "IsPlaying";
-
- ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.StateChange);
-
- ForceDragSourceSet = true;
- Reorderable = true;
-
- RowActivated += delegate (object o, RowActivatedArgs<TrackInfo> args) {
- ITrackModelSource source = ServiceManager.SourceManager.ActiveSource as ITrackModelSource;
- if (source != null && source.TrackModel == Model) {
- ServiceManager.PlaybackController.Source = source;
- ServiceManager.PlayerEngine.OpenPlay (args.RowValue);
- }
- };
- }
-
- protected override bool OnKeyPressEvent (Gdk.EventKey press)
- {
- // Have o act the same as enter - activate the selection
- if (GtkUtilities.NoImportantModifiersAreSet () && press.Key == Gdk.Key.o && ActivateSelection ()) {
- return true;
- }
- return base.OnKeyPressEvent (press);
}
public override void SetModel (IListModel<TrackInfo> value, double vpos)
@@ -113,59 +87,5 @@
base.SetModel (value, vpos);
}
-
- protected override bool OnPopupMenu ()
- {
- ServiceManager.Get<InterfaceActionService> ().TrackActions["TrackContextMenuAction"].Activate ();
- return true;
- }
-
- private void OnPlayerEvent (PlayerEventArgs args)
- {
- QueueDraw ();
- }
-
-#region Drag and Drop
-
- protected override void OnDragSourceSet ()
- {
- base.OnDragSourceSet ();
- Drag.SourceSetIconName (this, "audio-x-generic");
- }
-
- protected override bool OnDragDrop (Gdk.DragContext context, int x, int y, uint time_)
- {
- y = TranslateToListY (y);
- if (Gtk.Drag.GetSourceWidget (context) == this) {
- PlaylistSource playlist = ServiceManager.SourceManager.ActiveSource as PlaylistSource;
- if (playlist != null) {
- //Gtk.Drag.
- int row = GetRowAtY (y);
- if (row != GetRowAtY (y + RowHeight / 2)) {
- row += 1;
- }
-
- if (playlist.TrackModel.Selection.Contains (row)) {
- // can't drop within the selection
- return false;
- }
-
- playlist.ReorderSelectedTracks (row);
- return true;
- }
- }
-
- return false;
- }
-
- protected override void OnDragDataGet (Gdk.DragContext context, SelectionData selection_data, uint info, uint time)
- {
- if (info != (int)ListViewDragDropTarget.TargetType.ModelSelection || Selection.Count <= 0) {
- return;
- }
- }
-
-#endregion
-
}
}
Modified: branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/BansheeDialog.cs
==============================================================================
--- branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/BansheeDialog.cs (original)
+++ branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui.Dialogs/BansheeDialog.cs Thu Aug 28 22:43:32 2008
@@ -99,7 +99,11 @@
button.CanDefault = true;
button.UseStock = isStock;
button.Show ();
+ AddButton (button, response, isDefault);
+ }
+ public void AddButton (Button button, ResponseType response, bool isDefault)
+ {
AddActionWidget (button, response);
if (isDefault) {
Modified: branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
==============================================================================
--- branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs (original)
+++ branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs Thu Aug 28 22:43:32 2008
@@ -65,12 +65,12 @@
private Pixbuf missing_audio_pixbuf;
protected Pixbuf MissingAudioPixbuf {
- get { return missing_audio_pixbuf; }
+ get { return missing_audio_pixbuf ?? missing_audio_pixbuf = IconThemeUtils.LoadIcon (MissingIconSizeRequest, "audio-x-generic"); }
}
private Pixbuf missing_video_pixbuf;
protected Pixbuf MissingVideoPixbuf {
- get { return missing_video_pixbuf; }
+ get { return missing_video_pixbuf ?? missing_video_pixbuf = IconThemeUtils.LoadIcon (MissingIconSizeRequest, "video-x-generic"); }
}
private Cairo.Color background_color;
@@ -250,7 +250,7 @@
if (same_artist_album) {
RenderTrackInfo (cr, incoming_track, same_track, true);
- }
+ }
if (stage.Actor.Percent <= 0.5) {
// Fade out old text
@@ -356,17 +356,7 @@
Gdk.Pixbuf pixbuf = artwork_manager.LookupScale (track.ArtworkId, ArtworkSizeRequest);
if (pixbuf == null) {
- if ((track.MediaAttributes & TrackMediaAttributes.VideoStream) != 0) {
- if (missing_video_pixbuf == null) {
- missing_video_pixbuf = IconThemeUtils.LoadIcon (MissingIconSizeRequest, "video-x-generic");
- }
- incoming_pixbuf = missing_video_pixbuf;
- } else {
- if (missing_audio_pixbuf == null) {
- missing_audio_pixbuf = IconThemeUtils.LoadIcon (MissingIconSizeRequest, "audio-x-generic");
- }
- incoming_pixbuf = missing_audio_pixbuf;
- }
+ LoadMissingPixbuf ((track.MediaAttributes & TrackMediaAttributes.VideoStream) != 0);
} else {
incoming_pixbuf = pixbuf;
}
@@ -375,6 +365,11 @@
current_pixbuf = incoming_pixbuf;
}
}
+
+ private void LoadMissingPixbuf (bool is_video)
+ {
+ incoming_pixbuf = is_video ? MissingVideoPixbuf : MissingAudioPixbuf;
+ }
private double last_fps = 0.0;
Modified: branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs
==============================================================================
--- branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs (original)
+++ branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs Thu Aug 28 22:43:32 2008
@@ -28,14 +28,19 @@
using System;
using Gtk;
+using Mono.Unix;
using Banshee.ServiceStack;
+using Banshee.MediaEngine;
+using Banshee.Collection;
using Banshee.Configuration;
namespace Banshee.Gui
{
public abstract class BaseClientWindow : Window
{
+ private PersistentWindowController window_controller;
+
private GtkElementsService elements_service;
protected GtkElementsService ElementsService {
get { return elements_service; }
@@ -48,13 +53,15 @@
public event EventHandler TitleChanged;
- public BaseClientWindow (string title) : base (title)
+ public BaseClientWindow (string title, string configNameSpace, int defaultWidth, int defaultHeight) : base (title)
{
elements_service = ServiceManager.Get<GtkElementsService> ("GtkElementsService");
action_service = ServiceManager.Get<InterfaceActionService> ("InterfaceActionService");
ConfigureWindow ();
- ResizeMoveWindow ();
+
+ window_controller = new PersistentWindowController (this, configNameSpace, defaultWidth, defaultHeight, WindowPersistOptions.All);
+ window_controller.Restore ();
elements_service.PrimaryWindow = this;
@@ -63,78 +70,43 @@
InitializeWindow ();
}
- public abstract Box ViewContainer { get; }
+ public virtual Box ViewContainer { get { return null; } }
public void ToggleVisibility ()
{
if (Visible) {
- SaveWindowSizePosition ();
+ window_controller.Save ();
Visible = false;
} else {
- RestoreWindowSizePosition ();
+ window_controller.Restore ();
Present ();
}
}
- private int x, y, w, h;
- private bool maximized;
-
- private void SaveWindowSizePosition ()
+ private void InitializeWindow ()
{
- maximized = ((GdkWindow.State & Gdk.WindowState.Maximized) > 0);
-
- if (!maximized) {
- GetPosition (out x, out y);
- GetSize (out w, out h);
- }
+ Initialize ();
}
+
+ protected abstract void Initialize ();
- private void RestoreWindowSizePosition ()
+ protected virtual void ConnectEvents ()
{
- if (maximized) {
- Maximize ();
- } else {
- Resize (w, h);
- Move (x, y);
- }
+ ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
+ PlayerEvent.StartOfStream |
+ PlayerEvent.TrackInfoUpdated |
+ PlayerEvent.EndOfStream);
}
-
- private void InitializeWindow ()
+
+ private void OnPlayerEvent (PlayerEventArgs args)
{
- Initialize ();
+ UpdateTitle ();
}
-
- protected abstract void Initialize ();
protected virtual void ConfigureWindow ()
{
- WindowPosition = WindowPosition.Center;
}
- protected virtual void ResizeMoveWindow ()
- {
- int x = XPosSchema.Get ();
- int y = YPosSchema.Get ();
- int width = WidthSchema.Get ();
- int height = HeightSchema.Get ();
-
- if(width != 0 && height != 0) {
- Resize (width, height);
- }
-
- if (x == 0 && y == 0) {
- SetPosition (WindowPosition.Center);
- } else {
- Move (x, y);
- }
-
- if (MaximizedSchema.Get ()) {
- Maximize ();
- } else {
- Unmaximize ();
- }
- }
-
protected override bool OnDeleteEvent (Gdk.Event evnt)
{
if (ElementsService.PrimaryWindowClose != null) {
@@ -147,32 +119,13 @@
return base.OnDeleteEvent (evnt);
}
- protected override bool OnConfigureEvent (Gdk.EventConfigure evnt)
- {
- int x, y, width, height;
-
- if ((GdkWindow.State & Gdk.WindowState.Maximized) != 0) {
- return base.OnConfigureEvent (evnt);
- }
-
- GetPosition (out x, out y);
- GetSize (out width, out height);
-
- XPosSchema.Set (x);
- YPosSchema.Set (y);
- WidthSchema.Set (width);
- HeightSchema.Set (height);
-
- return base.OnConfigureEvent (evnt);
- }
-
protected override bool OnWindowStateEvent (Gdk.EventWindowState evnt)
{
ToggleAction fullscreen_action = (ToggleAction) ServiceManager.Get<InterfaceActionService> ().ViewActions["FullScreenAction"];
fullscreen_action.Active = (evnt.NewWindowState & Gdk.WindowState.Fullscreen) != 0;
if ((evnt.NewWindowState & Gdk.WindowState.Withdrawn) == 0) {
- MaximizedSchema.Set ((evnt.NewWindowState & Gdk.WindowState.Maximized) != 0);
+ window_controller.Save ();
}
return base.OnWindowStateEvent (evnt);
@@ -186,41 +139,35 @@
}
}
- protected abstract void UpdateTitle ();
-
- public static readonly SchemaEntry<int> WidthSchema = new SchemaEntry<int>(
- "player_window", "width",
- 1024,
- "Window Width",
- "Width of the main interface window."
- );
-
- public static readonly SchemaEntry<int> HeightSchema = new SchemaEntry<int>(
- "player_window", "height",
- 700,
- "Window Height",
- "Height of the main interface window."
- );
-
- public static readonly SchemaEntry<int> XPosSchema = new SchemaEntry<int>(
- "player_window", "x_pos",
- 0,
- "Window Position X",
- "Pixel position of Main Player Window on the X Axis"
- );
-
- public static readonly SchemaEntry<int> YPosSchema = new SchemaEntry<int>(
- "player_window", "y_pos",
- 0,
- "Window Position Y",
- "Pixel position of Main Player Window on the Y Axis"
- );
-
- public static readonly SchemaEntry<bool> MaximizedSchema = new SchemaEntry<bool>(
- "player_window", "maximized",
- false,
- "Window Maximized",
- "True if main window is to be maximized, false if it is not."
- );
+ protected virtual void UpdateTitle ()
+ {
+ TrackInfo track = ServiceManager.PlayerEngine.CurrentTrack;
+ if (track != null) {
+ // Translators: this is the window title when a track is playing
+ // {0} is the track title, {1} is the artist name
+ Title = String.Format (Catalog.GetString ("{0} by {1}"),
+ track.DisplayTrackTitle, track.DisplayArtistName);
+ } else {
+ Title = Catalog.GetString ("Banshee Media Player");
+ }
+
+ OnTitleChanged ();
+ }
+
+ protected void OnToolbarExposeEvent (object o, ExposeEventArgs args)
+ {
+ Toolbar toolbar = (Toolbar)o;
+
+ // This forces the toolbar to look like it's just a regular part
+ // of the window since the stock toolbar look makes Banshee look ugly.
+ Style.ApplyDefaultBackground (toolbar.GdkWindow, true, State,
+ args.Event.Area, toolbar.Allocation.X, toolbar.Allocation.Y,
+ toolbar.Allocation.Width, toolbar.Allocation.Height);
+
+ // Manually expose all the toolbar's children
+ foreach (Widget child in toolbar.Children) {
+ toolbar.PropagateExpose (child, args.Event);
+ }
+ }
}
}
Modified: branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
==============================================================================
--- branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs (original)
+++ branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs Thu Aug 28 22:43:32 2008
@@ -27,8 +27,15 @@
//
using System;
+using System.IO;
+using System.Diagnostics;
+using System.Reflection;
+using System.Collections.Generic;
+using Mono.Unix;
using Hyena;
+using Hyena.CommandLine;
+
using Banshee.Base;
using Banshee.Database;
using Banshee.ServiceStack;
@@ -38,15 +45,170 @@
{
public abstract class GtkBaseClient : Client
{
- private static Type client_type;
+ private static Type client_type;
+
+ private static string user_gtkrc = Path.Combine (Paths.ApplicationData, "gtkrc");
+ public static void Startup<T> (string [] args) where T : GtkBaseClient
+ {
+ if (CheckHelpVersion ()) {
+ return;
+ }
+
+ // Check for single instance
+ DBusConnection.Connect ();
+ if (DBusConnection.InstanceAlreadyRunning) {
+ // Try running our friend Halie, the DBus command line client
+ AppDomain.CurrentDomain.ExecuteAssembly (Path.Combine (Path.GetDirectoryName (
+ Assembly.GetEntryAssembly ().Location), "Halie.exe"));
+ Gdk.Global.InitCheck (ref args);
+ Gdk.Global.NotifyStartupComplete ();
+ return;
+ }
+
+ Hyena.Log.InformationFormat ("Running Banshee {0}", Application.Version);
+
+ // This could go into GtkBaseClient, but it's probably something we
+ // should really only support at each client level
+ if (File.Exists (user_gtkrc) && !ApplicationContext.CommandLine.Contains ("no-gtkrc")) {
+ Gtk.Rc.AddDefaultFile (user_gtkrc);
+ }
+
+ // Ugly hack to avoid stupid themes that set this to 0, causing a huge
+ // bug when constructing the "add to playlist" popup menu (BGO #524706)
+ Gtk.Rc.ParseString ("gtk-menu-popup-delay = 225");
+
+ // Boot the client
+ Banshee.Gui.GtkBaseClient.Startup<T> ();
+ }
+
+ private static bool CheckHelpVersion ()
+ {
+ if (ApplicationContext.CommandLine.ContainsStart ("help")) {
+ ShowHelp ();
+ return true;
+ } else if (ApplicationContext.CommandLine.Contains ("version")) {
+ ShowVersion ();
+ return true;
+ }
+
+ return false;
+ }
+
+ private static void ShowHelp ()
+ {
+ Console.WriteLine ("Usage: {0} [options...] [files|URIs...]", "banshee-1");
+ Console.WriteLine ();
+
+ Layout commands = new Layout (
+ new LayoutGroup ("help", Catalog.GetString ("Help Options"),
+ new LayoutOption ("help", Catalog.GetString ("Show this help")),
+ new LayoutOption ("help-playback", Catalog.GetString ("Show options for controlling playback")),
+ new LayoutOption ("help-query-track", Catalog.GetString ("Show options for querying the playing track")),
+ new LayoutOption ("help-query-player", Catalog.GetString ("Show options for querying the playing engine")),
+ new LayoutOption ("help-ui", Catalog.GetString ("Show options for the user interface")),
+ new LayoutOption ("help-debug", Catalog.GetString ("Show options for developers and debugging")),
+ new LayoutOption ("help-all", Catalog.GetString ("Show all option groups")),
+ new LayoutOption ("version", Catalog.GetString ("Show version information"))
+ ),
+
+ new LayoutGroup ("playback", Catalog.GetString ("Playback Control Options"),
+ new LayoutOption ("next", Catalog.GetString ("Play the next track, optionally restarting if the 'restart' value is set")),
+ new LayoutOption ("previous", Catalog.GetString ("Play the previous track, optionally restarting if the 'restart value is set")),
+ new LayoutOption ("play-enqueued", Catalog.GetString ("Automatically start playing any tracks enqueued on the command line")),
+ new LayoutOption ("play", Catalog.GetString ("Start playback")),
+ new LayoutOption ("pause", Catalog.GetString ("Pause playback")),
+ new LayoutOption ("stop", Catalog.GetString ("Completely stop playback")),
+ new LayoutOption ("stop-when-finished", Catalog.GetString (
+ "Enable or disable playback stopping after the currently playing track (value should be either 'true' or 'false')")),
+ new LayoutOption ("set-volume=LEVEL", Catalog.GetString ("Set the playback volume (0-100)")),
+ new LayoutOption ("set-position=POS", Catalog.GetString ("Seek to a specific point (seconds, float)"))
+ ),
+
+ new LayoutGroup ("query-player", Catalog.GetString ("Player Engine Query Options"),
+ new LayoutOption ("query-current-state", Catalog.GetString ("Current player state")),
+ new LayoutOption ("query-last-state", Catalog.GetString ("Last player state")),
+ new LayoutOption ("query-can-pause", Catalog.GetString ("Query whether the player can be paused")),
+ new LayoutOption ("query-can-seek", Catalog.GetString ("Query whether the player can seek")),
+ new LayoutOption ("query-volume", Catalog.GetString ("Player volume")),
+ new LayoutOption ("query-position", Catalog.GetString ("Player position in currently playing track"))
+ ),
+
+ new LayoutGroup ("query-track", Catalog.GetString ("Playing Track Metadata Query Options"),
+ new LayoutOption ("query-uri", Catalog.GetString ("URI")),
+ new LayoutOption ("query-artist", Catalog.GetString ("Artist Name")),
+ new LayoutOption ("query-album", Catalog.GetString ("Album Title")),
+ new LayoutOption ("query-title", Catalog.GetString ("Track Title")),
+ new LayoutOption ("query-duration", Catalog.GetString ("Duration")),
+ new LayoutOption ("query-track-number", Catalog.GetString ("Track Number")),
+ new LayoutOption ("query-track-count", Catalog.GetString ("Track Count")),
+ new LayoutOption ("query-disc", Catalog.GetString ("Disc Number")),
+ new LayoutOption ("query-year", Catalog.GetString ("Year")),
+ new LayoutOption ("query-rating", Catalog.GetString ("Rating"))
+ ),
+
+ new LayoutGroup ("ui", Catalog.GetString ("User Interface Options"),
+ new LayoutOption ("show|--present", Catalog.GetString ("Present the user interface on the active workspace")),
+ new LayoutOption ("hide", Catalog.GetString ("Hide the user interface")),
+ new LayoutOption ("no-present", Catalog.GetString ("Do not present the user interface, regardless of any other options"))
+ ),
+
+ new LayoutGroup ("debugging", Catalog.GetString ("Debugging and Development Options"),
+ new LayoutOption ("debug", Catalog.GetString ("Enable general debugging features")),
+ new LayoutOption ("debug-sql", Catalog.GetString ("Enable debugging output of SQL queries")),
+ new LayoutOption ("debug-addins", Catalog.GetString ("Enable debugging output of Mono.Addins")),
+ new LayoutOption ("db=FILE", Catalog.GetString ("Specify an alternate database to use")),
+ new LayoutOption ("uninstalled", Catalog.GetString ("Optimize instance for running uninstalled; " +
+ "most notably, this will create an alternate Mono.Addins database in the working directory")),
+ new LayoutOption ("disable-dbus", Catalog.GetString ("Disable DBus support completely")),
+ new LayoutOption ("no-gtkrc", String.Format (Catalog.GetString (
+ "Skip loading a custom gtkrc file ({0}) if it exists"),
+ user_gtkrc.Replace (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "~")))
+ )
+ );
+
+ if (ApplicationContext.CommandLine.Contains ("help-all")) {
+ Console.WriteLine (commands);
+ return;
+ }
+
+ List<string> errors = null;
+
+ foreach (KeyValuePair<string, string> argument in ApplicationContext.CommandLine.Arguments) {
+ switch (argument.Key) {
+ case "help": Console.WriteLine (commands.ToString ("help")); break;
+ case "help-debug": Console.WriteLine (commands.ToString ("debugging")); break;
+ case "help-query-track": Console.WriteLine (commands.ToString ("query-track")); break;
+ case "help-query-player": Console.WriteLine (commands.ToString ("query-player")); break;
+ case "help-ui": Console.WriteLine (commands.ToString ("ui")); break;
+ case "help-playback": Console.WriteLine (commands.ToString ("playback")); break;
+ default:
+ if (argument.Key.StartsWith ("help")) {
+ (errors ?? errors = new List<string> ()).Add (argument.Key);
+ }
+ break;
+ }
+ }
+
+ if (errors != null) {
+ Console.WriteLine (commands.LayoutLine (String.Format (Catalog.GetString (
+ "The following help arguments are invalid: {0}"),
+ Hyena.Collections.CollectionExtensions.Join (errors, "--", null, ", "))));
+ }
+ }
+
+ private static void ShowVersion ()
+ {
+ Console.WriteLine ("Banshee {0} ({1}) http://banshee-project.org", Application.DisplayVersion, Application.Version);
+ Console.WriteLine ("Copyright 2005-{0} Novell, Inc. and Contributors.", DateTime.Now.Year);
+ }
- public static void Entry<T> () where T : GtkBaseClient
+ public static void Startup<T> () where T : GtkBaseClient
{
if (client_type != null) {
throw new ApplicationException ("Only a single GtkBaseClient can be initialized through Entry<T>");
}
- client_type = typeof (T);
+ client_type = typeof (T);
Hyena.Gui.CleanRoomStartup.Startup (Startup);
}
Added: branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui/PersistentWindowController.cs
==============================================================================
--- (empty file)
+++ branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.Gui/PersistentWindowController.cs Thu Aug 28 22:43:32 2008
@@ -0,0 +1,187 @@
+//
+// PersistentWindowController.cs
+//
+// Authors:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 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 Banshee.Configuration;
+
+namespace Banshee.Gui
+{
+ [Flags]
+ public enum WindowPersistOptions
+ {
+ Size = 1,
+ Position = 2,
+ All = Size | Position
+ }
+
+ public class PersistentWindowController
+ {
+ private Gtk.Window window;
+ private WindowPersistOptions options;
+ private uint timer_id = 0;
+ private bool pending_changes;
+
+ public PersistentWindowController (Gtk.Window window, string configNameSpace, int defaultWidth, int defaultHeight, WindowPersistOptions options)
+ {
+ this.window = window;
+ this.options = options;
+
+ window.Events = Gdk.EventMask.AllEventsMask;
+
+ WidthSchema = new SchemaEntry<int>(
+ configNameSpace, "width",
+ defaultWidth,
+ "Window Width",
+ "Width of the main interface window."
+ );
+
+ HeightSchema = new SchemaEntry<int>(
+ configNameSpace, "height",
+ defaultHeight,
+ "Window Height",
+ "Height of the main interface window."
+ );
+
+ XPosSchema = new SchemaEntry<int>(
+ configNameSpace, "x_pos",
+ 0,
+ "Window Position X",
+ "Pixel position of Main Player Window on the X Axis"
+ );
+
+ YPosSchema = new SchemaEntry<int>(
+ configNameSpace, "y_pos",
+ 0,
+ "Window Position Y",
+ "Pixel position of Main Player Window on the Y Axis"
+ );
+
+ MaximizedSchema = new SchemaEntry<bool>(
+ configNameSpace, "maximized",
+ false,
+ "Window Maximized",
+ "True if main window is to be maximized, false if it is not."
+ );
+
+ window.ConfigureEvent += OnChanged;
+ window.WindowStateEvent += OnChanged;
+ window.DestroyEvent += OnDestroy;
+ }
+
+ private void OnDestroy (object o, EventArgs args)
+ {
+ window.DestroyEvent -= OnDestroy;
+ window.ConfigureEvent -= OnChanged;
+ window.StateChanged -= OnChanged;
+ }
+
+ [GLib.ConnectBefore]
+ private void OnChanged (object o, EventArgs args)
+ {
+ Save ();
+ }
+
+ public void Restore ()
+ {
+ if ((options & WindowPersistOptions.Size) != 0) {
+ int width = WidthSchema.Get ();
+ int height = HeightSchema.Get ();
+
+ if (width != 0 && height != 0) {
+ window.Resize (width, height);
+ }
+ }
+
+ if ((options & WindowPersistOptions.Position) != 0) {
+ int x = XPosSchema.Get ();
+ int y = YPosSchema.Get ();
+
+ if (x == 0 && y == 0) {
+ window.SetPosition (Gtk.WindowPosition.Center);
+ } else {
+ window.Move (x, y);
+ }
+ }
+
+ if ((options & WindowPersistOptions.Size) != 0) {
+ if (MaximizedSchema.Get ()) {
+ window.Maximize ();
+ } else {
+ window.Unmaximize ();
+ }
+ }
+ }
+
+ public void Save ()
+ {
+ if (timer_id == 0) {
+ timer_id = GLib.Timeout.Add (500, OnTimeout);
+ } else {
+ pending_changes = true;
+ }
+ }
+
+ private bool OnTimeout ()
+ {
+ if (pending_changes) {
+ pending_changes = false;
+ return true;
+ } else {
+ InnerSave ();
+ timer_id = 0;
+ return false;
+ }
+ }
+
+ private void InnerSave ()
+ {
+ int x, y, width, height;
+
+ if ((window.GdkWindow.State & Gdk.WindowState.Maximized) != 0) {
+ MaximizedSchema.Set (true);
+ return;
+ }
+
+ window.GetPosition (out x, out y);
+ window.GetSize (out width, out height);
+
+ MaximizedSchema.Set (false);
+ XPosSchema.Set (x);
+ YPosSchema.Set (y);
+ WidthSchema.Set (width);
+ HeightSchema.Set (height);
+ }
+
+ private SchemaEntry<int> WidthSchema;
+ private SchemaEntry<int> HeightSchema;
+ private SchemaEntry<int> XPosSchema;
+ private SchemaEntry<int> YPosSchema;
+ private SchemaEntry<bool> MaximizedSchema;
+ }
+}
Modified: branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp
==============================================================================
--- branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp (original)
+++ branches/banshee/gburt/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp Thu Aug 28 22:43:32 2008
@@ -120,6 +120,8 @@
<File name="Banshee.Gui.Widgets/ClassicTrackInfoDisplay.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Library.Gui/PhotoFolderImportSource.cs" subtype="Code" buildaction="Compile" />
<File name="Banshee.Gui.Widgets/LargeTrackInfoDisplay.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.Collection.Gui/BaseTrackListView.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.Gui/PersistentWindowController.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Project" localcopy="False" refto="Hyena.Gui" />
Modified: branches/banshee/gburt/src/Core/Banshee.ThickClient/Makefile.am
==============================================================================
--- branches/banshee/gburt/src/Core/Banshee.ThickClient/Makefile.am (original)
+++ branches/banshee/gburt/src/Core/Banshee.ThickClient/Makefile.am Thu Aug 28 22:43:32 2008
@@ -11,6 +11,7 @@
Banshee.Collection.Gui/ArtistListView.cs \
Banshee.Collection.Gui/ArtworkManager.cs \
Banshee.Collection.Gui/ArtworkRenderer.cs \
+ Banshee.Collection.Gui/BaseTrackListView.cs \
Banshee.Collection.Gui/ColumnCellAlbum.cs \
Banshee.Collection.Gui/ColumnCellDateTime.cs \
Banshee.Collection.Gui/ColumnCellDuration.cs \
@@ -73,6 +74,7 @@
Banshee.Gui/IHasSourceView.cs \
Banshee.Gui/InterfaceActionService.cs \
Banshee.Gui/PersistentPaneController.cs \
+ Banshee.Gui/PersistentWindowController.cs \
Banshee.Gui/PlaybackActions.cs \
Banshee.Gui/PlaybackRepeatActions.cs \
Banshee.Gui/PlaybackShuffleActions.cs \
Modified: branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
==============================================================================
--- branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs (original)
+++ branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs Thu Aug 28 22:43:32 2008
@@ -35,7 +35,7 @@
namespace Hyena.Data.Gui
{
- public class ColumnCellText : ColumnCell, ISizeRequestCell
+ public class ColumnCellText : ColumnCell, ISizeRequestCell, ITextCell
{
public delegate string DataHandler ();
@@ -68,13 +68,9 @@
context.Context.MoveTo (4, ((int)cellHeight - text_height) / 2);
Cairo.Color color = context.Theme.Colors.GetWidgetColor (
context.TextAsForeground ? GtkColorClass.Foreground : GtkColorClass.Text, state);
- if (!context.Sensitive) {
- color.A = 0.3;
- } else {
- color.A = opacity;
- }
-
+ color.A = (!context.Sensitive) ? 0.3 : opacity;
context.Context.Color = color;
+
PangoCairoHelper.ShowLayout (context.Context, context.Layout);
}
Added: branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ITextCell.cs
==============================================================================
--- (empty file)
+++ branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ITextCell.cs Thu Aug 28 22:43:32 2008
@@ -0,0 +1,38 @@
+//
+// ITextCell.cs
+//
+// Author:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 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;
+
+namespace Hyena.Data.Gui
+{
+ public interface ITextCell
+ {
+ Pango.Weight FontWeight { get; set; }
+ }
+}
Modified: branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
==============================================================================
--- branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs (original)
+++ branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs Thu Aug 28 22:43:32 2008
@@ -329,7 +329,7 @@
cell.BindListItem (item);
ColumnCellDataProvider (cell, item);
- ColumnCellText text_cell = cell as ColumnCellText;
+ ITextCell text_cell = cell as ITextCell;
if (text_cell != null) {
text_cell.FontWeight = bold ? Pango.Weight.Bold : Pango.Weight.Normal;
}
Modified: branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Gui.mdp
==============================================================================
--- branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Gui.mdp (original)
+++ branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Gui.mdp Thu Aug 28 22:43:32 2008
@@ -84,6 +84,8 @@
<File name="Hyena.Gui/RatingRenderer.cs" subtype="Code" buildaction="Compile" />
<File name="Hyena.Data.Gui/ListView/ListViewBase.cs" subtype="Code" buildaction="Compile" />
<File name="Hyena.Gui/GtkWorkarounds.cs" subtype="Code" buildaction="Compile" />
+ <File name="Hyena.Widgets/ImageButton.cs" subtype="Code" buildaction="Compile" />
+ <File name="Hyena.Data.Gui/ITextCell.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Added: branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Widgets/ImageButton.cs
==============================================================================
--- (empty file)
+++ branches/banshee/gburt/src/Libraries/Hyena.Gui/Hyena.Widgets/ImageButton.cs Thu Aug 28 22:43:32 2008
@@ -0,0 +1,59 @@
+//
+// ImageButton.cs
+//
+// Authors:
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2008 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 Gtk;
+
+namespace Hyena.Widgets
+{
+ public class ImageButton : Button
+ {
+ public ImageButton (string text, string iconName) : this (text, iconName, Gtk.IconSize.Button)
+ {
+ }
+
+ public ImageButton (string text, string iconName, Gtk.IconSize iconSize) : base ()
+ {
+ Image image = new Image ();
+ image.IconName = iconName;
+ image.IconSize = (int) iconSize;
+
+ Label label = new Label ();
+ label.Markup = text;
+
+ HBox hbox = new HBox ();
+ hbox.Spacing = 2;
+ hbox.PackStart (image, false, false, 0);
+ hbox.PackStart (label, false, false, 0);
+
+ Child = hbox;
+ CanDefault = true;
+ ShowAll ();
+ }
+ }
+}
Modified: branches/banshee/gburt/src/Libraries/Hyena.Gui/Makefile.am
==============================================================================
--- branches/banshee/gburt/src/Libraries/Hyena.Gui/Makefile.am (original)
+++ branches/banshee/gburt/src/Libraries/Hyena.Gui/Makefile.am Thu Aug 28 22:43:32 2008
@@ -14,6 +14,7 @@
Hyena.Data.Gui/IInteractiveCell.cs \
Hyena.Data.Gui/IListView.cs \
Hyena.Data.Gui/ISizeRequestCell.cs \
+ Hyena.Data.Gui/ITextCell.cs \
Hyena.Data.Gui/ListView/ListView.cs \
Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs \
Hyena.Data.Gui/ListView/ListView_Header.cs \
@@ -69,6 +70,7 @@
Hyena.Widgets/AnimatedVBox.cs \
Hyena.Widgets/AnimatedWidget.cs \
Hyena.Widgets/ComplexMenuItem.cs \
+ Hyena.Widgets/ImageButton.cs \
Hyena.Widgets/MenuButton.cs \
Hyena.Widgets/MessageBar.cs \
Hyena.Widgets/RatingEntry.cs \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]