[Sugar-devel] [PATCH] Avoid adding multiple times the callback to the duplicate button

godiard at sugarlabs.org godiard at sugarlabs.org
Wed Aug 17 14:43:29 EDT 2011


From: Gonzalo Odiard <godiard at gmail.com>

The effect of adding multiple times the callback is
the first file the user duplicate, create one copy,
the second create two copies, the third three copies...

Signed-off-by: Gonzalo Odiard <gonzalo at laptop.org>
---
 src/jarabe/journal/journaltoolbox.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/jarabe/journal/journaltoolbox.py b/src/jarabe/journal/journaltoolbox.py
index b6f8ef8..cdf6a77 100644
--- a/src/jarabe/journal/journaltoolbox.py
+++ b/src/jarabe/journal/journaltoolbox.py
@@ -387,6 +387,7 @@ class EntryToolbar(gtk.Toolbar):
         icon = Icon(icon_name='edit-duplicate', xo_color=color)
         self._duplicate.set_icon_widget(icon)
         self._duplicate.set_tooltip(_('Duplicate'))
+        self._duplicate.connect('clicked', self._duplicate_clicked_cb)
         self.add(self._duplicate)
 
         separator = gtk.SeparatorToolItem()
@@ -477,7 +478,6 @@ class EntryToolbar(gtk.Toolbar):
         color = misc.get_icon_color(self._metadata)
         self._copy.get_icon_widget().props.xo_color = color
         if self._metadata['mountpoint'] == '/':
-            self._duplicate.connect('clicked', self._duplicate_clicked_cb)
             self._duplicate.show()
             icon = self._duplicate.get_icon_widget()
             icon.props.xo_color = color
-- 
1.7.4.4



More information about the Sugar-devel mailing list