[gnome-clocks/clutter] Fix some deleteing bugs



commit 613c03c7ed63db61bf4f5b9a01f381a43adc8c2f
Author: Seif Lotfy <seif lotfy com>
Date:   Fri Aug 24 23:03:21 2012 +0200

    Fix some deleteing bugs

 gnomeclocks/app.py    |    8 ++++++--
 gnomeclocks/clocks.py |    6 +++---
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/gnomeclocks/app.py b/gnomeclocks/app.py
index 79d29c1..24c45c8 100644
--- a/gnomeclocks/app.py
+++ b/gnomeclocks/app.py
@@ -223,12 +223,16 @@ class SelectionToolbar(Gtk.Toolbar):
         selection = self.current_view.get_selection()
         if type(self.current_view) == World:
             model = self.current_view.liststore
+            items = []
             for treepath in selection:
-                self.current_view.delete_clock(model[treepath][3])
+                items.append(model[treepath][3])
+            self.current_view.delete_clocks(items)
+        selection = self.current_view.get_selection()
+        self.set_selection_label(len(selection))
+        self._selectionToolbar._fade_out()
 
 class ClockButton(Gtk.RadioButton):
     _group = None
-
     def __init__(self, text):
         Gtk.RadioButton.__init__(self, group=ClockButton._group, draw_indicator=False)
         self.text = text
diff --git a/gnomeclocks/clocks.py b/gnomeclocks/clocks.py
index 4a4cb46..e1b5fc5 100644
--- a/gnomeclocks/clocks.py
+++ b/gnomeclocks/clocks.py
@@ -131,9 +131,9 @@ class World(Clock):
                                            "<b>" + name + "</b>",
                                            d])
 
-    def delete_clock(self, d):
-        print self.clocks
-        self.clocks.remove(d._location)
+    def delete_clocks(self, clocks):
+        for d in clocks:
+            self.clocks.remove(d._location)
         worldclockstorage.save_clocks(self.clocks)
         self.iconview.unselect_all()
         self.liststore.clear()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]