[Bugs] #626 UNSP: spurious storage devices in Frame on bootup

SugarLabs Bugs bugtracker-noreply at sugarlabs.org
Wed Apr 8 12:38:11 EDT 2009


#626: spurious storage devices in Frame on bootup
------------------------------------------+---------------------------------
    Reporter:  tomeu                      |          Owner:  tomeu            
        Type:  defect                     |         Status:  new              
    Priority:  Unspecified by Maintainer  |      Milestone:  0.84             
   Component:  sugar                      |        Version:  Git as of bugdate
    Severity:  Blocker                    |     Resolution:                   
    Keywords:                             |   Distribution:  SoaS             
Status_field:  New                        |  
------------------------------------------+---------------------------------

Comment(by tomeu):

 A better patch, because in some systems mounts won't have a drive
 associated:

 {{{
 diff --git a/extensions/deviceicon/volume.py
 b/extensions/deviceicon/volume.py
 index 96d0796..4b12eab 100644
 --- a/extensions/deviceicon/volume.py
 +++ b/extensions/deviceicon/volume.py
 @@ -33,6 +33,7 @@ from sugar.graphics import style
  from jarabe.journal import journalactivity
  from jarabe.view.palettes import VolumePalette
  from jarabe.frame.frameinvoker import FrameWidgetInvoker
 +from jarabe import util

  _icons = {}

 @@ -115,6 +116,10 @@ def _mount_removed_cb(volume_monitor, mount, tray):
      del _icons[mount]

  def _add_device(mount, tray):
 +
 +    if util.should_ignore_mount(mount):
 +        return
 +
      icon = DeviceView(mount)
      _icons[mount] = icon
      tray.add_device(icon)
 diff --git a/src/jarabe/journal/volumestoolbar.py
 b/src/jarabe/journal/volumestoolbar.py
 index b21832e..651962f 100644
 --- a/src/jarabe/journal/volumestoolbar.py
 +++ b/src/jarabe/journal/volumestoolbar.py
 @@ -28,6 +28,7 @@ from sugar.graphics.xocolor import XoColor

  from jarabe.journal import model
  from jarabe.view.palettes import VolumePalette
 +from jarabe import util

  class VolumesToolbar(gtk.Toolbar):
      __gtype_name__ = 'VolumesToolbar'
 @@ -78,6 +79,9 @@ class VolumesToolbar(gtk.Toolbar):
      def _add_button(self, mount):
          logging.debug('VolumeToolbar._add_button: %r' % mount.get_name())

 +        if util.should_ignore_mount(mount):
 +            return
 +
          button = VolumeButton(mount)
          button.props.group = self._volume_buttons[0]
          button.connect('toggled', self._button_toggled_cb)
 @@ -165,8 +169,6 @@ class VolumeButton(BaseButton):

      def create_palette(self):
          palette = VolumePalette(self._mount)
 -        #palette.props.invoker = FrameWidgetInvoker(self)
 -        #palette.set_group_id('frame')
          return palette

  class JournalButton(BaseButton):
 diff --git a/src/jarabe/util/__init__.py b/src/jarabe/util/__init__.py
 index 1610dd0..267208a 100644
 --- a/src/jarabe/util/__init__.py
 +++ b/src/jarabe/util/__init__.py
 @@ -17,3 +17,10 @@
  # along with this program; if not, write to the Free Software
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
 USA

 +def should_ignore_mount(mount):
 +    drive = mount.get_drive()
 +    if drive is not None and not drive.is_media_removable():
 +        # Mounts in drives that aren't removable aren't interesting
 +        return True
 +
 +    return False

 }}}

-- 
Ticket URL: <http://dev.sugarlabs.org/ticket/626#comment:5>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list