X-Git-Url: http://git.maemo.org/git/?p=watersofshiloah;a=blobdiff_plain;f=src%2Fmormonchannel_gtk.py;h=0d023728f3b6c217661890a84316a68a9a98ca06;hp=7c570cde0e90b3bc9d7fd79b6f4d9a9ca72a871a;hb=5319a1d1c738a0856e3a3fbd13071bd8b46e8307;hpb=bf983084fcb46a045684cb62014a0693527907e3 diff --git a/src/mormonchannel_gtk.py b/src/mormonchannel_gtk.py index 7c570cd..0d02372 100755 --- a/src/mormonchannel_gtk.py +++ b/src/mormonchannel_gtk.py @@ -2,14 +2,19 @@ # -*- coding: utf-8 -*- """ -@bug Fix segfault on closing of window while playing @todo Need to confirm id's are persistent (not just for todos but broken behavior on transition) @todo Track recent @todo Persisted Pause @todo Favorites @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 + @todo Mormon Messages +@todo Reverse order option. Toggle between playing ascending/descending chronological order +@todo Jump to website +@todo Offline mode +@todo Re-use windows for better performance +@todo Make radio program updates only happen when the app has focus to reduce CPU wakes """ from __future__ import with_statement @@ -68,8 +73,9 @@ class MormonChannelProgram(hildonize.get_app_class()): self._osso_c = None self._deviceState = None - self._sourceSelector = windows.source.SourceSelector(self._player, self._store, self._index) + self._sourceSelector = windows.source.SourceSelector(self, self._player, self._store, self._index) self._sourceSelector.window.connect("destroy", self._on_destroy) + self._sourceSelector.window.set_default_size(400, 800) self._sourceSelector.show() self._load_settings() except: @@ -106,39 +112,42 @@ 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() + except Exception: + _moduleLogger.exception("Error saving settigns") + try: + self._player.stop() + except Exception: + _moduleLogger.exception("Error stopping player") + try: self._index.stop() + except Exception: + _moduleLogger.exception("Error stopping index") + try: self._store.stop() + except Exception: + _moduleLogger.exception("Error stopping store") - 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() - - @misc_utils.log_exception(_moduleLogger) - def _on_show_about(self, widget = None, data = None): - dialog = gtk.AboutDialog() - dialog.set_position(gtk.WIN_POS_CENTER) - dialog.set_name(constants.__pretty_app_name__) - dialog.set_version(constants.__version__) - dialog.set_copyright("") - dialog.set_website("") - comments = "Mormon Radio and Audiobook Player" - dialog.set_comments(comments) - dialog.set_authors(["Ed Page "]) - dialog.run() - dialog.destroy() + try: + self._deviceState.close() + except AttributeError: + pass # Either None or close was removed (in Fremantle) + except Exception: + _moduleLogger.exception("Error closing device state") + try: + self._osso_c.close() + except AttributeError: + pass # Either None or close was removed (in Fremantle) + except Exception: + _moduleLogger.exception("Error closing osso state") def run(): @@ -146,7 +155,9 @@ def run(): gtk.gdk.threads_init() l = dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) - hildonize.set_application_title(constants.__pretty_app_name__) + # HACK Playback while silent on Maemo 5 + hildonize.set_application_name("FMRadio") + app = MormonChannelProgram() if not PROFILE_STARTUP: try: @@ -154,6 +165,8 @@ def run(): except KeyboardInterrupt: app.quit() raise + else: + app.quit() if __name__ == "__main__":