[banshee] [MeeGo] customize the Nereid client UI
- From: Aaron Bockover <abock src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [MeeGo] customize the Nereid client UI
- Date: Sun, 21 Mar 2010 23:39:52 +0000 (UTC)
commit 7365da698d49164b2fef2b695acf04d506125f31
Author: Aaron Bockover <abockover novell com>
Date: Sat Mar 20 11:15:53 2010 -0400
[MeeGo] customize the Nereid client UI
When running on MeeGo, provide some customizations to make the
main client interface more natural to the MeeGo environment:
- Remove the main menu
- Remove the volume control
- Create a toolbar menu item containing a minimal number of
items (import, open, new playlist, preferences...)
- Set the toolbar style to "moblin-toolbar" so it is properly themed
- Add a close button to the right side of the toolbar
The old Moblin Nereid UI hacks have been completely removed; the MeeGo
service extension will now simply ensure volume is set to 100% and the
Nereid window is not decorated and remains maximized.
src/Clients/Nereid/Nereid/PlayerInterface.cs | 24 ++++++-
.../Resources/core-ui-actions-layout.xml | 16 +++++
.../Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs | 64 +++----------------
3 files changed, 46 insertions(+), 58 deletions(-)
---
diff --git a/src/Clients/Nereid/Nereid/PlayerInterface.cs b/src/Clients/Nereid/Nereid/PlayerInterface.cs
index d23df86..4ff2704 100644
--- a/src/Clients/Nereid/Nereid/PlayerInterface.cs
+++ b/src/Clients/Nereid/Nereid/PlayerInterface.cs
@@ -159,7 +159,7 @@ namespace Nereid
main_menu = new MainMenu ();
- if (!PlatformDetection.IsMac) {
+ if (!PlatformDetection.IsMac && !PlatformDetection.IsMeeGo) {
main_menu.Show ();
header_table.Attach (main_menu, 0, 1, 0, 1,
AttachOptions.Expand | AttachOptions.Fill,
@@ -167,7 +167,7 @@ namespace Nereid
}
Alignment toolbar_alignment = new Alignment (0.0f, 0.0f, 1.0f, 1.0f);
- toolbar_alignment.TopPadding = 3;
+ toolbar_alignment.TopPadding = PlatformDetection.IsMeeGo ? 0u : 3u;
toolbar_alignment.BottomPadding = 3;
header_toolbar = (Toolbar)ActionService.UIManager.GetWidget ("/HeaderToolbar");
@@ -175,6 +175,10 @@ namespace Nereid
header_toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
header_toolbar.Show ();
+ if (PlatformDetection.IsMeeGo) {
+ header_toolbar.Name = "moblin-toolbar";
+ }
+
toolbar_alignment.Add (header_toolbar);
toolbar_alignment.Show ();
@@ -196,7 +200,19 @@ namespace Nereid
editable.Show ();
ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/TrackInfoDisplay", editable, true);
- if (!PlatformDetection.IsMoblin) {
+ if (PlatformDetection.IsMeeGo) {
+ var menu = (Menu)(ServiceManager.Get<InterfaceActionService> ().UIManager.GetWidget ("/ToolbarMenu"));
+ var menu_button = new Hyena.Widgets.MenuButton (new Image (Stock.Preferences, IconSize.LargeToolbar), menu, true);
+ menu_button.Show ();
+ ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/ToolbarMenuPlaceholder", menu_button);
+
+ var close_button = new ToolButton (Stock.Close);
+ close_button.Clicked += (o, e) => Hide ();
+ close_button.Show ();
+ ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/ClosePlaceholder", close_button);
+
+ ServiceManager.PlayerEngine.Volume = 100;
+ } else {
var volume_button = new ConnectedVolumeButton ();
volume_button.Show ();
ActionService.PopulateToolbarPlaceholder (header_toolbar, "/HeaderToolbar/VolumeButton", volume_button);
@@ -342,7 +358,7 @@ namespace Nereid
}
};
- if (!PlatformDetection.IsMoblin) {
+ if (!PlatformDetection.IsMeeGo) {
header_toolbar.ExposeEvent += OnToolbarExposeEvent;
}
}
diff --git a/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml b/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
index 5621503..b544996 100644
--- a/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
+++ b/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
@@ -9,6 +9,8 @@
<toolitem name="RefreshSmartPlaylist" action="RefreshSmartPlaylistAction"/>
</placeholder>
<placeholder name="VolumeButton"/>
+ <placeholder name="ToolbarMenuPlaceholder"/>
+ <placeholder name="ClosePlaceholder"/>
</toolbar>
<toolbar name="FooterToolbar">
<placeholder name="TaskStatus"/>
@@ -17,6 +19,20 @@
<placeholder name="RepeatButton"/>
</toolbar>
+ <popup name="ToolbarMenu" action="ToolbarMenuAction">
+ <menuitem name="NewPlaylist" action="NewPlaylistAction"/>
+ <menuitem name="NewSmartPlaylist" action="NewSmartPlaylistAction"/>
+ <separator/>
+ <menuitem name="Import" action="ImportAction"/>
+ <menuitem name="ImportPlaylist" action="ImportPlaylistAction"/>
+ <menuitem name="OpenLocation" action="OpenLocationAction"/>
+ <separator/>
+ <placeholder name="BelowOpenLocation"/>
+ <separator/>
+ <menuitem name="Preferences" action="PreferencesAction"/>
+ <menuitem name="About" action="AboutAction"/>
+ </popup>
+
<menubar name="MainMenu" action="MainMenuAction">
<menu name="MediaMenu" action="MediaMenuAction">
<menuitem name="NewPlaylist" action="NewPlaylistAction"/>
diff --git a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs
index 5366c53..dd481dc 100644
--- a/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs
+++ b/src/Extensions/Banshee.MeeGo/Banshee.MeeGo/MeeGoService.cs
@@ -96,7 +96,16 @@ namespace Banshee.MeeGo
private void Initialize ()
{
- ReflectionHackeryUpTheNereid ();
+ // regular metacity does not seem to like this at all, crashing
+ // and complaining "Window manager warning: Buggy client sent a
+ // _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x2e00020"
+ if (MeeGoPanel.Instance != null) {
+ elements_service.PrimaryWindow.Decorated = false;
+ elements_service.PrimaryWindow.Maximize ();
+ }
+
+ // Set the internal engine volume to 100%
+ ServiceManager.PlayerEngine.Volume = 100;
if (MeeGoPanel.Instance == null) {
return;
@@ -130,59 +139,6 @@ namespace Banshee.MeeGo
ServiceManager.PlayerEngine.ConnectEvent (OnPlayerStateChanged, PlayerEvent.StateChange | PlayerEvent.StartOfStream);
}
- private void ReflectionHackeryUpTheNereid ()
- {
- // This is a horribly abusive method, but hey, this kind
- // of stuff is what Firefox extensions are made of!
-
- // First grab the type and instance of the primary window
- // and make sure we're only hacking the Nereid UI
- var pwin = elements_service.PrimaryWindow;
- var pwin_type = pwin.GetType ();
- if (pwin_type.FullName != "Nereid.PlayerInterface") {
- return;
- }
-
- // regular metacity does not seem to like this at all, crashing
- // and complaining "Window manager warning: Buggy client sent a
- // _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x2e00020"
- if (MeeGoPanel.Instance != null) {
- pwin.Decorated = false;
- pwin.Maximize ();
- }
-
- // Now we want to make the Toolbar work in the MeeGo GTK theme
- var pwin_toolbar = (Toolbar)pwin_type.GetProperty ("HeaderToolbar").GetValue (pwin, null);
- var pwin_toolbar_align = (Alignment)pwin_toolbar.Parent;
- pwin_toolbar_align.TopPadding = 0;
- pwin_toolbar_align.BottomPadding = 6;
-
- // Incredibly ugly hack to pack in a close button in a separate
- // toolbar so that it may be aligned at the top right of the
- // window (appears to float in the menubar)
- var pwin_header_table = (Table)pwin_type.GetProperty ("HeaderTable").GetValue (pwin, null);
-
- var close_button = new Banshee.Widgets.HoverImageButton (IconSize.Menu, "window-close") { DrawFocus = false };
- close_button.Image.Xpad = 1;
- close_button.Image.Ypad = 1;
- close_button.Clicked += (o, e) => Banshee.ServiceStack.Application.Shutdown ();
-
- var close_toolbar = new Toolbar () {
- ShowArrow = false,
- ToolbarStyle = ToolbarStyle.Icons
- };
-
- close_toolbar.Add (close_button);
- close_toolbar.ShowAll ();
-
- pwin_header_table.Attach (close_toolbar, 1, 2, 0, 1,
- AttachOptions.Shrink, AttachOptions.Fill | AttachOptions.Expand, 0, 0);
-
- // Set the internal engine volume to 100%
- // FIXME: We should have something like PlayerEngine.InternalVolumeEnabled = false
- ServiceManager.PlayerEngine.Volume = 100;
- }
-
private void OnPlayerStateChanged (PlayerEventArgs args)
{
var player = ServiceManager.PlayerEngine;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]