Fixing issue with back button
[watersofshiloah] / src / mormonchannel_gtk.py
index e9dc1c8..9320663 100755 (executable)
@@ -2,11 +2,8 @@
 # -*- coding: utf-8 -*-
 
 """
-@todo Timezone issue with Mormon CHannel
-@todo Fix scrollto for Fremantle
-@todo backgrounds need some resizing
-@todo Icons on source selector need work
-@bug For some reason, the back/close button doesn't work when I nest multiple levels
+@todo Re-use windows for better performance
+@todo Make radio program updates only happen when the app has focus to reduce CPU wakes
 @todo Need to confirm id's are persistent (not just for todos but broken behavior on transition)
        @todo Track recent
        @todo Persisted Pause
@@ -14,6 +11,7 @@
 @todo Sleep timer
 @todo Reverse order option.  Toggle between playing ascending/descending chronological order
 @todo Podcast integration
+       @todo Default with BYU Devotionals, http://speeches.byu.edu/?act=help&page=podcast
 """
 
 from __future__ import with_statement
@@ -111,25 +109,26 @@ class MormonChannelProgram(hildonize.get_app_class()):
 
        @misc_utils.log_exception(_moduleLogger)
        def _on_destroy(self, widget = None, data = None):
-               self.quit()
+               try:
+                       self.quit()
+               finally:
+                       gtk.main_quit()
 
        def quit(self):
-               try:
-                       self._save_settings()
+               self._save_settings()
 
-                       self._index.stop()
-                       self._store.stop()
+               self._player.stop()
+               self._index.stop()
+               self._store.stop()
 
-                       try:
-                               self._deviceState.close()
-                       except AttributeError:
-                               pass # Either None or close was removed (in Fremantle)
-                       try:
-                               self._osso_c.close()
-                       except AttributeError:
-                               pass # Either None or close was removed (in Fremantle)
-               finally:
-                       gtk.main_quit()
+               try:
+                       self._deviceState.close()
+               except AttributeError:
+                       pass # Either None or close was removed (in Fremantle)
+               try:
+                       self._osso_c.close()
+               except AttributeError:
+                       pass # Either None or close was removed (in Fremantle)
 
        @misc_utils.log_exception(_moduleLogger)
        def _on_show_about(self, widget = None, data = None):
@@ -151,7 +150,7 @@ def run():
        gtk.gdk.threads_init()
        l = dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 
-       hildonize.set_application_title(constants.__pretty_app_name__)
+       hildonize.set_application_name("FMRadio") # Playback while silent on Maemo 5
        app = MormonChannelProgram()
        if not PROFILE_STARTUP:
                try:
@@ -159,6 +158,8 @@ def run():
                except KeyboardInterrupt:
                        app.quit()
                        raise
+       else:
+               app.quit()
 
 
 if __name__ == "__main__":