[Dextrose] [PATCH] Prevent multiple XS icon when re register

Martin Abente mabente at paraguayeduca.org
Fri Aug 6 10:39:46 EDT 2010


Re register patch did not consider the XS button option logic.
This  patch makes sure previous icon will be removed before adding
the new one.

Signed-off-by: Martin Abente <mabente at paraguayeduca.org>
---
 src/jarabe/journal/volumestoolbar.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/jarabe/journal/volumestoolbar.py b/src/jarabe/journal/volumestoolbar.py
index e1f9ce0..5fadfac 100644
--- a/src/jarabe/journal/volumestoolbar.py
+++ b/src/jarabe/journal/volumestoolbar.py
@@ -66,10 +66,15 @@ class VolumesToolbar(gtk.Toolbar):
         client = gconf.client_get_default()
         backup_url = client.get_string('/desktop/sugar/backup_url')
 
+        for button in self._volume_buttons:
+            if button.__class__ == XSButton:
+                self._volume_buttons.remove(button)
+                self.remove(button)
+                break
+
         if backup_url:
             xs_button = XSButton()
             xs_button.set_palette(JournalXSPalette(backup_url))
-            #xs_button.props.group = self._volume_buttons[0]
             xs_button.show()
 
             self._volume_buttons.append(xs_button)
@@ -122,7 +127,7 @@ class VolumesToolbar(gtk.Toolbar):
     def _get_button_for_mount(self, mount):
         mount_point = mount.get_root().get_path()
         for button in self.get_children():
-            if type(button) == VolumeButton and \
+            if button.__class__ == VolumeButton and \
                 button.mount_point == mount_point:
                     return button
         logging.error('Couldnt find button with mount_point %r', mount_point)
-- 
1.6.0.4



More information about the Dextrose mailing list