diff options
author | C. Scott Ananian <cscott@laptop.org> | 2008-09-18 21:31:13 (GMT) |
---|---|---|
committer | Martin Dengler <martin@martindengler.com> | 2008-09-18 22:14:15 (GMT) |
commit | 0d3bcc8ac54fbb177921ff1df370b970fa0c7871 (patch) | |
tree | d0bfbb96ea64146edc3b5c5f336e80ef180c9224 | |
parent | 062471abce2dfea292b1d36b3806409e9215fb6a (diff) |
#7685 Redo the "wordless" palette to use RadioToolButton instead of a menu.
Eben wants to use the menu part in the future to switch between "new activity"
and "resume document" modes in the favorites view, so he prefers we use
the 'custom content' section of the Palette. This also would let us switch
to a multi-row tabular layout in the future as well, although we don't have
enough layout options at the moment to make it worthwhile.
-rw-r--r-- | src/view/home/HomeBox.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/view/home/HomeBox.py b/src/view/home/HomeBox.py index a8bc0c2..0655253 100644 --- a/src/view/home/HomeBox.py +++ b/src/view/home/HomeBox.py @@ -326,23 +326,25 @@ class FavoritesButton(RadioToolButton): self._layout = _convert_layout_constant(profile_layout_constant) self._update_icon() - i = 0 + # someday, this will be a gtk.Table() + layouts_grid = gtk.HBox() + layout_item = None for layoutid, layoutclass in sorted(favoritesview._LAYOUT_MAP.items()): - menu_item = gtk.MenuItem() - menu_item.add(Icon(icon_name=layoutclass.icon_name, - icon_size=gtk.ICON_SIZE_MENU)) - menu_item.connect('activate', self.__layout_activate_cb, - layoutid) - self.props.palette.menu.attach(menu_item, i, i+1, 0, 1) - menu_item.show_all() - i += 1 - # in HEAD, we can have the palette.menu emit('item-inserted'), - # but sucrose-0.82 doesn't have that patch, so call a private method =( + layout_item = RadioToolButton(icon_name=layoutclass.icon_name, + group=layout_item, active=False) + if layoutid == self._layout: + layout_item.set_active(True) + layouts_grid.add(layout_item) + layout_item.connect('toggled', self.__layout_activate_cb, + layoutid) + layouts_grid.show_all() + self.props.palette.set_content(layouts_grid) self.props.palette._update_separators() - self.props.palette.menu.show() def __layout_activate_cb(self, menu_item, layout): + if not menu_item.get_active(): + return if self._layout == layout and self.props.active: return elif self._layout != layout: |