diff options
author | Manuel Quiñones <manuq@laptop.org> | 2012-09-20 04:56:17 (GMT) |
---|---|---|
committer | Manuel Quiñones <manuq@laptop.org> | 2012-09-20 12:50:12 (GMT) |
commit | 2a5fd4b2d1547d1ca52ff3e5f7230456d051082a (patch) | |
tree | dbc75cc48ef197866788b22cbad2bcffc8ec40c8 /src | |
parent | e92baeeba033ae2fc4276ea088d6036e284dfd56 (diff) |
Port Volume palette that has mixed content to new API
This fixes VolumePalette that is used in the Journal, and in the
volume device icon.
Had to set the content box (the one passed to set_content) a property
of the palette. Otherwise the "Show Contents" can't be added from the
device icon. Previously the palette.menu attribute was used for that.
Also I had to reorder the "Show Contents" item because pack_end nor
pack_start didn't pack it to the correct place.
Note that the separator packed after the Remove item is not visible.
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/jarabe/view/palettes.py | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/jarabe/view/palettes.py b/src/jarabe/view/palettes.py index 50f6c83..35475d0 100644 --- a/src/jarabe/view/palettes.py +++ b/src/jarabe/view/palettes.py @@ -216,31 +216,35 @@ class VolumePalette(Palette): path = mount.get_root().get_path() self.props.secondary_text = glib.markup_escape_text(path) - vbox = Gtk.VBox() - self.set_content(vbox) - vbox.show() + self.content_box = Gtk.VBox() + self.set_content(self.content_box) + self.content_box.show() + + menu_item = PaletteMenuItem(pgettext('Volume', 'Remove')) + + icon = Icon(icon_name='media-eject', icon_size=Gtk.IconSize.MENU) + menu_item.set_image(icon) + icon.show() + + menu_item.connect('activate', self.__unmount_activate_cb) + self.content_box.pack_start(menu_item, True, True, 0) + menu_item.show() + + separator = PaletteMenuItemSeparator() + self.content_box.pack_start(separator, True, True, 0) + separator.show() self._progress_bar = Gtk.ProgressBar() - vbox.add(self._progress_bar) + self.content_box.pack_start(self._progress_bar, True, True, 0) self._progress_bar.show() self._free_space_label = Gtk.Label() self._free_space_label.set_alignment(0.5, 0.5) - vbox.add(self._free_space_label) + self.content_box.pack_start(self._free_space_label, True, True, 0) self._free_space_label.show() self.connect('popup', self.__popup_cb) - menu_item = MenuItem(pgettext('Volume', 'Remove')) - - icon = Icon(icon_name='media-eject', icon_size=Gtk.IconSize.MENU) - menu_item.set_image(icon) - icon.show() - - menu_item.connect('activate', self.__unmount_activate_cb) - self.menu.append(menu_item) - menu_item.show() - def __unmount_activate_cb(self, menu_item): self._mount.unmount(self.__unmount_cb) |