[gnome-clocks/clutter] Make delete work
- From: Seif Lotfy <seiflotfy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks/clutter] Make delete work
- Date: Fri, 24 Aug 2012 21:06:45 +0000 (UTC)
commit c7308100dc23fc1174decacebd9cb21c8c71e5c4
Author: Seif Lotfy <seif lotfy com>
Date: Fri Aug 24 22:51:41 2012 +0200
Make delete work
gnomeclocks/app.py | 8 ++++++++
gnomeclocks/clocks.py | 6 +++++-
gnomeclocks/widgets.py | 4 +++-
3 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/gnomeclocks/app.py b/gnomeclocks/app.py
index 6cff068..79d29c1 100644
--- a/gnomeclocks/app.py
+++ b/gnomeclocks/app.py
@@ -184,6 +184,7 @@ class SelectionToolbar(Gtk.Toolbar):
self.doneButton.set_label(_("Done"))
self.doneButton.set_size_request(64, 34)
self.doneButton.connect("clicked", self._on_done_clicked)
+ self._selectionToolbar._toolbarDelete.connect("clicked", self._on_delete_clicked)
self.leftBox = box = Gtk.Box()
box.pack_start(self.doneButton, False, False, 0)
@@ -218,6 +219,13 @@ class SelectionToolbar(Gtk.Toolbar):
#TODO: do something
self._selectionToolbar._fade_out()
+ def _on_delete_clicked(self, widget):
+ selection = self.current_view.get_selection()
+ if type(self.current_view) == World:
+ model = self.current_view.liststore
+ for treepath in selection:
+ self.current_view.delete_clock(model[treepath][3])
+
class ClockButton(Gtk.RadioButton):
_group = None
diff --git a/gnomeclocks/clocks.py b/gnomeclocks/clocks.py
index 7f7ad76..4a4cb46 100644
--- a/gnomeclocks/clocks.py
+++ b/gnomeclocks/clocks.py
@@ -132,8 +132,12 @@ class World(Clock):
d])
def delete_clock(self, d):
- self.clocks.remove(d.location)
+ print self.clocks
+ self.clocks.remove(d._location)
+ worldclockstorage.save_clocks(self.clocks)
self.iconview.unselect_all()
+ self.liststore.clear()
+ self.load_clocks()
def update_empty_view(self):
if len(self.liststore) == 0:
diff --git a/gnomeclocks/widgets.py b/gnomeclocks/widgets.py
index f678c72..7e6c4ba 100644
--- a/gnomeclocks/widgets.py
+++ b/gnomeclocks/widgets.py
@@ -104,6 +104,7 @@ class NewWorldClockDialog(Gtk.Dialog):
class DigitalClock():
def __init__(self, location):
+ self._location = location
self.location = location.location
self.id = location.id
self.timezone = self.location.get_timezone()
@@ -679,6 +680,7 @@ def alphaGtkWidget(widget):
widget.override_background_color(0, Gdk.RGBA(0,0,0,0))
class SelectionToolbar():
+
def __init__(self, parent_actor):
self._parent_actor = parent_actor
@@ -714,7 +716,7 @@ class SelectionToolbar():
self._toolbarDelete.connect('clicked', self._on_toolbar_delete)
self.widget.show_all()
- def _on_toolbar_delete(self, widget, event):
+ def _on_toolbar_delete(self, widget):
pass
def change_select_mode(self, mode):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]