* Explicitly set the python version
authorepage <eopage@byu.net>
Fri, 4 Jul 2008 15:17:43 +0000 (15:17 +0000)
committerepage <eopage@byu.net>
Fri, 4 Jul 2008 15:17:43 +0000 (15:17 +0000)
 * Started working on the device state callback (hopefully it works)

git-svn-id: file:///svnroot/gc-dialer/trunk@53 c39d3808-3fe2-4d86-a59f-b7f623ee9f21

build_script.sh
gc_dialer/gc_dialer.py
gc_dialer/gcbackend.py

index e54fbfa..122b413 100755 (executable)
@@ -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
index d4d4fe6..0f16195 100755 (executable)
@@ -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)
index e84e7d2..29a6721 100644 (file)
@@ -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()