Welcome to mirror list, hosted at ThFree Co, Russian Federation.

__init__.py « osx « src - dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 263633712fafd4da0af91086c2629af4eb184c85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import sys, commands
from network_manager_listener import device_now_active, device_no_longer_active


if sys.platform != 'darwin':
	raise ImportError('System platform is not OS X')

net_device_active = True

###
### Utility functions
###

def checkPID(pid, procname):
	out = commands.getstatusoutput("ps -wwp %d" % pid)
	arr = out[1].split("\n")
	if ((len(arr) == 2) and (arr[1].find(procname) >= 0)):
		return True
	return False

import nsapp

def init():
	nsapp.init()
	nsapp.setNetworkCB(netDeviceChanged)
	return


def shutdown():
	import dbus
	dbus.shutdown()
	return


def netDeviceChanged():
	global net_device_active
	if net_device_active:
		net_device_active = False
		device_no_longer_active(None)
	else:
		net_device_active = True
		device_now_active(None)
	return