banshee r4544 - in trunk/banshee: . src/Clients/Beroe/Beroe src/Core/Banshee.Services/Banshee.Collection.Indexer src/Core/Banshee.Services/Banshee.Collection.Indexer.RemoteHelper
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4544 - in trunk/banshee: . src/Clients/Beroe/Beroe src/Core/Banshee.Services/Banshee.Collection.Indexer src/Core/Banshee.Services/Banshee.Collection.Indexer.RemoteHelper
- Date: Mon, 15 Sep 2008 19:15:17 +0000 (UTC)
Author: abock
Date: Mon Sep 15 19:15:17 2008
New Revision: 4544
URL: http://svn.gnome.org/viewvc/banshee?rev=4544&view=rev
Log:
2008-09-15 Aaron Bockover <abock gnome org>
* src/Clients/Beroe/Beroe/RemoteClient.cs: Turn debugging on
* src/Core/Banshee.Services/Banshee.Collection.Indexer.RemoteHelper/IndexerClient.cs:
Add debug messages
* src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs:
* src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexer.cs:
* src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexerService.cs:
* src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexer.cs:
Moved internal interfaces from the DBus interface to the implementations
Modified:
trunk/banshee/ChangeLog
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.Services/Banshee.Collection.Indexer/CollectionIndexer.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexer.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexerService.cs
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 15 19:15:17 2008
@@ -37,11 +37,15 @@
private bool indexer_running;
private bool shutdown_requested;
+ public RemoteClient ()
+ {
+ ShowDebugMessages = true;
+ }
+
protected override void ResetState ()
{
lock (shutdown_mutex) {
if (indexer_running) {
- Console.WriteLine ("Triggering reset");
shutdown_requested = true;
}
}
@@ -55,7 +59,7 @@
}
int i = 0;
- Console.Write ("UPDATING INDEX... ");
+ Console.Write ("Updating Index... ");
while (i++ < 20 && !Shutdown) {
Console.Write ("{0} ", i);
System.Threading.Thread.Sleep (1000);
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 15 19:15:17 2008
@@ -29,6 +29,8 @@
using System;
using System.Threading;
+using Hyena;
+
using NDesk.DBus;
using org.freedesktop.DBus;
@@ -48,16 +50,18 @@
private bool listening;
private ICollectionIndexerService service;
private bool cleanup_and_shutdown;
- private ManualResetEvent indexer_reset_event = new ManualResetEvent (true);
public void Start ()
{
+ Debug ("Acquiring org.freedesktop.DBus session instance");
session_bus = Bus.Session.GetObject<IBus> ("org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus"));
session_bus.NameOwnerChanged += OnBusNameOwnerChanged;
if (Bus.Session.NameHasOwner (indexer_bus_name)) {
+ Debug ("{0} is already started", indexer_bus_name);
ConnectToIndexerService ();
} else {
+ Debug ("Starting {0}", indexer_bus_name);
Bus.Session.StartServiceByName (indexer_bus_name);
}
}
@@ -65,6 +69,7 @@
private void OnBusNameOwnerChanged (string name, string oldOwner, string newOwner)
{
if (name == indexer_bus_name) {
+ Debug ("NameOwnerChanged: {0}, '{1}' => '{2}'", name, oldOwner, newOwner);
if (String.IsNullOrEmpty (newOwner)) {
// Do not disconnect since we're already disconnected
ResetInternalState ();
@@ -78,12 +83,16 @@
{
if (HasCollectionChanged) {
ThreadPool.QueueUserWorkItem (delegate {
+ Debug ("Running indexer");
+
try {
UpdateIndex ();
} catch (Exception e) {
Console.Error.WriteLine (e);
}
+ Debug ("Indexer finished");
+
if (!ApplicationAvailable || !listening) {
DisconnectFromIndexerService ();
}
@@ -96,9 +105,12 @@
DisconnectFromIndexerService ();
ResolveIndexerService ();
+ Debug ("Connected to {0}", service_interface);
+
service.CleanupAndShutdown += OnCleanupAndShutdown;
if (ApplicationAvailable) {
+ Debug ("Listening to service's CollectionChanged signal (full-app is running)");
listening = true;
service.CollectionChanged += OnCollectionChanged;
}
@@ -112,6 +124,8 @@
return;
}
+ Debug ("Disconnecting from service");
+
if (listening) {
try {
listening = false;
@@ -131,6 +145,7 @@
private void ResetInternalState ()
{
+ Debug ("Resetting internal state - service is no longer available or not needed");
service = null;
listening = false;
cleanup_and_shutdown = false;
@@ -143,6 +158,7 @@
while (attempts++ < 4) {
try {
+ Debug ("Resolving {0} (attempt {1})", service_interface, attempts);
service = Bus.Session.GetObject<ICollectionIndexerService> (indexer_bus_name, service_path);
service.Hello ();
return;
@@ -163,12 +179,22 @@
cleanup_and_shutdown = true;
}
+ protected void Debug (string message, params object [] args)
+ {
+ Log.DebugFormat (message, args);
+ }
+
protected abstract bool HasCollectionChanged { get; }
protected abstract void UpdateIndex ();
protected abstract void ResetState ();
+ public bool ShowDebugMessages {
+ get { return Log.Debugging; }
+ set { Log.Debugging = value; }
+ }
+
protected bool CleanupAndShutdown {
get { return cleanup_and_shutdown; }
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexer.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexer.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexer.cs Mon Sep 15 19:15:17 2008
@@ -43,7 +43,7 @@
namespace Banshee.Collection.Indexer
{
[DBusExportable (ServiceName = "CollectionIndexer")]
- public class CollectionIndexer : ICollectionIndexer, IDisposable
+ public class CollectionIndexer : ICollectionIndexer, IService, IDBusExportable, IDisposable
{
private static int instance_count = 0;
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/CollectionIndexerService.cs Mon Sep 15 19:15:17 2008
@@ -42,7 +42,7 @@
namespace Banshee.Collection.Indexer
{
[DBusExportable (ServiceName = "CollectionIndexer")]
- public class CollectionIndexerService : ICollectionIndexerService, IDisposable
+ public class CollectionIndexerService : ICollectionIndexerService, IDBusExportable, IDisposable
{
private List<LibrarySource> libraries = new List<LibrarySource> ();
private string [] available_export_fields;
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexer.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexer.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexer.cs Mon Sep 15 19:15:17 2008
@@ -37,7 +37,7 @@
public delegate void SaveToXmlFinishedHandler (bool success, string path);
[Interface ("org.bansheeproject.CollectionIndexer.Indexer")]
- public interface ICollectionIndexer : IService, IDBusExportable
+ public interface ICollectionIndexer
{
event Hyena.Action IndexingFinished;
event SaveToXmlFinishedHandler SaveToXmlFinished;
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexerService.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexerService.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Indexer/ICollectionIndexerService.cs Mon Sep 15 19:15:17 2008
@@ -34,7 +34,7 @@
namespace Banshee.Collection.Indexer
{
[Interface ("org.bansheeproject.CollectionIndexer.Service")]
- public interface ICollectionIndexerService : IService, IDBusExportable
+ public interface ICollectionIndexerService : IService
{
event Hyena.Action CollectionChanged;
event Hyena.Action CleanupAndShutdown;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]