aboutsummaryrefslogtreecommitdiff
path: root/src/prepaid-manager-applet.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2020-04-06 15:37:53 +0200
committerGuido Günther <agx@sigxcpu.org>2020-04-06 15:38:53 +0200
commit4480d9de3823a2c223b02bb8ad516947d0854986 (patch)
treecafff2376c73a2d71f9769042bc0aa1388bcf2b7 /src/prepaid-manager-applet.py
parent4501f4ce81cf10152808282fd669e9b6653e5c93 (diff)
Fix modem enablement
This got broken when switching to the ModemManager1 API. Instead of checking the error, check state upfront.
Diffstat (limited to 'src/prepaid-manager-applet.py')
-rwxr-xr-xsrc/prepaid-manager-applet.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/prepaid-manager-applet.py b/src/prepaid-manager-applet.py
index 9c44f29..155b7d2 100755
--- a/src/prepaid-manager-applet.py
+++ b/src/prepaid-manager-applet.py
@@ -88,6 +88,9 @@ class PPMController(Gtk.Application):
def fetch_balance(self):
"""Fetch the current account balance from the network"""
+ if not self.mm.modem.enabled:
+ self.view.show_modem_enable()
+
if not self.provider.fetch_balance(self.mm,
reply_func=self.on_balance_info_fetched,
error_func=self.on_modem_error):
@@ -170,6 +173,11 @@ class PPMController(Gtk.Application):
"""Fetch the imsi and deduce account and provider information"""
logging.debug("Fetching account information")
+
+ if not self.mm.modem.enabled:
+ self.view.show_modem_enable()
+ return False
+
try:
self.imsi = self.mm.get_imsi()
except ModemError as me:
@@ -177,12 +185,8 @@ class PPMController(Gtk.Application):
if me.is_forbidden():
self.view.show_provider_assistant()
return False
- if not me.is_disabled():
- self.view.show_modem_error(me.msg)
- return False
- logging.info("modem not enabled.")
- self.view.show_modem_enable()
+ self.view.show_modem_error(me.msg)
return False
try: