From: epage Date: Fri, 4 Jul 2008 15:17:43 +0000 (+0000) Subject: * Explicitly set the python version X-Git-Url: http://git.maemo.org/git/?p=gc-dialer;a=commitdiff_plain;h=8c669dc34f5f05af5d9fcd0eea67afba21a02447 * Explicitly set the python version * Started working on the device state callback (hopefully it works) git-svn-id: file:///svnroot/gc-dialer/trunk@53 c39d3808-3fe2-4d86-a59f-b7f623ee9f21 --- diff --git a/build_script.sh b/build_script.sh index e54fbfa..122b413 100755 --- a/build_script.sh +++ b/build_script.sh @@ -47,7 +47,7 @@ cp gc_dialer/gc_dialer.glade $BUILD_BASE/usr/local/lib #Construct the program by cat-ing all the python files together -echo "#!/usr/bin/python" > $BUILD_BASE/usr/local/bin/gc_dialer.py +echo "#!/usr/bin/python2.5" > $BUILD_BASE/usr/local/bin/gc_dialer.py #echo "from __future__ import with_statement" >> $BUILD_BASE/usr/local/bin/gc_dialer.py cat gc_dialer/gc_dialer.py gc_dialer/gcbackend.py gc_dialer/browser_emu.py | grep -e '^import ' | sort -u >> $BUILD_BASE/usr/local/bin/gc_dialer.py cat gc_dialer/browser_emu.py gc_dialer/gcbackend.py gc_dialer/gc_dialer.py | grep -v 'browser_emu' | grep -v 'gcbackend' | grep -v "#!" >> $BUILD_BASE/usr/local/bin/gc_dialer.py diff --git a/gc_dialer/gc_dialer.py b/gc_dialer/gc_dialer.py index d4d4fe6..0f16195 100755 --- a/gc_dialer/gc_dialer.py +++ b/gc_dialer/gc_dialer.py @@ -383,10 +383,23 @@ class Dialpad(object): def on_device_state_change(self, shutdown, save_unsaved_data, memory_low, system_inactivity, message, userData): """ + For shutdown or save_unsaved_data, our only state is cookies and I think the cookie manager handles that for us. + For system_inactivity, we have no background tasks to pause + @todo Might be useful to do something when going in offline mode or low memory @note Hildon specific """ - pass + if shutdown or save_unsaved_data: + pass + + if memory_low: + self.gcd.clear_caches() + re.purge() + gc.collect() + + #if offline (how do I tell this? the message somehow?) + # disable the gui? + # disable clearing of caches and when they click dial, request to connect? def setNumber(self, number): self.phonenumber = makeugly(number) diff --git a/gc_dialer/gcbackend.py b/gc_dialer/gcbackend.py index e84e7d2..29a6721 100644 --- a/gc_dialer/gcbackend.py +++ b/gc_dialer/gcbackend.py @@ -172,6 +172,12 @@ class GCDialer(object): return c.value return None + def clear_caches(self): + """ + @todo Fill this in + """ + pass + def reset(self): self._lastAuthed = 0.0 self._browser.cookies.clear()