5
// Aaron Bockover <abockover@novell.com>
7
// Copyright 2009-2010 Novell, Inc.
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
10
// of this software and associated documentation files (the "Software"), to deal
11
// in the Software without restriction, including without limitation the rights
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
// copies of the Software, and to permit persons to whom the Software is
14
// furnished to do so, subject to the following conditions:
16
// The above copyright notice and this permission notice shall be included in
17
// all copies or substantial portions of the Software.
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35
using Banshee.ServiceStack;
37
namespace Banshee.MeeGo
39
public class MeeGoPanel : IDisposable
41
public static MeeGoPanel Instance { get; private set; }
43
private PanelGtk embedded_panel;
44
private Window window_panel;
46
public MediaPanelContents Contents { get; private set; }
50
if (Instance != null) {
51
throw new InvalidOperationException ("Only one MeeGoPanel instance should exist");
56
var timer = Log.DebugTimerStart ();
59
Log.Debug ("Attempting to create MeeGo toolbar panel");
60
embedded_panel = new PanelGtk ("banshee", Catalog.GetString ("media"),
61
null, "media-button", true);
62
embedded_panel.ShowBeginEvent += (o, e) => {
63
ServiceManager.SourceManager.SetActiveSource (ServiceManager.SourceManager.MusicLibrary);
64
if (Contents != null) {
65
Contents.SyncSearchEntry ();
68
while (Gtk.Application.EventsPending ()) {
69
Gtk.Application.RunIteration ();
71
} catch (Exception e) {
72
if (!(e is DllNotFoundException)) {
73
Log.Exception ("Could not bind to MeeGo panel", e);
75
window_panel = new Gtk.Window ("MeeGo Media Panel");
78
Log.DebugTimerPrint (timer, "MeeGo panel created: {0}");
81
public void Dispose ()
85
public void BuildContents ()
87
var timer = Log.DebugTimerStart ();
88
Contents = new MediaPanelContents ();
90
Log.DebugTimerPrint (timer, "MeeGo panel contents created: {0}");
92
if (embedded_panel != null) {
93
embedded_panel.SetChild (Contents);
94
} else if (window_panel != null) {
95
window_panel.Add (Contents);
96
window_panel.SetDefaultSize (1000, 500);
97
window_panel.WindowPosition = WindowPosition.Center;
99
GLib.Timeout.Add (1000, () => {
100
window_panel.Present ();
108
if (embedded_panel != null) {
109
embedded_panel.Hide ();