banshee r4626 - in trunk/banshee: . src/Clients/Beroe/Beroe src/Core/Banshee.Services/Banshee.Collection.Indexer.RemoteHelper src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Collection.Gui



Author: abock
Date: Mon Sep 29 18:46:42 2008
New Revision: 4626
URL: http://svn.gnome.org/viewvc/banshee?rev=4626&view=rev

Log:
2008-09-29  Aaron Bockover  <abock gnome org>

    * src/Clients/Beroe/Beroe/IndexerClient.cs: Log when the client has started

    * src/Clients/Beroe/Beroe/RemoteClient.cs: Stubbed out some more 
    example client indexer stuff

    * src/Core/Banshee.Services/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs:
    Add a helper method for creating indexers; fix a small race bug

    * src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellLocation.cs:
    * src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs:
    Added a new location cell to show local paths as paths and not URIs



Added:
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellLocation.cs
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Clients/Beroe/Beroe/IndexerClient.cs
   trunk/banshee/src/Clients/Beroe/Beroe/RemoteClient.cs
   trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
   trunk/banshee/src/Core/Banshee.ThickClient/Makefile.am

Modified: trunk/banshee/src/Clients/Beroe/Beroe/IndexerClient.cs
==============================================================================
--- trunk/banshee/src/Clients/Beroe/Beroe/IndexerClient.cs	(original)
+++ trunk/banshee/src/Clients/Beroe/Beroe/IndexerClient.cs	Mon Sep 29 18:46:42 2008
@@ -59,6 +59,8 @@
                 return;
             }
             
+            Log.Information ("Indexer client started");
+            
             Startup ();
         }
         

Modified: trunk/banshee/src/Clients/Beroe/Beroe/RemoteClient.cs
==============================================================================
--- trunk/banshee/src/Clients/Beroe/Beroe/RemoteClient.cs	(original)
+++ trunk/banshee/src/Clients/Beroe/Beroe/RemoteClient.cs	Mon Sep 29 18:46:42 2008
@@ -28,6 +28,9 @@
 
 using System;
 using System.Threading;
+using System.Collections.Generic;
+
+using Banshee.Collection.Indexer;
 
 namespace Beroe
 {
@@ -58,13 +61,16 @@
                 shutdown_requested = false;
             }
             
-            int i = 0;
-            Console.Write ("Updating Index... ");
-            while (i++ < 20 && !Shutdown) {
-                Console.Write ("{0} ", i);
-                System.Threading.Thread.Sleep (1000);
+            Sleep (5);
+            
+            ICollectionIndexer indexer = CreateIndexer ();
+            for (int i = 0, models = indexer.GetModelCounts (); i < models; i++) {
+                for (int j = 0, items = indexer.GetModelResultsCount (i); j < items; j++) {
+                    IDictionary<string, object> result = indexer.GetResult (i, j);
+                    Console.WriteLine (result["URI"]);
+                }
             }
-            Console.WriteLine (": Done");
+            indexer.Dispose ();
             
             lock (shutdown_mutex) {
                 indexer_running = false;
@@ -72,6 +78,17 @@
             }
         }
         
+        private void Sleep (int seconds)
+        {
+            int i = 0;
+            Console.Write ("Sleeping... ");
+            while (i++ < seconds && !Shutdown) {
+                Console.Write ("{0} ", i);
+                System.Threading.Thread.Sleep (1000);
+            }
+            Console.WriteLine (": Done");
+        }
+        
         private bool Shutdown {
             get { lock (shutdown_mutex) { return shutdown_requested || CleanupAndShutdown; } }
         }

Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs	(original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs	Mon Sep 29 18:46:42 2008
@@ -130,14 +130,16 @@
                 try {
                     listening = false;
                     service.CollectionChanged -= OnCollectionChanged;
-                } catch {
+                } catch (Exception e) {
+                    Debug (e.ToString ());
                 }
             }
             
             try {
-                service.Shutdown ();
                 service.CleanupAndShutdown -= OnCleanupAndShutdown;
-            } catch {
+                service.Shutdown ();
+            } catch (Exception e) {
+                Debug (e.ToString ());
             }
             
             ResetInternalState ();
@@ -190,6 +192,13 @@
         
         protected abstract void ResetState ();
         
+        protected ICollectionIndexer CreateIndexer ()
+        {
+            ObjectPath object_path = service.CreateIndexer ();
+            Debug ("Creating an ICollectionIndexer ({0})", object_path);
+            return Bus.Session.GetObject<ICollectionIndexer> (indexer_bus_name, object_path);
+        }
+        
         public bool ShowDebugMessages {
             get { return Log.Debugging; }
             set { Log.Debugging = value; }

Added: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellLocation.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ColumnCellLocation.cs	Mon Sep 29 18:46:42 2008
@@ -0,0 +1,48 @@
+//
+// ColumnCellLocation.cs
+//
+// Author:
+//   Aaron Bockover <abockover 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 Hyena.Data.Gui;
+using Banshee.Base;
+
+namespace Banshee.Collection.Gui
+{
+    public class ColumnCellLocation : ColumnCellText
+    {
+        public ColumnCellLocation (string property, bool expand) : base (property, expand)
+        {
+        }
+        
+        protected override string GetText (object obj)
+        {
+            SafeUri uri = obj as SafeUri;
+            return obj == null ? String.Empty : (uri.IsLocalPath ? uri.LocalPath : uri.AbsoluteUri);
+        }
+    }
+}

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/DefaultColumnController.cs	Mon Sep 29 18:46:42 2008
@@ -139,7 +139,7 @@
             skip_count_column   = Create (BansheeQuery.SkipCountField, 0.15, false, new ColumnCellPositiveInt (null, true, 2, 5));
 
             // Construct the URI column specially b/c we want to ellipsize in the middle of the text
-            ColumnCellText uri_cell = new ColumnCellText (BansheeQuery.UriField.PropertyName, true);
+            ColumnCellText uri_cell = new ColumnCellLocation (BansheeQuery.UriField.PropertyName, true);
             uri_cell.EllipsizeMode = Pango.EllipsizeMode.Start;
             uri_column          = Create (BansheeQuery.UriField, 0.15, false, uri_cell);
             

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.ThickClient.csproj	Mon Sep 29 18:46:42 2008
@@ -214,6 +214,7 @@
     <Compile Include="Banshee.Gui.TrackEditor\EditorEntryUndoAdapter.cs" />
     <Compile Include="Banshee.Collection.Gui\ColumnCellTrackNumber.cs" />
     <Compile Include="Banshee.Collection.Gui\ColumnCellDiscAndCount.cs" />
+    <Compile Include="Banshee.Collection.Gui\ColumnCellLocation.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ProjectExtensions>

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 Sep 29 18:46:42 2008
@@ -17,6 +17,7 @@
 	Banshee.Collection.Gui/ColumnCellDiscAndCount.cs \
 	Banshee.Collection.Gui/ColumnCellDuration.cs \
 	Banshee.Collection.Gui/ColumnCellFileSize.cs \
+	Banshee.Collection.Gui/ColumnCellLocation.cs \
 	Banshee.Collection.Gui/ColumnCellPositiveInt.cs \
 	Banshee.Collection.Gui/ColumnCellQueryText.cs \
 	Banshee.Collection.Gui/ColumnCellStatusIndicator.cs \



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