[Sugar-devel] [PATCH sugar] Fix the activities list palette

S. Daniel Francis francis at sugarlabs.org
Thu Dec 6 19:07:55 EST 2012


Thanks.
http://bugs.sugarlabs.org/ticket/4284

Walter,
Can you remove the corresponding GCI task?

2012/12/6 Daniel Narvaez <dwnarvaez at gmail.com>:
> From: Daniel Narvaez <dwnarvaez at gmail.com>
>
> ActivityPaletter was ported to use the content box. We cannot mix
> content box and menu.
> ---
>  src/jarabe/desktop/activitieslist.py |   18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/src/jarabe/desktop/activitieslist.py b/src/jarabe/desktop/activitieslist.py
> index 6594ee9..1a680fd 100644
> --- a/src/jarabe/desktop/activitieslist.py
> +++ b/src/jarabe/desktop/activitieslist.py
> @@ -30,8 +30,8 @@ from sugar3 import util
>  from sugar3.graphics import style
>  from sugar3.graphics.icon import Icon, CellRendererIcon
>  from sugar3.graphics.xocolor import XoColor
> -from sugar3.graphics.menuitem import MenuItem
>  from sugar3.graphics.alert import Alert
> +from sugar3.graphics.palettemenu import PaletteMenuItem
>
>  from jarabe.model import bundleregistry
>  from jarabe.view.palettes import ActivityPalette
> @@ -494,13 +494,14 @@ class ActivityListPalette(ActivityPalette):
>          self._favorite = registry.is_bundle_favorite(self._bundle_id,
>                                                       self._version)
>
> -        self._favorite_item = MenuItem('')
> +        self._favorite_item = PaletteMenuItem()
>          self._favorite_icon = Icon(icon_name='emblem-favorite',
>                  icon_size=Gtk.IconSize.MENU)
>          self._favorite_item.set_image(self._favorite_icon)
> +        self._favorite_icon.show()
>          self._favorite_item.connect('activate',
>                                      self.__change_favorite_activate_cb)
> -        self.menu.append(self._favorite_item)
> +        self.menu_box.append_item(self._favorite_item)
>          self._favorite_item.show()
>
>          if activity_info.is_user_activity():
> @@ -511,12 +512,12 @@ class ActivityListPalette(ActivityPalette):
>                  self.__activity_changed_cb)
>          self._update_favorite_item()
>
> -        self.menu.connect('destroy', self.__destroy_cb)
> +        self.menu_box.connect('destroy', self.__destroy_cb)
>
>      def _add_erase_option(self, registry, activity_info):
> -        menu_item = MenuItem(_('Erase'), 'list-remove')
> +        menu_item = PaletteMenuItem(_('Erase'), 'list-remove')
>          menu_item.connect('activate', self.__erase_activate_cb)
> -        self.menu.append(menu_item)
> +        self.menu_box.append_item(menu_item)
>          menu_item.show()
>
>          if not os.access(activity_info.get_path(), os.W_OK) or \
> @@ -528,13 +529,12 @@ class ActivityListPalette(ActivityPalette):
>          registry.disconnect(self._activity_changed_sid)
>
>      def _update_favorite_item(self):
> -        label = self._favorite_item.get_child()
>          if self._favorite:
> -            label.set_text(_('Remove favorite'))
> +            self._favorite_item.set_label(_('Remove favorite'))
>              xo_color = XoColor('%s,%s' % (style.COLOR_WHITE.get_svg(),
>                                           style.COLOR_TRANSPARENT.get_svg()))
>          else:
> -            label.set_text(_('Make favorite'))
> +            self._favorite_item.set_label(_('Make favorite'))
>              client = GConf.Client.get_default()
>              xo_color = XoColor(client.get_string('/desktop/sugar/user/color'))
>
> --
> 1.7.10.4
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel


More information about the Sugar-devel mailing list