banshee r3345 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.ServiceStack src/Core/Banshee.ThickClient/Banshee.Gui.Widgets src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView src/Libraries/Hyena/Hyena.CommandLine



Author: abock
Date: Thu Feb 28 01:08:22 2008
New Revision: 3345
URL: http://svn.gnome.org/viewvc/banshee?rev=3345&view=rev

Log:
2008-02-27  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs: Added
    a generic Contains method so Contains checks can be type safe just like
    the generic Get service calls

    * src/Core/Banshee.Services/Banshee.ServiceStack/TestUserJob.cs:
    Added a method to spawn a few test user jobs which is useful for
    debugging the user job API and host tile display

    * src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTileHost.cs:
    When the magic command line argument is passed, spawn the test jobs

    * src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs:
    Only render the focus row if the view actually has focus

    * src/Libraries/Hyena/Hyena.CommandLine/CommandLineParser.cs: Fix a
    minor crasher bug



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/TestUserJob.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTileHost.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
   trunk/banshee/src/Libraries/Hyena/Hyena.CommandLine/CommandLineParser.cs

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/ServiceManager.cs	Thu Feb 28 01:08:22 2008
@@ -178,6 +178,11 @@
                 return services.ContainsKey (serviceName);
             }
         }
+
+        public static bool Contains<T> () where T : class, IService
+        {
+            return Contains (typeof (T).Name);
+        }
         
         public static IService Get (string serviceName)
         {

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/TestUserJob.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/TestUserJob.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/TestUserJob.cs	Thu Feb 28 01:08:22 2008
@@ -140,5 +140,14 @@
             
             OnFinished ();
         }
+
+        public static void SpawnLikeFish (int count)
+        {
+            int i = 0;
+            Application.RunTimeout (2000, delegate { 
+                new TestUserJob (); 
+                return ++i < count;
+            });
+        }
     }
 }

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTileHost.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTileHost.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/UserJobTileHost.cs	Thu Feb 28 01:08:22 2008
@@ -31,6 +31,7 @@
 
 using Gtk;
 
+using Banshee.Base;
 using Banshee.ServiceStack;
 
 namespace Banshee.Gui.Widgets
@@ -42,21 +43,39 @@
         
         public UserJobTileHost () : base (0.0f, 0.0f, 1.0f, 1.0f)
         {
-            TopPadding = 5;
-
             box = new VBox ();
             box.Spacing = 8;
             box.Show ();
 
             Add (box);
 
-            if (ServiceManager.Contains ("UserJobManager")) {
-                UserJobManager job_manager = ServiceManager.Get<UserJobManager> ("UserJobManager");
+            if (ServiceManager.Contains<UserJobManager> ()) {
+                UserJobManager job_manager = ServiceManager.Get<UserJobManager> ();
                 job_manager.JobAdded += OnJobAdded;
                 job_manager.JobRemoved += OnJobRemoved;
             }
+
+            if (ApplicationContext.CommandLine.Contains ("test-user-job")) {
+                int fish;
+                if (!Int32.TryParse (ApplicationContext.CommandLine["test-user-job"], out fish)) {
+                    fish = 5;
+                }
+                TestUserJob.SpawnLikeFish (fish);
+            }
         }
-        
+
+        public new void Show ()
+        {
+            TopPadding = 8;
+            base.Show ();
+        }
+
+        public new void Hide ()
+        {
+            TopPadding = 0;
+            base.Hide ();
+        }
+
         private void AddJob (IUserJob job)
         {                    
             if (job == null || job.IsFinished) {
@@ -93,10 +112,11 @@
                 if (job_tiles.ContainsKey (args.Job)) {
                     UserJobTile tile = job_tiles[args.Job];
                     box.Remove (tile);
-                    
-                    if (job_tiles.Count <= 0) {
-                        Hide ();
-                    }
+                    job_tiles.Remove (args.Job);
+                }
+
+                if (job_tiles.Count <= 0) {
+                    Hide ();
                 }
             }
         }

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs	Thu Feb 28 01:08:22 2008
@@ -220,7 +220,7 @@
                             single_list_alloc.Width, single_list_alloc.Height);
                     }
                     
-                    if (focused_row_index == ri && !Selection.Contains (ri)) {
+                    if (focused_row_index == ri && !Selection.Contains (ri) && HasFocus) {
                         CairoCorners corners = CairoCorners.All;
                         
                         if (Selection.Contains (ri - 1)) {
@@ -253,7 +253,7 @@
                     list_alloc.Width, selection_height);
             }
             
-            if (Selection.Count > 1 && !selected_focus_alloc.Equals (Gdk.Rectangle.Zero)) {
+            if (Selection.Count > 1 && !selected_focus_alloc.Equals (Gdk.Rectangle.Zero) && HasFocus) {
                 graphics.DrawRowSelection (list_cr, selected_focus_alloc.X, selected_focus_alloc.Y, 
                     selected_focus_alloc.Width, selected_focus_alloc.Height, false, true, 
                     graphics.GetWidgetColor (GtkColorClass.Dark, StateType.Selected));

Modified: trunk/banshee/src/Libraries/Hyena/Hyena.CommandLine/CommandLineParser.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.CommandLine/CommandLineParser.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.CommandLine/CommandLineParser.cs	Thu Feb 28 01:08:22 2008
@@ -94,7 +94,7 @@
         
         private bool IsOption (string argument)
         {
-            return argument.Substring (0, 2) == "--";
+            return argument.Length > 2 && argument.Substring (0, 2) == "--";
         }
         
         private string OptionName (string argument)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]