Some minor fixes and tweaks
[jamaendo] / jamaui / listbox.py
index edef878..dad31ef 100644 (file)
@@ -1,6 +1,11 @@
 # what the fuck, GTK
 import gtk
-import hildon
+try:
+    import hildon
+    _using_helldon = False
+except:
+    import helldon as hildon
+    _using_helldon = True
 
 class ListBox(gtk.TreeView):
     def __init__(self):
@@ -39,11 +44,11 @@ class ListBox(gtk.TreeView):
 
 class ListDialog(gtk.Dialog):
     def __init__(self, title, parent=None):
-        gtk.Dialog.__init__(self, title, parent)
+        gtk.Dialog.__init__(self, title, parent if not _using_helldon else None)
         self.listbox = ListBox()
         panarea = hildon.PannableArea()
         panarea.add(self.listbox)
-        panarea.set_size_request(800, 300)
+        panarea.set_size_request_policy(hildon.SIZE_REQUEST_CHILDREN)
         self.vbox.pack_start(panarea, True, True, 0)
 
         self.selected = None
@@ -56,7 +61,7 @@ class ListDialog(gtk.Dialog):
 
 class ButtonListDialog(gtk.Dialog):
     def __init__(self, title, parent=None):
-        gtk.Dialog.__init__(self, title, parent)
+        gtk.Dialog.__init__(self, title, parent if not _using_helldon else None)
         self.panarea = hildon.PannableArea()
         self.panarea.set_size_request(800, 400)
         self.buttons = gtk.VBox(False, 0)
@@ -64,8 +69,9 @@ class ButtonListDialog(gtk.Dialog):
         self.vbox.pack_start(self.panarea, True, True, 0)
 
     def add_button(self, label, clickcb, *args):
-        btn = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH|gtk.HILDON_SIZE_FINGER_HEIGHT, hildon.BUTTON_ARRANGEMENT_VERTICAL)
+        btn = hildon.Button(gtk.HILDON_SIZE_AUTO_WIDTH|gtk.HILDON_SIZE_FINGER_HEIGHT,
+                            hildon.BUTTON_ARRANGEMENT_VERTICAL)
         btn.set_label(label)
         btn.connect('clicked', clickcb, *args)
-        self.buttons.pack_end(btn, False, False, 0)
+        self.buttons.pack_start(btn, False, False, 0)