banshee r4969 - in trunk/banshee: . src/Clients/Nereid/Nereid src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Gui.Widgets src/Core/Banshee.ThickClient/Resources src/Extensions/Banshee.Bpm/Banshee.Bpm src/Extensions/Banshee.CoverArt/Banshee.CoverArt
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4969 - in trunk/banshee: . src/Clients/Nereid/Nereid src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Gui.Widgets src/Core/Banshee.ThickClient/Resources src/Extensions/Banshee.Bpm/Banshee.Bpm src/Extensions/Banshee.CoverArt/Banshee.CoverArt
- Date: Mon, 26 Jan 2009 04:46:26 +0000 (UTC)
Author: gburt
Date: Mon Jan 26 04:46:25 2009
New Revision: 4969
URL: http://svn.gnome.org/viewvc/banshee?rev=4969&view=rev
Log:
2009-01-25 Gabriel Burt <gabriel burt gmail com>
* Core/Banshee.ThickClient/Makefile.am:
* Core/Banshee.ThickClient/Banshee.Gui.Widgets/TaskStatusButton.cs: New
button that is insensitive if there are no background UserJobs registered,
and that animates slowly and lists them in a tooltip when there are.
* Clients/Nereid/Nereid/PlayerInterface.cs:
* Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml: Add
a TaskStatusButton to the the bottom left corner, in the status bar.
* Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs: Set
IsBackground = true.
* Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs: Remove using Mono.Addins
Added:
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TaskStatusButton.cs
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
trunk/banshee/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs
trunk/banshee/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs
Modified: trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
==============================================================================
--- trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs (original)
+++ trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs Mon Jan 26 04:46:25 2009
@@ -191,6 +191,8 @@
footer_toolbar.ShowArrow = false;
footer_toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
+ Widget task_status = new Banshee.Gui.Widgets.TaskStatusButton ();
+
EventBox status_event_box = new EventBox ();
status_event_box.ButtonPressEvent += OnStatusBoxButtonPress;
@@ -205,6 +207,7 @@
status_align.LeftPadding = (uint)args.Allocation.Width;
};
+ ActionService.PopulateToolbarPlaceholder (footer_toolbar, "/FooterToolbar/TaskStatus", task_status, false);
ActionService.PopulateToolbarPlaceholder (footer_toolbar, "/FooterToolbar/StatusBar", status_align, true);
ActionService.PopulateToolbarPlaceholder (footer_toolbar, "/FooterToolbar/RepeatButton", repeat_button);
Added: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TaskStatusButton.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TaskStatusButton.cs Mon Jan 26 04:46:25 2009
@@ -0,0 +1,180 @@
+//
+// TaskStatusButton.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;
+using System.Text;
+using System.Collections.Generic;
+
+using Mono.Unix;
+
+using Gtk;
+
+using Hyena;
+using Hyena.Widgets;
+
+using Banshee.Base;
+using Banshee.ServiceStack;
+
+namespace Banshee.Gui.Widgets
+{
+ public class TaskStatusButton : Gtk.Button
+ {
+ private AnimatedImage image;
+ //private Dictionary<IUserJob, UserJobTile> job_tiles = new Dictionary<IUserJob, UserJobTile> ();
+ private List<IUserJob> jobs = new List<IUserJob> ();
+
+ public TaskStatusButton ()
+ {
+ // Setup widgetry
+ Relief = ReliefStyle.None;
+ Sensitive = false;
+
+ image = new AnimatedImage ();
+ try {
+ image.Pixbuf = Gtk.IconTheme.Default.LoadIcon ("process-working", 22, IconLookupFlags.NoSvg);
+ image.FrameHeight = 22;
+ image.FrameWidth = 22;
+ image.Load ();
+ image.Active = false;
+ } catch (Exception e) {
+ Hyena.Log.Exception (e);
+ }
+
+ Child = image;
+
+ // Listen for jobs
+ UserJobManager job_manager = ServiceManager.Get<UserJobManager> ();
+ job_manager.JobAdded += OnJobAdded;
+ job_manager.JobRemoved += OnJobRemoved;
+
+ Update ();
+ }
+
+ private void Update ()
+ {
+ lock (this) {
+ if (jobs.Count > 0) {
+ StringBuilder sb = new StringBuilder ();
+ foreach (IUserJob job in jobs) {
+ sb.AppendFormat ("\n<i>{0}</i>", job.Title);
+ }
+
+ TooltipMarkup = String.Format ("<b>{0}</b>{1}",
+ String.Format (
+ // Translators: the number of jobs running is available for your use via {0}
+ Catalog.GetPluralString ("Background Task Running:", "Background Tasks Running:", jobs.Count),
+ jobs.Count
+ ), sb.ToString ()
+ );
+ Active = true;
+ } else {
+ TooltipText = Catalog.GetString ("No background tasks running");
+ Active = false;
+ }
+ }
+ }
+
+ private bool first = true;
+ private bool active = false;
+ private bool Active {
+ set {
+ if (!first && active == value)
+ return;
+
+ first = false;
+ active = value;
+ Sensitive = active;
+
+ if (active) {
+ TurnOn ();
+ } else {
+ TurnOff ();
+ }
+ }
+ }
+
+ private bool TurnOn ()
+ {
+ if (active) {
+ image.Active = true;
+ Banshee.ServiceStack.Application.RunTimeout (1000, TurnOff);
+ }
+ return false;
+ }
+
+ private bool TurnOff ()
+ {
+ image.Active = false;
+
+ if (active) {
+ Banshee.ServiceStack.Application.RunTimeout (5000, TurnOn);
+ }
+ return false;
+ }
+
+ private void AddJob (IUserJob job)
+ {
+ lock (this) {
+ if (job == null || job.IsFinished) {
+ return;
+ }
+
+ Banshee.Base.ThreadAssist.AssertInMainThread ();
+ jobs.Add (job);
+ }
+
+ Update ();
+ }
+
+ private void OnJobAdded (object o, UserJobEventArgs args)
+ {
+ ThreadAssist.ProxyToMain (delegate {
+ AddJob (args.Job);
+ });
+ }
+
+ private void RemoveJob (IUserJob job)
+ {
+ lock (this) {
+ if (jobs.Contains (job)) {
+ Banshee.Base.ThreadAssist.AssertInMainThread ();
+ jobs.Remove (job);
+ }
+ }
+
+ Update ();
+ }
+
+ private void OnJobRemoved (object o, UserJobEventArgs args)
+ {
+ ThreadAssist.ProxyToMain (delegate {
+ RemoveJob (args.Job);
+ });
+ }
+ }
+}
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am Mon Jan 26 04:46:25 2009
@@ -91,6 +91,7 @@
Banshee.Gui.Widgets/TrackInfoDisplay.cs \
Banshee.Gui.Widgets/UserJobTile.cs \
Banshee.Gui.Widgets/UserJobTileHost.cs \
+ Banshee.Gui.Widgets/TaskStatusButton.cs \
Banshee.Gui/BansheeActionGroup.cs \
Banshee.Gui/BansheeDbFormatMigratorMonitor.cs \
Banshee.Gui/BansheeIconFactory.cs \
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Resources/core-ui-actions-layout.xml Mon Jan 26 04:46:25 2009
@@ -11,6 +11,7 @@
<placeholder name="VolumeButton"/>
</toolbar>
<toolbar name="FooterToolbar">
+ <placeholder name="TaskStatus"/>
<placeholder name="StatusBar"/>
<placeholder name="Extensions"/>
<placeholder name="RepeatButton"/>
Modified: trunk/banshee/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.Bpm/Banshee.Bpm/BpmEntry.cs Mon Jan 26 04:46:25 2009
@@ -30,8 +30,6 @@
using Mono.Unix;
using Gtk;
-using Mono.Addins;
-
using Hyena;
using Hyena.Gui;
Modified: trunk/banshee/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs Mon Jan 26 04:46:25 2009
@@ -91,6 +91,7 @@
last_scan = DateTime.Now - TimeSpan.FromDays (300);
}
+ IsBackground = true;
CanCancel = true;
DelayShow = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]