[banshee] DBus: don't try to connect in GrabDefaultName() if DBus disabled
- From: Andrés Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] DBus: don't try to connect in GrabDefaultName() if DBus disabled
- Date: Sun, 23 Feb 2014 11:36:08 +0000 (UTC)
commit 9179c7a95c13edb766466b7b31e856147ea07e96
Author: Andrés G. Aragoneses <knocte gmail com>
Date: Sun Feb 23 12:36:00 2014 +0100
DBus: don't try to connect in GrabDefaultName() if DBus disabled
If DBus was not enabled, we were properly returning true (as in
primary_instance == true) but we were trying to connect when
we should not.
Also, by changing primary_instance to be initialized to true,
instead of false, at first, then we need to change its value in
less places.
.../Banshee.ServiceStack/DBusConnection.cs | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.ServiceStack/DBusConnection.cs
b/src/Core/Banshee.Services/Banshee.ServiceStack/DBusConnection.cs
index a72bb26..33f91cb 100644
--- a/src/Core/Banshee.Services/Banshee.ServiceStack/DBusConnection.cs
+++ b/src/Core/Banshee.Services/Banshee.ServiceStack/DBusConnection.cs
@@ -128,23 +128,23 @@ namespace Banshee.ServiceStack
// false if Banshee is already running. If DBus is not available, we assume we're the primary
instance
public static bool GrabDefaultName ()
{
- bool primary_instance = false;
-
- connect_tried = true;
+ bool primary_instance = true;
if (!enabled) {
- primary_instance = true;
+ return primary_instance;
}
+ connect_tried = true;
+
try {
if (Connect (DefaultServiceName, true) == RequestNameReply.PrimaryOwner) {
active_connections.Add (DefaultServiceName);
- primary_instance = true;
+ } else {
+ primary_instance = false;
}
} catch (Exception e) {
Log.Exception ("DBus support could not be started. Disabling for this session.", e);
enabled = false;
- primary_instance = true;
}
return primary_instance;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]