aboutsummaryrefslogtreecommitdiff
path: root/data/usr/bin
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-12-19 19:17:35 +0100
committerRobert Tari <robert@tari.in>2021-12-19 19:17:35 +0100
commit2be507e96007b97d73995936ad50c469a4a8a798 (patch)
tree38d89a81ef4cf6a97af403f32053ee05a96d0141 /data/usr/bin
parent552c6119e7faba2924b9381ef291f89861f83a28 (diff)
downloadayatana-webmail-2be507e96007b97d73995936ad50c469a4a8a798.tar.gz
ayatana-webmail-2be507e96007b97d73995936ad50c469a4a8a798.tar.bz2
ayatana-webmail-2be507e96007b97d73995936ad50c469a4a8a798.zip
Do not run helper applications unless ayatana-webmail is running
Diffstat (limited to 'data/usr/bin')
-rwxr-xr-xdata/usr/bin/ayatana-webmail-clear13
-rwxr-xr-xdata/usr/bin/ayatana-webmail-settings30
-rwxr-xr-xdata/usr/bin/ayatana-webmail-url8
3 files changed, 21 insertions, 30 deletions
diff --git a/data/usr/bin/ayatana-webmail-clear b/data/usr/bin/ayatana-webmail-clear
index 744f709..500195f 100755
--- a/data/usr/bin/ayatana-webmail-clear
+++ b/data/usr/bin/ayatana-webmail-clear
@@ -6,7 +6,6 @@
import sys
import dbus
-
from gi.repository import GLib
from dbus.mainloop.glib import DBusGMainLoop
from ayatanawebmail.common import isRunning
@@ -15,11 +14,11 @@ oLoop = None
if __name__ == '__main__':
- DBusGMainLoop(set_as_default=True)
- oSessionBus = dbus.SessionBus()
-
if isRunning():
+ DBusGMainLoop(set_as_default=True)
+ oSessionBus = dbus.SessionBus()
+
try:
oSession = oSessionBus.get_object('org.ayatana.webmail', '/org/ayatana/webmail')
@@ -29,12 +28,14 @@ if __name__ == '__main__':
oLoop = GLib.MainLoop()
oLoop.run()
+ sys.exit(0)
except dbus.DBusException as oDBusException:
print(oDBusException)
- sys.exit(1)
- sys.exit(0)
+ else:
+
+ print("Cannot start ayatana-webmail-clear - Ayatana Webmail is not running.")
sys.exit(1)
diff --git a/data/usr/bin/ayatana-webmail-settings b/data/usr/bin/ayatana-webmail-settings
index 63db1f7..1f53914 100755
--- a/data/usr/bin/ayatana-webmail-settings
+++ b/data/usr/bin/ayatana-webmail-settings
@@ -6,7 +6,6 @@
import sys
import dbus
-import subprocess
from gi.repository import GLib
from dbus.mainloop.glib import DBusGMainLoop
from ayatanawebmail.common import isRunning
@@ -15,33 +14,28 @@ oLoop = None
if __name__ == '__main__':
- # HACK: Debian reports that ayatana-webmail-settings is not running, but shows two instances of ayatana-webmail
- if isRunning('-settings') == 1 or isRunning() == 2:
+ if isRunning():
DBusGMainLoop(set_as_default=True)
oSessionBus = dbus.SessionBus()
- if isRunning():
+ try:
- try:
+ oSession = oSessionBus.get_object('org.ayatana.webmail', '/org/ayatana/webmail')
+ oInterface = dbus.Interface(oSession, 'org.ayatana.webmail')
- oSession = oSessionBus.get_object('org.ayatana.webmail', '/org/ayatana/webmail')
- oInterface = dbus.Interface(oSession, 'org.ayatana.webmail')
+ oInterface.settings(reply_handler=lambda: oLoop.quit(), error_handler=lambda o: oLoop.quit())
- oInterface.settings(reply_handler=lambda: oLoop.quit(), error_handler=lambda o: oLoop.quit())
-
- oLoop = GLib.MainLoop()
- oLoop.run()
-
- except dbus.DBusException as oDBusException:
+ oLoop = GLib.MainLoop()
+ oLoop.run()
+ sys.exit(0)
- print(oDBusException)
- sys.exit(1)
+ except dbus.DBusException as oDBusException:
- sys.exit(0)
+ print(oDBusException)
- else:
+ else:
- subprocess.Popen(['ayatana-webmail'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ print("Cannot start ayatana-webmail-settings - Ayatana Webmail is not running.")
sys.exit(1)
diff --git a/data/usr/bin/ayatana-webmail-url b/data/usr/bin/ayatana-webmail-url
index f65e66d..bb8fbae 100755
--- a/data/usr/bin/ayatana-webmail-url
+++ b/data/usr/bin/ayatana-webmail-url
@@ -6,7 +6,6 @@
# License: GNU GPL 3 or higher; http://www.gnu.org/licenses/gpl.html
import sys
-import subprocess
import dbus
from gi.repository import GLib
from dbus.mainloop.glib import DBusGMainLoop
@@ -50,17 +49,14 @@ if __name__ == '__main__':
except dbus.DBusException as oDBusException:
print(oDBusException)
- sys.exit(1)
else:
- subprocess.Popen(['ayatana-webmail'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- sys.exit(0)
+ print("Cannot start ayatana-webmail-url - Ayatana Webmail is not running.")
else:
print('ayatana-webmail-url must be called with one of these arguments: Home, Compose, Inbox or Sent')
- sys.exit(1)
- sys.exit(0)
+ sys.exit(1)