Kaydet (Commit) 5a5adb9f authored tarafından Bahadır Kandemir's avatar Bahadır Kandemir

Use DBus frontend in desktop environment

üst fe580565
......@@ -129,7 +129,18 @@ class Call:
raise AttributeError, "Package name required for non-async calls."
def queryPolicyKit(self, action):
if not self.link.use_agent:
if self.link.use_agent:
bus = dbus.SessionBus()
try:
obj = bus.get_object("org.freedesktop.PolicyKit.AuthenticationAgent", "/")
except dbus.DBusException, exception:
return False
iface = dbus.Interface(obj, "org.freedesktop.PolicyKit.AuthenticationAgent")
try:
return iface.ObtainAuthorization(action, 0, os.getpid(), timeout=2**16-1) == 1
except:
return False
else:
os.environ["POLKIT_AUTH_FORCE_TEXT"] = "1"
ret = subprocess.call(["/usr/bin/polkit-auth", "--obtain", action])
if ret == 0:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment