banshee r3857 - in trunk/banshee: . build po src/Extensions src/Extensions/Banshee.MiniMode src/Extensions/Banshee.MiniMode/Banshee.MiniMode src/Extensions/Banshee.MiniMode/Resources
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3857 - in trunk/banshee: . build po src/Extensions src/Extensions/Banshee.MiniMode src/Extensions/Banshee.MiniMode/Banshee.MiniMode src/Extensions/Banshee.MiniMode/Resources
- Date: Thu, 1 May 2008 14:30:23 +0100 (BST)
Author: gburt
Date: Thu May 1 13:30:22 2008
New Revision: 3857
URL: http://svn.gnome.org/viewvc/banshee?rev=3857&view=rev
Log:
2008-05-01 Gabriel Burt <gabriel burt gmail com>
* build/build.environment.mk:
* configure.ac:
* src/Extensions/Banshee.MiniMode/Banshee.MiniMode.addin.xml:
* src/Extensions/Banshee.MiniMode/Banshee.MiniMode.mdp:
* src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeService.cs:
* src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeWindow.cs:
* src/Extensions/Banshee.MiniMode/Banshee.MiniMode/SourceComboBox.cs:
* src/Extensions/Banshee.MiniMode/Banshee.MiniMode/SourceModel.cs:
* src/Extensions/Banshee.MiniMode/Makefile.am:
* src/Extensions/Banshee.MiniMode/Resources/minimode.glade:
* src/Extensions/Extensions.mds:
* src/Extensions/Makefile.am: Patch from Bertrand Lorentz porting mini
mode from stable, fixes BGO #527412. The extension is built by default,
but must be enabled in the Preferences dialog.
Added:
trunk/banshee/src/Extensions/Banshee.MiniMode/ (props changed)
trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/
trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode.addin.xml
trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode.mdp
trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeService.cs
trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeWindow.cs
trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/SourceComboBox.cs
trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/SourceModel.cs
trunk/banshee/src/Extensions/Banshee.MiniMode/Makefile.am
trunk/banshee/src/Extensions/Banshee.MiniMode/Resources/
trunk/banshee/src/Extensions/Banshee.MiniMode/Resources/minimode.glade
Modified:
trunk/banshee/ChangeLog
trunk/banshee/build/build.environment.mk
trunk/banshee/configure.ac
trunk/banshee/po/ChangeLog
trunk/banshee/po/POTFILES.in
trunk/banshee/src/Extensions/Extensions.mds
trunk/banshee/src/Extensions/Makefile.am
Modified: trunk/banshee/build/build.environment.mk
==============================================================================
--- trunk/banshee/build/build.environment.mk (original)
+++ trunk/banshee/build/build.environment.mk Thu May 1 13:30:22 2008
@@ -110,6 +110,7 @@
REF_EXTENSION_BOOKMARKS = $(LINK_BANSHEE_THICKCLIENT_DEPS)
REF_EXTENSION_BOOSCRIPT = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_BOO)
REF_EXTENSION_DAAP = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_ICSHARP_ZIP_LIB) $(LINK_MONO_ZEROCONF)
+REF_EXTENSION_MINIMODE = $(LINK_BANSHEE_THICKCLIENT_DEPS)
REF_EXTENSION_MULTIMEDIAKEYS = $(LINK_BANSHEE_SERVICES_DEPS)
REF_EXTENSION_NOTIFICATIONAREA = $(LINK_BANSHEE_THICKCLIENT_DEPS)
REF_EXTENSION_PLAYQUEUE = $(LINK_BANSHEE_THICKCLIENT_DEPS)
Modified: trunk/banshee/configure.ac
==============================================================================
--- trunk/banshee/configure.ac (original)
+++ trunk/banshee/configure.ac Thu May 1 13:30:22 2008
@@ -161,6 +161,7 @@
src/Extensions/Banshee.BooScript/Makefile
src/Extensions/Banshee.Daap/Makefile
src/Extensions/Banshee.Lastfm/Makefile
+src/Extensions/Banshee.MiniMode/Makefile
src/Extensions/Banshee.MultimediaKeys/Makefile
src/Extensions/Banshee.NotificationArea/Makefile
src/Extensions/Banshee.NowPlaying/Makefile
Modified: trunk/banshee/po/POTFILES.in
==============================================================================
--- trunk/banshee/po/POTFILES.in (original)
+++ trunk/banshee/po/POTFILES.in Thu May 1 13:30:22 2008
@@ -81,8 +81,10 @@
src/Core/Banshee.Widgets/Banshee.Widgets/StreamPositionLabel.cs
src/Core/Banshee.Widgets/Banshee.Widgets/VolumeButton.cs
src/Dap/Banshee.Dap/Banshee.Dap/DapSource.cs
-src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs
src/Dap/Banshee.Dap/Banshee.Dap.Gui/DapPropertiesDialog.cs
+src/Dap/Banshee.Dap/Banshee.Dap/MusicGroupSource.cs
+src/Dap/Banshee.Dap/Banshee.Dap/RemovableSource.cs
+src/Dap/Banshee.Dap/Banshee.Dap/VideoGroupSource.cs
src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs
src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpDap.cs
src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
@@ -103,11 +105,13 @@
src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationSource.cs
src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/StationType.cs
src/Extensions/Banshee.Lastfm/Resources/lastfm.glade
+src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeService.cs
+src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeWindow.cs
+src/Extensions/Banshee.MiniMode/Resources/minimode.glade
src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs
src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/X11NotificationAreaBox.cs
src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/NowPlayingSource.cs
src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
-src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Data/PodcastFeed.cs
src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/DownloadManager/DownloadUserJob.cs
src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Dialog/PodcastFeedPropertiesDialog.cs
src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Dialog/PodcastPropertiesDialog.cs
Added: trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode.addin.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode.addin.xml Thu May 1 13:30:22 2008
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Addin
+ id="Banshee.MiniMode"
+ version="1.0"
+ compatVersion="1.0"
+ copyright="Â 2008 Novell Inc. Licensed under the MIT X11 license."
+ name="Mini Mode"
+ description="Mini Mode allows controlling Banshee through a small window with only playback controls and track information."
+ author="Felipe Almeida Lessa, Aaron Bockover, Bertrand Lorentz"
+ url="http://banshee-project.org/"
+ defaultEnabled="false">
+
+ <Dependencies>
+ <Addin id="Banshee.Services" version="1.0"/>
+ <Addin id="Banshee.ThickClient" version="1.0"/>
+ </Dependencies>
+
+ <Extension path="/Banshee/ServiceManager/Service">
+ <Service class="Banshee.MiniMode.MiniModeService"/>
+ </Extension>
+
+</Addin>
Added: trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode.mdp
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode.mdp Thu May 1 13:30:22 2008
@@ -0,0 +1,33 @@
+<Project name="Banshee.MiniMode" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
+ <Configurations active="Debug">
+ <Configuration name="Debug" ctype="DotNetProjectConfiguration">
+ <Output directory="../../../bin" assemblyKeyFile="." assembly="Banshee.MiniMode" />
+ <Build debugmode="True" target="Library" />
+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" />
+ <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
+ </Configuration>
+ </Configurations>
+ <Contents>
+ <File name="Banshee.MiniMode.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
+ <File name="Banshee.MiniMode/MiniModeService.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.MiniMode/MiniModeWindow.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.MiniMode/SourceComboBox.cs" subtype="Code" buildaction="Compile" />
+ <File name="Banshee.MiniMode/SourceModel.cs" subtype="Code" buildaction="Compile" />
+ <File name="Resources/minimode.glade" subtype="Code" buildaction="EmbedAsResource" />
+ </Contents>
+ <References>
+ <ProjectReference type="Project" localcopy="True" refto="Banshee.Core" />
+ <ProjectReference type="Project" localcopy="True" refto="Banshee.Services" />
+ <ProjectReference type="Project" localcopy="True" refto="Hyena" />
+ <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ </References>
+ <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am">
+ <BuildFilesVar Sync="True" Name="SOURCES" />
+ <DeployFilesVar />
+ <ResourcesVar Sync="True" Name="RESOURCES" />
+ <OthersVar />
+ <GacRefVar />
+ <AsmRefVar />
+ <ProjectRefVar />
+ </MonoDevelop.Autotools.MakefileInfo>
+</Project>
\ No newline at end of file
Added: trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeService.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeService.cs Thu May 1 13:30:22 2008
@@ -0,0 +1,62 @@
+using System;
+using Gtk;
+using Mono.Unix;
+
+using Banshee.Base;
+using Banshee.Configuration;
+using Banshee.Gui;
+using Banshee.ServiceStack;
+using Banshee.Sources;
+
+namespace Banshee.MiniMode
+{
+ public class MiniModeService : IExtensionService, IDisposable
+ {
+ private MiniMode mini_mode = null;
+ private Menu viewMenu;
+ private MenuItem menuItem;
+ private InterfaceActionService action_service;
+
+ void IExtensionService.Initialize ()
+ {
+ action_service = ServiceManager.Get<InterfaceActionService> ("InterfaceActionService");
+
+ viewMenu = (action_service.UIManager.GetWidget("/MainMenu/ViewMenu") as MenuItem).Submenu as Menu;
+ menuItem = new MenuItem(Catalog.GetString("_Mini Mode"));
+ menuItem.Activated += delegate {
+ if (mini_mode == null) {
+ mini_mode = new MiniMode();
+ }
+
+ mini_mode.Show();
+ };
+ viewMenu.Insert(menuItem, 2);
+ menuItem.Show();
+ }
+
+ public void Dispose()
+ {
+ if(viewMenu != null && menuItem != null) {
+ viewMenu.Remove(menuItem);
+ }
+
+ if(mini_mode != null) {
+ // We'll do our visual cleaning in a timeout to avoid
+ // glitches when Banshee quits. Besides, the plugin window is
+ // accessible only on the full mode, so this won't cause any
+ // trouble.
+ GLib.Timeout.Add(1000, delegate {
+ try {
+ mini_mode.Hide();
+ } catch {
+ }
+ return false;
+ });
+ }
+ }
+
+ string IService.ServiceName {
+ get { return "MiniModeService"; }
+ }
+ }
+}
Added: trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeWindow.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/MiniModeWindow.cs Thu May 1 13:30:22 2008
@@ -0,0 +1,228 @@
+/***************************************************************************
+ * MiniModeWindow.cs
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ * Written by Aaron Bockover <aaron abock org>
+ * Felipe Almeida Lessa
+ ****************************************************************************/
+
+/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
+ *
+ * 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;
+using Glade;
+using Mono.Unix;
+
+using Hyena.Widgets;
+using Hyena.Gui;
+
+using Banshee.Collection;
+using Banshee.Collection.Gui;
+using Banshee.Gui;
+using Banshee.Gui.Widgets;
+using Banshee.MediaEngine;
+using Banshee.ServiceStack;
+using Banshee.Widgets;
+
+namespace Banshee.MiniMode
+{
+ public class MiniMode : Window
+ {
+ [Widget] private Gtk.Box SeekContainer;
+ [Widget] private Gtk.Box VolumeContainer;
+ [Widget] private Gtk.Box InfoBox;
+ [Widget] private Gtk.Box SourceBox;
+ [Widget] private Gtk.Box CoverBox;
+ [Widget] private Gtk.Box PlaybackBox;
+ [Widget] private Gtk.Box LowerButtonsBox;
+
+ [Widget] private Gtk.Button fullmode_button;
+
+ private TrackInfoDisplay track_info_display;
+ private ConnectedVolumeButton volume_button;
+ private SourceComboBox source_combo_box;
+ private ConnectedSeekSlider seek_slider;
+ private object tooltip_host;
+
+ private InterfaceActionService interface_action_service;
+ private GtkElementsService elements_service;
+ private BaseClientWindow default_main_window;
+
+ private Glade.XML glade;
+
+ public MiniMode() : base(Catalog.GetString("Banshee Music Player"))
+ {
+ elements_service = ServiceManager.Get<GtkElementsService>();
+ interface_action_service = ServiceManager.Get<InterfaceActionService>("InterfaceActionService");
+
+ default_main_window = elements_service.PrimaryWindow;
+
+ glade = new Glade.XML(System.Reflection.Assembly.GetExecutingAssembly(), "minimode.glade", "MiniModeWindow", null);
+ glade.Autoconnect(this);
+
+ Widget child = glade["mini_mode_contents"];
+ (child.Parent as Container).Remove(child);
+ Add(child);
+ BorderWidth = 12;
+ Resizable = false;
+
+ DeleteEvent += delegate {
+ interface_action_service.GlobalActions["QuitAction"].Activate();
+ };
+
+ // Playback Buttons
+ Widget previous_button = interface_action_service.PlaybackActions["PreviousAction"].CreateToolItem ();
+
+ Widget playpause_button = interface_action_service.PlaybackActions["PlayPauseAction"].CreateToolItem ();
+
+ Widget button = interface_action_service.PlaybackActions["NextAction"].CreateToolItem ();
+ Menu menu = interface_action_service.PlaybackActions.ShuffleActions.CreateMenu ();
+ MenuButton next_button = new MenuButton (button, menu, true);
+
+ PlaybackBox.PackStart(previous_button, false, false, 0);
+ PlaybackBox.PackStart(playpause_button, false, false, 0);
+ PlaybackBox.PackStart(next_button, false, false, 0);
+ PlaybackBox.ShowAll();
+
+ // Seek Slider/Position Label
+ seek_slider = new ConnectedSeekSlider();
+
+ SeekContainer.PackStart(seek_slider, false, false, 0);
+ SeekContainer.ShowAll();
+
+ // Volume button
+ volume_button = new ConnectedVolumeButton();
+ VolumeContainer.PackStart(volume_button, false, false, 0);
+ volume_button.Show();
+
+ // Source combobox
+ source_combo_box = new SourceComboBox();
+ SourceBox.PackStart(source_combo_box, true, true, 0);
+ source_combo_box.ShowAll();
+
+ // Track info
+ track_info_display = new TrackInfoDisplay ();
+ track_info_display.Show ();
+ CoverBox.PackStart(track_info_display, true, true, 0);
+
+ // Repeat button
+ RepeatActionButton repeat_toggle_button = new RepeatActionButton ();
+
+ LowerButtonsBox.PackEnd(repeat_toggle_button, false, false, 0);
+ LowerButtonsBox.ShowAll();
+
+ tooltip_host = TooltipSetter.CreateHost ();
+
+ SetTip(fullmode_button, Catalog.GetString("Switch back to full mode"));
+ SetTip(repeat_toggle_button, Catalog.GetString("Change repeat playback mode"));
+
+ // Hook up everything
+ ServiceManager.PlayerEngine.EventChanged += OnPlayerEngineEventChanged;
+ ServiceManager.PlayerEngine.StateChanged += OnPlayerEngineStateChanged;
+
+ SetHeightLimit();
+ }
+
+ private void SetTip(Widget widget, string tip)
+ {
+ TooltipSetter.Set (tooltip_host, widget, tip);
+ }
+
+ private void SetHeightLimit()
+ {
+ Gdk.Geometry limits = new Gdk.Geometry();
+
+ limits.MinHeight = -1;
+ limits.MaxHeight = -1;
+ limits.MinWidth = SizeRequest().Width;
+ limits.MaxWidth = Gdk.Screen.Default.Width;
+
+ SetGeometryHints(this, limits, Gdk.WindowHints.MaxSize | Gdk.WindowHints.MinSize);
+ }
+
+ public new void Show()
+ {
+ source_combo_box.UpdateActiveSource();
+ UpdateMetaDisplay();
+
+ default_main_window.Hide();
+
+ base.Show();
+ }
+
+ public new void Hide()
+ {
+ base.Hide();
+ default_main_window.Show();
+ }
+
+ public void Hide(object o, EventArgs a)
+ {
+ Hide();
+ }
+
+ // ---- Player Event Handlers ----
+
+ private void OnPlayerEngineStateChanged(object o, Banshee.MediaEngine.PlayerEngineStateArgs args)
+ {
+ switch(args.State) {
+ case PlayerEngineState.Loaded:
+ UpdateMetaDisplay();
+ break;
+ case PlayerEngineState.Idle:
+ InfoBox.Visible = false;
+ UpdateMetaDisplay();
+ break;
+ }
+ }
+
+ private void OnPlayerEngineEventChanged(object o, PlayerEngineEventArgs args)
+ {
+ switch(args.Event) {
+ case PlayerEngineEvent.Error:
+ UpdateMetaDisplay();
+ break;
+ case PlayerEngineEvent.TrackInfoUpdated:
+ UpdateMetaDisplay();
+ break;
+ }
+ }
+
+ protected void UpdateMetaDisplay()
+ {
+ TrackInfo track = ServiceManager.PlayerEngine.CurrentTrack;
+
+ if(track == null) {
+ InfoBox.Visible = false;
+ return;
+ }
+
+ InfoBox.Visible = true;
+
+ try {
+ SetHeightLimit();
+ } catch(Exception) {
+ }
+ }
+ }
+}
+
Added: trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/SourceComboBox.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/SourceComboBox.cs Thu May 1 13:30:22 2008
@@ -0,0 +1,95 @@
+/***************************************************************************
+ * SourceComboBox.cs
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ * Written by Aaron Bockover <aaron abock org>
+ * Felipe Almeida Lessa
+ ****************************************************************************/
+
+/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
+ *
+ * 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;
+
+using Banshee.ServiceStack;
+using Banshee.Sources;
+
+namespace Banshee.MiniMode
+{
+ public class SourceComboBox : Gtk.ComboBox
+ {
+ public SourceComboBox()
+ {
+ Clear();
+
+ CellRendererPixbuf image = new CellRendererPixbuf();
+ PackStart(image, false);
+ AddAttribute(image, "pixbuf", 0);
+
+ CellRendererText text = new CellRendererText();
+ PackStart(text, true);
+ AddAttribute(text, "text", 1);
+
+ Model = new SourceModel();
+
+ ServiceManager.SourceManager.ActiveSourceChanged += delegate {
+ UpdateActiveSource();
+ };
+
+ ServiceManager.SourceManager.SourceUpdated += delegate {
+ QueueDraw();
+ };
+ }
+
+ public void UpdateActiveSource()
+ {
+ lock(this) {
+ TreeIter iter = Model.FindSource(ServiceManager.SourceManager.ActiveSource);
+ if(!iter.Equals(TreeIter.Zero)) {
+ SetActiveIter(iter);
+ }
+ }
+ }
+
+ protected override void OnChanged()
+ {
+ lock(this) {
+ TreeIter iter;
+
+ if(GetActiveIter(out iter)) {
+ Source new_source = Model.GetValue(iter, 2) as Source;
+ if(new_source != null && ServiceManager.SourceManager.ActiveSource != new_source) {
+ ServiceManager.SourceManager.SetActiveSource(new_source);
+ if(new_source is ITrackModelSource) {
+ ServiceManager.PlaybackController.Source = (ITrackModelSource)new_source;
+ }
+ }
+ }
+ }
+ }
+
+ public new SourceModel Model {
+ get { return base.Model as SourceModel; }
+ set { base.Model = value; }
+ }
+ }
+}
Added: trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/SourceModel.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.MiniMode/Banshee.MiniMode/SourceModel.cs Thu May 1 13:30:22 2008
@@ -0,0 +1,142 @@
+/***************************************************************************
+ * SourceModel.cs
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ * Written by Aaron Bockover <aaron abock org>
+ * Felipe Almeida Lessa
+ ****************************************************************************/
+
+/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
+ *
+ * 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;
+
+using Banshee.ServiceStack;
+using Banshee.Sources;
+using Banshee.Sources.Gui;
+
+namespace Banshee.MiniMode
+{
+ public class SourceModel : Gtk.TreeStore
+ {
+ internal SourceModel() : base(typeof(Gdk.Pixbuf), typeof(string), typeof(Source))
+ {
+ Clear();
+
+ foreach(Source source in ServiceManager.SourceManager.Sources) {
+ AddSource(source);
+ }
+
+ ServiceManager.SourceManager.SourceAdded += delegate(SourceAddedArgs args) {
+ AddSource(args.Source, args.Position);
+ };
+
+ ServiceManager.SourceManager.SourceRemoved += delegate(SourceEventArgs args) {
+ RemoveSource(args.Source);
+ };
+ }
+
+ private void SetSource(TreeIter iter, Source source)
+ {
+ Gdk.Pixbuf icon = SourceIconResolver.ResolveIcon(source);
+
+ if(icon == null) {
+ icon = Banshee.Gui.IconThemeUtils.LoadIcon(22, "source-library");
+ }
+
+ SetValue(iter, 0, icon);
+ SetValue(iter, 1, source.Name);
+ SetValue(iter, 2, source);
+ }
+
+ private void AddSource(Source source)
+ {
+ if(source.Parent == null) {
+ AddSource(source, -1);
+ }
+ }
+
+ private void AddSource(Source source, int position)
+ {
+ if(FindSource(source).Equals(TreeIter.Zero)) {
+ TreeIter iter = InsertNode(position);
+ AddSource(source, iter);
+ }
+ }
+
+ private void AddSource(Source source, TreeIter iter)
+ {
+ SetSource(iter, source);
+
+ foreach(Source child in source.Children) {
+ AddSource(child, AppendNode(iter));
+ }
+
+ source.ChildSourceAdded += delegate(SourceEventArgs e) {
+ AddSource(e.Source, AppendNode(iter));
+ };
+
+ source.ChildSourceRemoved += delegate(SourceEventArgs e) {
+ RemoveSource(e.Source);
+ };
+ }
+
+ private void RemoveSource(Source source)
+ {
+ TreeIter iter = FindSource(source);
+ if(!iter.Equals(TreeIter.Zero)) {
+ Remove(ref iter);
+ }
+ }
+
+ public TreeIter FindSource(Source source)
+ {
+ TreeIter iter = TreeIter.Zero;
+ GetIterFirst(out iter);
+ return FindSource(source, iter);
+ }
+
+ private TreeIter FindSource(Source source, TreeIter iter)
+ {
+ if(!IterIsValid(iter)) {
+ return TreeIter.Zero;
+ }
+
+ do {
+ if((GetValue(iter, 2) as Source) == source) {
+ return iter;
+ }
+
+ if(IterHasChild(iter)) {
+ TreeIter citer = TreeIter.Zero;
+ IterChildren(out citer, iter);
+ TreeIter result = FindSource(source, citer);
+ if(!result.Equals(TreeIter.Zero)) {
+ return result;
+ }
+ }
+ } while(IterNext(ref iter));
+
+ return TreeIter.Zero;
+ }
+ }
+}
Added: trunk/banshee/src/Extensions/Banshee.MiniMode/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.MiniMode/Makefile.am Thu May 1 13:30:22 2008
@@ -0,0 +1,16 @@
+ASSEMBLY = Banshee.MiniMode
+TARGET = library
+LINK = $(REF_EXTENSION_MINIMODE)
+
+SOURCES = \
+ Banshee.MiniMode/MiniModeService.cs \
+ Banshee.MiniMode/MiniModeWindow.cs \
+ Banshee.MiniMode/SourceComboBox.cs \
+ Banshee.MiniMode/SourceModel.cs
+
+RESOURCES = \
+ Banshee.MiniMode.addin.xml \
+ Resources/minimode.glade
+
+include $(top_srcdir)/build/build.mk
+
Added: trunk/banshee/src/Extensions/Banshee.MiniMode/Resources/minimode.glade
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.MiniMode/Resources/minimode.glade Thu May 1 13:30:22 2008
@@ -0,0 +1,337 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkWindow" id="MiniModeWindow">
+ <property name="border_width">10</property>
+ <property name="title" translatable="yes">Banshee</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="mini_mode_contents">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkHBox" id="UpperBox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">5</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="PlaybackBox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">5</property>
+
+ <child>
+ <placeholder/>
+ </child>
+
+ <child>
+ <placeholder/>
+ </child>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="SeekContainer">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="VolumeContainer">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">5</property>
+
+ <child>
+ <widget class="GtkButton" id="fullmode_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NONE</property>
+ <property name="focus_on_click">True</property>
+ <signal name="clicked" handler="Hide" last_modification_time="Fri, 24 Mar 2006 15:14:14 GMT"/>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="stock">gtk-leave-fullscreen</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Full Mode</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="SourceBox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">5</property>
+
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="label" translatable="yes">Current source:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="InfoBox">
+ <property name="homogeneous">False</property>
+ <property name="spacing">10</property>
+
+ <child>
+ <widget class="GtkHBox" id="CoverBox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox5">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">7</property>
+
+ <child>
+ <widget class="GtkHBox" id="LowerButtonsBox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
Modified: trunk/banshee/src/Extensions/Extensions.mds
==============================================================================
--- trunk/banshee/src/Extensions/Extensions.mds (original)
+++ trunk/banshee/src/Extensions/Extensions.mds Thu May 1 13:30:22 2008
@@ -9,6 +9,7 @@
<Entry build="True" name="Banshee.PlayQueue" configuration="Debug" />
<Entry build="True" name="Banshee.AudioCd" configuration="Debug" />
<Entry build="True" name="Banshee.Daap" configuration="Debug" />
+ <Entry build="True" name="Banshee.MiniMode" configuration="Debug" />
<Entry build="True" name="Banshee.Podcasting" configuration="Debug" />
<Entry build="True" name="Banshee.Sample" configuration="Debug" />
<Entry build="True" name="Banshee.BooScript" configuration="Debug" />
@@ -23,6 +24,7 @@
<Execute type="None" entry="Banshee.NowPlaying" />
<Execute type="None" entry="Banshee.Bookmarks" />
<Execute type="None" entry="Banshee.AudioCd" />
+ <Execute type="None" entry="Banshee.MiniMode" />
<Execute type="None" entry="Banshee.Podcasting" />
<Execute type="None" entry="Banshee.Sample" />
<Execute type="None" entry="Banshee.BooScript" />
@@ -36,8 +38,9 @@
<Entry filename="Banshee.NowPlaying/Banshee.NowPlaying.mdp" />
<Entry filename="Banshee.Bookmarks/Banshee.Bookmarks.mdp" />
<Entry filename="Banshee.AudioCd/Banshee.AudioCd.mdp" />
+ <Entry filename="Banshee.MiniMode/Banshee.MiniMode.mdp" />
<Entry filename="Banshee.Podcasting/Banshee.Podcasting.mdp" />
<Entry filename="Banshee.Sample/Banshee.Sample.mdp" />
<Entry filename="Banshee.BooScript/Banshee.BooScript.mdp" />
</Entries>
-</Combine>
\ No newline at end of file
+</Combine>
Modified: trunk/banshee/src/Extensions/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Makefile.am (original)
+++ trunk/banshee/src/Extensions/Makefile.am Thu May 1 13:30:22 2008
@@ -4,6 +4,7 @@
Banshee.BooScript \
Banshee.Daap \
Banshee.Lastfm \
+ Banshee.MiniMode \
Banshee.MultimediaKeys \
Banshee.NotificationArea \
Banshee.NowPlaying \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]