A bit closer to functionality
authorKristoffer Grönlund <kristoffer.gronlund@purplescout.se>
Tue, 5 Jan 2010 16:46:56 +0000 (17:46 +0100)
committerKristoffer Grönlund <kristoffer.gronlund@purplescout.se>
Wed, 6 Jan 2010 13:56:42 +0000 (14:56 +0100)
helldon/__init__.py
jamaui/ui.py

index c333823..0959038 100644 (file)
@@ -18,7 +18,7 @@ class Program(gtk.Window):
         self.set_app_paintable(True)
         self._vbox = gtk.VBox()
         self._title = gtk.Label("Jamaendo")
         self.set_app_paintable(True)
         self._vbox = gtk.VBox()
         self._title = gtk.Label("Jamaendo")
-        self._backbtn = gtk.Button("<<<")
+        self._backbtn = gtk.Button("Quit")
         self._hbox = gtk.HBox()
         self._hbox.pack_start(self._title, True)
         self._hbox.pack_start(self._backbtn, False)
         self._hbox = gtk.HBox()
         self._hbox.pack_start(self._title, True)
         self._hbox.pack_start(self._backbtn, False)
@@ -56,6 +56,10 @@ class Program(gtk.Window):
         self._notebook.set_current_page(idx)
         wnd.show_all()
         wnd._nb_index = idx
         self._notebook.set_current_page(idx)
         wnd.show_all()
         wnd._nb_index = idx
+        if self._stack:
+            self._backbtn.set_label("<<<")
+        else:
+            self._backbtn.set_label("Quit")
 
     def popped_stackable(self, wnd=None):
         pass
 
     def popped_stackable(self, wnd=None):
         pass
@@ -71,6 +75,15 @@ class Program(gtk.Window):
 
     def on_back(self, *args):
         self.pop_stackable()
 
     def on_back(self, *args):
         self.pop_stackable()
+        if self._stack:
+            self._backbtn.set_label("<<<")
+        else:
+            self._backbtn.set_label("Quit")
+        if self._notebook.get_n_pages() == 0:
+            gtk.main_quit()
+
+    def size(self):
+        return len(self._stack)+1
 
 class StackableWindow(gtk.Frame):
     def __init__(self):
 
 class StackableWindow(gtk.Frame):
     def __init__(self):
@@ -87,6 +100,9 @@ class StackableWindow(gtk.Frame):
     def on_destroy(self, *args):
         Program.instance.popped_stackable(self)
 
     def on_destroy(self, *args):
         Program.instance.popped_stackable(self)
 
+    def get_stack(self):
+        return Program.instance
+
 class AppMenu(object):
     def __init__(self):
         pass
 class AppMenu(object):
     def __init__(self):
         pass
index dda0ecc..5732ee7 100644 (file)
@@ -170,10 +170,14 @@ class Jamaui(object):
         jamaendo.get_images_async(self.got_images, urls)
 
     def got_album_cover(self, albumid, size, cover):
         jamaendo.get_images_async(self.got_images, urls)
 
     def got_album_cover(self, albumid, size, cover):
+        gtk.gdk.threads_enter()
         postoffice.notify('album-cover', albumid, size, cover)
         postoffice.notify('album-cover', albumid, size, cover)
+        gtk.gdk.threads_leave()
 
     def got_images(self, images):
 
     def got_images(self, images):
+        gtk.gdk.threads_enter()
         postoffice.notify('images', images)
         postoffice.notify('images', images)
+        gtk.gdk.threads_leave()
 
     #def add_featured_button(self):
     #    self.featured_sel = hildon.TouchSelector(text=True)
 
     #def add_featured_button(self):
     #    self.featured_sel = hildon.TouchSelector(text=True)