Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/HomeWindow.py
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-07-08 13:47:51 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-07-08 13:47:51 (GMT)
commitd4cb9a27149126de64fb003aafb8673633b885b0 (patch)
tree2a69b1cbb14ea5722c931648afbcddfe8c317f22 /shell/HomeWindow.py
parent0cbe559dbf6a5a324828a94e28fe06e9fbb26f9c (diff)
More work on the new design
Diffstat (limited to 'shell/HomeWindow.py')
-rw-r--r--shell/HomeWindow.py59
1 files changed, 32 insertions, 27 deletions
diff --git a/shell/HomeWindow.py b/shell/HomeWindow.py
index de26498..72e4bfd 100644
--- a/shell/HomeWindow.py
+++ b/shell/HomeWindow.py
@@ -1,45 +1,50 @@
+from gettext import gettext as _
+
import gtk
from sugar.activity import Activity
-class NewActivityButton(gtk.Button):
- def __init__(self):
- gtk.Button.__init__(self)
+class NewActivityButton(gtk.MenuToolButton):
+ def __init__(self, shell):
+ gtk.MenuToolButton.__init__(self, None, _('New Activity'))
- hbox = gtk.HBox(False, 6)
-
- label = gtk.Label("New Activity")
- hbox.pack_start(label)
- label.show()
+ self._shell = shell
- arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_NONE)
- hbox.pack_start(arrow)
- arrow.show()
-
- self.set_image(hbox)
-
- self.connect("clicked", self.__clicked_cb)
+ self.set_menu(gtk.Menu())
+ self.connect("show-menu", self.__show_menu_cb)
- def __clicked_cb(self, button):
- print Activity.list_activities
+ def __show_menu_cb(self, button):
+ menu = gtk.Menu()
+
+ for activity_info in self._shell.get_registry().list_activities():
+ item = gtk.MenuItem(activity_info.get_title(), False)
+ name = activity_info.get_name()
+ item.connect('activate', self.__menu_item_activate_cb, name)
+ menu.append(item)
+ item.show()
+
+ self.set_menu(menu)
+
+ def __menu_item_activate_cb(self, item, name):
+ Activity.create(name)
-class Toolbar(gtk.HBox):
- def __init__(self):
- gtk.HBox.__init__(self)
+class Toolbar(gtk.Toolbar):
+ def __init__(self, shell):
+ gtk.Toolbar.__init__(self)
- new_activity_button = NewActivityButton()
- self.pack_start(new_activity_button)
+ new_activity_button = NewActivityButton(shell)
+ self.insert(new_activity_button, -1)
new_activity_button.show()
class HomeWindow(gtk.Window):
- def __init__(self):
+ def __init__(self, shell):
gtk.Window.__init__(self)
-
+
vbox = gtk.VBox()
- toolbar = Toolbar()
- vbox.pack_start(toolbar)
+ toolbar = Toolbar(shell)
+ vbox.pack_start(toolbar, False)
toolbar.show()
self.add(vbox)
-
+ vbox.show()