[banshee] [MeeGo] Overhaul of the panel, fix integration
- From: Aaron Bockover <abock src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [MeeGo] Overhaul of the panel, fix integration
- Date: Tue, 23 Mar 2010 00:54:41 +0000 (UTC)
commit 6bf75c2c3a37ab72c8865b10b78fbd67aff93af0
Author: Aaron Bockover <abockover novell com>
Date: Mon Mar 22 20:48:02 2010 -0400
[MeeGo] Overhaul of the panel, fix integration
This is the first drop of the re-designed MeeGo panel. This version
acts more like the main player UI, allowing the user to change sources
directly in the panel and interact with content (no longer just the
play queue). The grid view is used for displaying the album filter
if a source has one.
build/m4/banshee/meego.m4 | 2 -
.../Banshee.Gui/GtkBaseClient.cs | 3 +
.../Banshee.Sources.Gui/SourceComboBox.cs | 4 +
.../Banshee.Sources.Gui/SourceModel.cs | 6 +
src/Extensions/Banshee.MeeGo/Banshee.MeeGo.csproj | 10 +-
.../Banshee.MeeGo/MediaPanelContents.cs | 177 +++++++++++++++++---
.../Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs | 24 ++--
.../Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs | 13 +--
.../Banshee.MeeGo/Banshee.MeeGo/PlayQueueBox.cs | 95 -----------
.../Banshee.MeeGo/Banshee.MeeGo/PlaybackBox.cs | 2 +-
.../Banshee.MeeGo/RecentAlbumsList.cs | 100 -----------
.../Banshee.MeeGo/RecentAlbumsView.cs | 146 ----------------
.../Banshee.MeeGo/Banshee.MeeGo/SearchHeader.cs | 92 ----------
src/Extensions/Banshee.MeeGo/Makefile.am | 19 +--
.../Banshee.MeeGo/MeeGo.Panel/PanelClient.cs | 8 +-
.../meego-panel-banshee.desktop.in.in | 2 +-
16 files changed, 196 insertions(+), 507 deletions(-)
---
diff --git a/build/m4/banshee/meego.m4 b/build/m4/banshee/meego.m4
index 44b79f2..eceebe3 100644
--- a/build/m4/banshee/meego.m4
+++ b/build/m4/banshee/meego.m4
@@ -4,8 +4,6 @@ AC_DEFUN([BANSHEE_CHECK_MEEGO],
if test "x$enable_meego" = "xyes"; then
AM_CONDITIONAL(HAVE_MEEGO, true)
- MEEGO_PANELS_DIR=`$PKG_CONFIG --variable=moblin_panel_panels_dir moblin-panel`
- AC_SUBST(MEEGO_PANELS_DIR)
else
AM_CONDITIONAL(HAVE_MEEGO, false)
fi
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
index dcefd27..0e3f988 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs
@@ -93,6 +93,8 @@ namespace Banshee.Gui
protected virtual void InitializeGtk ()
{
+ Log.Debug ("Initializing GTK");
+
if (!GLib.Thread.Supported) {
GLib.Thread.Init ();
}
@@ -176,6 +178,7 @@ namespace Banshee.Gui
public virtual void Run ()
{
RunIdle (delegate { OnStarted (); return false; });
+ Log.Debug ("Starting GTK main loop");
Gtk.Application.Run ();
}
diff --git a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceComboBox.cs b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceComboBox.cs
index 590620f..954dec8 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceComboBox.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceComboBox.cs
@@ -39,6 +39,10 @@ namespace Banshee.Sources.Gui
public class SourceComboBox : ComboBox
{
private SourceModel store;
+ public new SourceModel Model {
+ get { return store; }
+ private set { base.Model = value; }
+ }
public SourceComboBox ()
{
diff --git a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceModel.cs b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceModel.cs
index 62fcb72..904d915 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceModel.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceModel.cs
@@ -71,6 +71,8 @@ namespace Banshee.Sources.Gui
public event SourceRowEventHandler SourceRowInserted;
public event SourceRowEventHandler SourceRowRemoved;
+ public Predicate<Source> Filter { get; set; }
+
public SourceModel () : base (typeof (Source), typeof (int), typeof (bool))
{
SetSortColumnId (1, SortType.Ascending);
@@ -213,6 +215,10 @@ namespace Banshee.Sources.Gui
public void AddSource (Source source, TreeIter parent)
{
lock (sync) {
+ if (Filter != null && !Filter (source)) {
+ return;
+ }
+
// Don't add duplicates
if (!FindSource (source).Equals (TreeIter.Zero)) {
return;
diff --git a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo.csproj b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo.csproj
index cedd4d8..9fb4413 100644
--- a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo.csproj
+++ b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo.csproj
@@ -82,18 +82,14 @@
<ItemGroup>
<Compile Include="MeeGo.Panel\PanelClient.cs" />
<Compile Include="MeeGo.Panel\PanelGtk.cs" />
- <Compile Include="MeeGo.Panel\SetSizeHandler.cs" />
- <Compile Include="MeeGo.Panel\SetPositionHandler.cs" />
+ <Compile Include="MeeGo.Panel\SetSizeHandler.cs" />
+ <Compile Include="MeeGo.Panel\SetPositionHandler.cs" />
<Compile Include="MeeGo.Panel\PanelButtonState.cs" />
<Compile Include="Banshee.MeeGo\MeeGoService.cs" />
<Compile Include="Banshee.MeeGo\MediaPanelContents.cs" />
- <Compile Include="Banshee.MeeGo\SearchEntry.cs" />
- <Compile Include="Banshee.MeeGo\SearchHeader.cs" />
- <Compile Include="Banshee.MeeGo\PlayQueueBox.cs" />
+ <Compile Include="Banshee.MeeGo\SearchEntry.cs" />
<Compile Include="Banshee.MeeGo\PlaybackBox.cs" />
<Compile Include="Banshee.MeeGo\MeeGoTrackInfoDisplay.cs" />
- <Compile Include="Banshee.MeeGo\RecentAlbumsList.cs" />
<Compile Include="Banshee.MeeGo\MeeGoPanel.cs" />
- <Compile Include="Banshee.MeeGo\RecentAlbumsView.cs" />
</ItemGroup>
</Project>
diff --git a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MediaPanelContents.cs b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MediaPanelContents.cs
index 4636afd..1822900 100644
--- a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MediaPanelContents.cs
+++ b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MediaPanelContents.cs
@@ -28,51 +28,144 @@ using System;
using Gtk;
using Mono.Unix;
+// using Banshee.PlayQueue;
+
+using Hyena;
+using Hyena.Gui;
using Hyena.Data.Gui;
-using Banshee.Collection.Gui;
using Banshee.ServiceStack;
using Banshee.Sources;
-using Banshee.PlayQueue;
+using Banshee.Sources.Gui;
+using Banshee.Collection;
+using Banshee.Collection.Gui;
+using Banshee.Collection.Database;
namespace Banshee.MeeGo
{
- public class MediaPanelContents : HBox
+ public class MediaPanelContents : Table
{
- public MediaPanelContents () : base ()
+ private SourceComboBox source_combo_box;
+ private HBox header_box;
+ private SearchEntry search_entry;
+ private AlbumListView album_view;
+ private TerseTrackListView track_view;
+
+ public MediaPanelContents () : base (1, 2, false)
{
- BuildViews ();
- BorderWidth = 10;
- Spacing = 10;
+ BorderWidth = 12;
+ RowSpacing = 15;
+ ColumnSpacing = 15;
}
- private void BuildViews ()
+ public void BuildViews ()
{
- var left = new VBox () { Spacing = 10 };
- left.PackStart (new SearchHeader (), false, false, 0);
-
- left.PackStart (new Label () {
- Xalign = 0.0f,
- Xpad = 10,
- Markup = String.Format ("<b><big>{0}</big></b>",
- GLib.Markup.EscapeText (Catalog.GetString ("Most Recently Played")))
- }, false, false, 0);
- left.PackStart (new RecentAlbumsView (), false, false, 0);
-
- var button = new Button (Catalog.GetString ("Music Library"));
+ header_box = new HBox () {
+ Spacing = 5,
+ BorderWidth = 5
+ };
+ header_box.PackStart (source_combo_box = new SourceComboBox (), false, false, 0);
+ var button = new Button (new Image () {
+ IconSize = (int)IconSize.LargeToolbar,
+ IconName = "media-player-banshee"
+ }) {
+ TooltipText = Catalog.GetString ("Launch the Banshee Media Player")
+ };
button.Clicked += (o, e) => {
ServiceManager.SourceManager.SetActiveSource (ServiceManager.SourceManager.MusicLibrary);
ServiceManager.Get<MeeGoService> ().PresentPrimaryInterface ();
};
- var hbox = new HBox ();
- hbox.PackStart (button, false, false, 0);
- hbox.ShowAll ();
- left.PackStart (hbox, false, false, 0);
+ header_box.PackStart (button, false, false, 0);
+ header_box.PackStart (search_entry = new SearchEntry () { Ready = true }, true, true, 0);
+ Attach (header_box, 0, 1, 0, 1,
+ AttachOptions.Fill | AttachOptions.Expand,
+ AttachOptions.Shrink,
+ 0, 0);
- PackStart (left, true, true, 0);
- PackStart (new PlayQueueBox (), false, false, 0);
+ var scroll = new ScrolledWindow () {
+ VscrollbarPolicy = PolicyType.Always,
+ HscrollbarPolicy = PolicyType.Never,
+ ShadowType = ShadowType.None
+ };
+ scroll.Add (album_view = new AlbumListView ());
+ Attach (scroll, 0, 1, 1, 2,
+ AttachOptions.Fill | AttachOptions.Expand,
+ AttachOptions.Fill | AttachOptions.Expand,
+ 0, 0);
+
+ var side_box = new VBox () { Spacing = 15 };
+
+ side_box.PackStart (new PlaybackBox (), false, false, 0);
+
+ scroll = new ScrolledWindow () {
+ VscrollbarPolicy = PolicyType.Always,
+ HscrollbarPolicy = PolicyType.Never,
+ ShadowType = ShadowType.None
+ };
+ track_view = new TerseTrackListView () {
+ IsReorderable = true
+ };
+ track_view.ColumnController.Insert (new Column (null, "indicator",
+ new ColumnCellStatusIndicator (null), 0.05, true, 20, 20), 0);
+ track_view.ColumnController.Add (new Column ("Rating", new ColumnCellRating ("Rating", false), 0.15));
+ scroll.Add (track_view);
+
+ side_box.PackStart (scroll, true, true, 0);
+
+ side_box.PackStart (new MeeGoTrackInfoDisplay () { HeightRequest = 64 }, false, false, 0);
+ Attach (side_box, 1, 2, 0, 2,
+ AttachOptions.Shrink,
+ AttachOptions.Fill | AttachOptions.Expand,
+ 0, 0);
ShowAll ();
+
+ source_combo_box.UpdateActiveSource ();
+ source_combo_box.Model.Filter = (source) => source is ITrackModelSource;
+ search_entry.Changed += OnSearchEntryChanged;
+ ServiceManager.SourceManager.ActiveSourceChanged += OnActiveSourceChanged;
+ }
+
+ private void OnSearchEntryChanged (object o, EventArgs args)
+ {
+ var source = ServiceManager.SourceManager.ActiveSource;
+ if (source == null) {
+ return;
+ }
+
+ source.FilterType = (TrackFilterType)search_entry.ActiveFilterID;
+ source.FilterQuery = search_entry.Query;
+ }
+
+ private void OnActiveSourceChanged (SourceEventArgs args)
+ {
+ ThreadAssist.ProxyToMain (delegate {
+ var source = ServiceManager.SourceManager.ActiveSource;
+ var track_source = source as ITrackModelSource;
+ var filter_source = source as IFilterableSource;
+
+ if (track_source == null) {
+ return;
+ }
+
+ track_view.SetModel (track_source.TrackModel);
+
+ if (filter_source == null) {
+ album_view.Parent.Hide ();
+ return;
+ }
+
+ foreach (var filter in filter_source.CurrentFilters) {
+ var album_filter = filter as DatabaseAlbumListModel;
+ if (album_filter != null) {
+ album_view.Parent.Show ();
+ album_view.SetModel (album_filter);
+ return;
+ }
+ }
+
+ album_view.Parent.Hide ();
+ });
}
protected override void OnParentSet (Widget previous)
@@ -83,5 +176,37 @@ namespace Banshee.MeeGo
Parent.ModifyBg (StateType.Normal, Style.White);
}
}
+
+ protected override bool OnExposeEvent (Gdk.EventExpose evnt)
+ {
+ if (!Visible || !IsMapped) {
+ return true;
+ }
+
+ RenderBackground (evnt.Window, evnt.Region);
+ foreach (var child in Children) {
+ PropagateExpose (child, evnt);
+ }
+
+ return true;
+ }
+
+ private void RenderBackground (Gdk.Window window, Gdk.Region region)
+ {
+ var cr = Gdk.CairoHelper.Create (window);
+ cr.Color = new Cairo.Color (0xe7 / (double)0xff,
+ 0xea / (double)0xff, 0xfd / (double)0xff);
+
+ CairoExtensions.RoundedRectangle (cr,
+ header_box.Allocation.X,
+ header_box.Allocation.Y,
+ header_box.Allocation.Width,
+ header_box.Allocation.Height,
+ 5);
+
+ cr.Fill ();
+
+ CairoExtensions.DisposeContext (cr);
+ }
}
}
diff --git a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs
index a11da7b..cee7659 100644
--- a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs
+++ b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoPanel.cs
@@ -39,10 +39,9 @@ namespace Banshee.MeeGo
public static MeeGoPanel Instance { get; private set; }
public PanelGtk ToolbarPanel { get; private set; }
- public Container ParentContainer { get; private set; }
-
public uint ToolbarPanelWidth { get; private set; }
public uint ToolbarPanelHeight { get; private set; }
+ public MediaPanelContents Contents { get; private set; }
public MeeGoPanel ()
{
@@ -63,23 +62,24 @@ namespace Banshee.MeeGo
private void BuildPanel ()
{
try {
- ToolbarPanel = new PanelGtk ("media", "media", null, "media-button", true);
- ParentContainer = ToolbarPanel.Window;
- ParentContainer.ModifyBg (StateType.Normal, ParentContainer.Style.White);
- ToolbarPanel.SetSizeEvent += (o, e) => {
- ToolbarPanelWidth = e.Width;
- ToolbarPanelHeight = e.Height;
+ ToolbarPanel = new PanelGtk ("banshee", "media", null, "media-button", true);
+ ToolbarPanel.ReadyEvent += (o, e) => {
+ Contents = new MediaPanelContents ();
+ Contents.ShowAll ();
+ ToolbarPanel.SetChild (Contents);
};
} catch (Exception e) {
Log.Exception ("Could not bind to MeeGo panel", e);
-
var window = new Gtk.Window ("MeeGo Media Panel");
window.SetDefaultSize (1000, 500);
window.WindowPosition = Gtk.WindowPosition.Center;
- ParentContainer = window;
+ window.Add (Contents = new MediaPanelContents ());
+ window.ShowAll ();
+ GLib.Timeout.Add (1000, () => {
+ window.Present ();
+ return false;
+ });
}
-
- ParentContainer.ShowAll ();
}
}
}
diff --git a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs
index a268548..eea39eb 100644
--- a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs
+++ b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs
@@ -110,18 +110,7 @@ namespace Banshee.MeeGo
return;
}
- var container = MeeGoPanel.Instance.ParentContainer;
- foreach (var child in container.Children) {
- container.Remove (child);
- }
- container.Add (new MediaPanelContents ());
- container.ShowAll ();
-
- if (MeeGoPanel.Instance.ToolbarPanel != null) {
- container.SetSizeRequest (
- (int)MeeGoPanel.Instance.ToolbarPanelWidth,
- (int)MeeGoPanel.Instance.ToolbarPanelHeight);
- }
+ MeeGoPanel.Instance.Contents.BuildViews ();
elements_service.PrimaryWindowClose = () => {
elements_service.PrimaryWindow.Hide ();
diff --git a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/PlaybackBox.cs b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/PlaybackBox.cs
index c39b318..1debcbf 100644
--- a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/PlaybackBox.cs
+++ b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/PlaybackBox.cs
@@ -42,7 +42,7 @@ namespace Banshee.MeeGo
PackStart (action_service.PlaybackActions["PreviousAction"].CreateToolItem (), false, false, 0);
PackStart (action_service.PlaybackActions["PlayPauseAction"].CreateToolItem (), false, false, 0);
- PackStart (new NextButton (action_service), false, false, 0);
+ PackStart (new NextButton (action_service, true), false, false, 0);
var seek_slider = new ConnectedSeekSlider ();
seek_slider.Show ();
diff --git a/src/Extensions/Banshee.MeeGo/Makefile.am b/src/Extensions/Banshee.MeeGo/Makefile.am
index 71129e4..ba7b0bd 100644
--- a/src/Extensions/Banshee.MeeGo/Makefile.am
+++ b/src/Extensions/Banshee.MeeGo/Makefile.am
@@ -11,16 +11,12 @@ SOURCES = \
Banshee.MeeGo/MeeGoService.cs \
Banshee.MeeGo/MeeGoTrackInfoDisplay.cs \
Banshee.MeeGo/PlaybackBox.cs \
- Banshee.MeeGo/PlayQueueBox.cs \
- Banshee.MeeGo/RecentAlbumsList.cs \
- Banshee.MeeGo/RecentAlbumsView.cs \
Banshee.MeeGo/SearchEntry.cs \
- Banshee.MeeGo/SearchHeader.cs \
+ MeeGo.Panel/PanelButtonState.cs \
MeeGo.Panel/PanelClient.cs \
MeeGo.Panel/PanelGtk.cs \
- MeeGo.Panel/SetSizeHandler.cs \
MeeGo.Panel/SetPositionHandler.cs \
- MeeGo.Panel/PanelButtonState.cs
+ MeeGo.Panel/SetSizeHandler.cs
RESOURCES = Banshee.MeeGo.addin.xml
@@ -30,19 +26,18 @@ include $(top_srcdir)/build/build.mk
module_SCRIPTS += Banshee.MeeGo.dll.config
-paneldir = $(libdir)/mutter-moblin
+paneldir = $(libexecdir)
panel_SCRIPTS = meego-panel-banshee
servicedir = $(datadir)/dbus-1/services
service_DATA = org.moblin.UX.Shell.Panels.banshee.service
org.moblin.UX.Shell.Panels.banshee.service: org.moblin.UX.Shell.Panels.banshee.service.in $(top_builddir)/config.log
- sed -e "s|\ libexecdir\@|$(libdir)/mutter-moblin|" $< > $@
-
-desktopfiles_in_files=meego-panel-banshee.desktop.in
-desktopfiles_files=$(desktopfiles_in_files:.desktop.in=.desktop)
+ sed -e "s|\ libexecdir\@|$(libexecdir)|" $< > $@
-desktopfilesdir=$(MEEGO_PANELS_DIR)/
+desktopfiles_in_files = meego-panel-banshee.desktop.in
+desktopfiles_files = $(desktopfiles_in_files:.desktop.in=.desktop)
+desktopfilesdir = $(datadir)/mutter-moblin/panels
desktopfiles_DATA = $(desktopfiles_files)
%.desktop.in: %.desktop.in.in Makefile
diff --git a/src/Extensions/Banshee.MeeGo/MeeGo.Panel/PanelClient.cs b/src/Extensions/Banshee.MeeGo/MeeGo.Panel/PanelClient.cs
index 4a58090..027e114 100644
--- a/src/Extensions/Banshee.MeeGo/MeeGo.Panel/PanelClient.cs
+++ b/src/Extensions/Banshee.MeeGo/MeeGo.Panel/PanelClient.cs
@@ -153,11 +153,17 @@ namespace MeeGo.Panel
}
[GLib.Signal ("unload")]
- public event SetSizeHandler UnloadEvent {
+ public event EventHandler UnloadEvent {
add { GLib.Signal.Lookup (this, "unload").AddDelegate (value); }
remove { GLib.Signal.Lookup (this, "unload").RemoveDelegate (value); }
}
+ [GLib.Signal ("ready")]
+ public event EventHandler ReadyEvent {
+ add { GLib.Signal.Lookup (this, "ready").AddDelegate (value); }
+ remove { GLib.Signal.Lookup (this, "ready").RemoveDelegate (value); }
+ }
+
[GLib.Signal ("set-size")]
public event SetSizeHandler SetSizeEvent {
add { GLib.Signal.Lookup (this, "set-size", typeof (SetSizeArgs)).AddDelegate (value); }
diff --git a/src/Extensions/Banshee.MeeGo/meego-panel-banshee.desktop.in.in b/src/Extensions/Banshee.MeeGo/meego-panel-banshee.desktop.in.in
index 068ef53..850e052 100644
--- a/src/Extensions/Banshee.MeeGo/meego-panel-banshee.desktop.in.in
+++ b/src/Extensions/Banshee.MeeGo/meego-panel-banshee.desktop.in.in
@@ -1,7 +1,7 @@
[Desktop Entry]
Type=Application
Exec= libexecdir@/meego-panel-banshee
-_Name=media
+_Name=banshee
_Comment=Quick access panel for your media
OnlyShowIn=MOBLIN
X-Moblin-Priority=Low
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]