aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/sysactivity
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2011-09-02 11:24:50 +0000
committerDamian Minkov <damencho@jitsi.org>2011-09-02 11:24:50 +0000
commit475b9c0479ec4169182cd8b3bf9db6abff323670 (patch)
tree802b37b1681c842436a6677bb2580bbf978df757 /src/net/java/sip/communicator/impl/sysactivity
parent94ee4e2f2e8e93552dde615d834cfc1f07ebed9d (diff)
downloadjitsi-475b9c0479ec4169182cd8b3bf9db6abff323670.zip
jitsi-475b9c0479ec4169182cd8b3bf9db6abff323670.tar.gz
jitsi-475b9c0479ec4169182cd8b3bf9db6abff323670.tar.bz2
Forces gtalk ice enabled on systems with already saved preferences (property name change).
Fixes a problem with network detection on machines missing network manager (linux).
Diffstat (limited to 'src/net/java/sip/communicator/impl/sysactivity')
-rw-r--r--src/net/java/sip/communicator/impl/sysactivity/NetworkManagerListenerImpl.java9
-rw-r--r--src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotifications.java13
-rw-r--r--src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotificationsServiceImpl.java55
3 files changed, 77 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/impl/sysactivity/NetworkManagerListenerImpl.java b/src/net/java/sip/communicator/impl/sysactivity/NetworkManagerListenerImpl.java
index 7260701..96bed15 100644
--- a/src/net/java/sip/communicator/impl/sysactivity/NetworkManagerListenerImpl.java
+++ b/src/net/java/sip/communicator/impl/sysactivity/NetworkManagerListenerImpl.java
@@ -160,4 +160,13 @@ public class NetworkManagerListenerImpl
.fireSystemActivityEvent(evt);
}
}
+
+ /**
+ * Whether we are connected to the network manager through dbus.
+ * @return whether we are connected to the network manager.
+ */
+ public boolean isConnected()
+ {
+ return dbusConn != null;
+ }
}
diff --git a/src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotifications.java b/src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotifications.java
index 6264b49..f503b19 100644
--- a/src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotifications.java
+++ b/src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotifications.java
@@ -74,6 +74,8 @@ public class SystemActivityNotifications
*/
private static long notifierInstance = -1;
+ private static boolean loaded = false;
+
/**
* Init native library.
*/
@@ -84,6 +86,8 @@ public class SystemActivityNotifications
System.loadLibrary("sysactivitynotifications");
notifierInstance = allocAndInit();
+
+ loaded = true;
}
catch(Throwable t)
{
@@ -191,4 +195,13 @@ public class SystemActivityNotifications
long type,
boolean connected);
}
+
+ /**
+ * Whether native library is loaded.
+ * @return whether native library is loaded.
+ */
+ public static boolean isLoaded()
+ {
+ return loaded;
+ }
}
diff --git a/src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotificationsServiceImpl.java b/src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotificationsServiceImpl.java
index 112fe93..903435e 100644
--- a/src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotificationsServiceImpl.java
+++ b/src/net/java/sip/communicator/impl/sysactivity/SystemActivityNotificationsServiceImpl.java
@@ -474,4 +474,59 @@ public class SystemActivityNotificationsServiceImpl
logger.error("Error delivering event", e);
}
}
+
+ /**
+ * Can check whether an event id is supported on
+ * current operation system.
+ * Simple return what is implemented in native, and checks
+ * are made when possible, for example linux cannot connect
+ * to NM through dbus.
+ * @param eventID the event to check.
+ * @return whether the supplied event id is supported.
+ */
+ public boolean isSupported(int eventID)
+ {
+ if(OSUtils.IS_WINDOWS)
+ {
+ if(!SystemActivityNotifications.isLoaded())
+ return false;
+
+ switch(eventID)
+ {
+ case SystemActivityEvent.EVENT_SLEEP:
+ case SystemActivityEvent.EVENT_WAKE:
+ case SystemActivityEvent.EVENT_NETWORK_CHANGE:
+ case SystemActivityEvent.EVENT_SYSTEM_IDLE:
+ case SystemActivityEvent.EVENT_SYSTEM_IDLE_END:
+ return true;
+ default:
+ return false;
+ }
+ }
+ else if(OSUtils.IS_MAC)
+ {
+ return SystemActivityNotifications.isLoaded();
+ }
+ else if(OSUtils.IS_LINUX)
+ {
+ switch(eventID)
+ {
+ case SystemActivityEvent.EVENT_SLEEP:
+ case SystemActivityEvent.EVENT_NETWORK_CHANGE:
+ {
+ return NetworkManagerListenerImpl.getInstance()
+ .isConnected();
+ }
+ case SystemActivityEvent.EVENT_SYSTEM_IDLE:
+ case SystemActivityEvent.EVENT_SYSTEM_IDLE_END:
+ {
+ return SystemActivityNotifications.isLoaded();
+ }
+ default:
+ return false;
+ }
+ }
+ else
+ return false;
+ }
}