[gnome-clocks] Use Signal annotation for app::view-clock
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] Use Signal annotation for app::view-clock
- Date: Wed, 5 Sep 2012 21:21:34 +0000 (UTC)
commit d1cb1b4146de146fce7a5fda35eb41c516a6d7da
Author: Paolo Borelli <pborelli gnome org>
Date: Wed Sep 5 22:46:35 2012 +0200
Use Signal annotation for app::view-clock
gnomeclocks/app.py | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/gnomeclocks/app.py b/gnomeclocks/app.py
index 3189f60..623a010 100644
--- a/gnomeclocks/app.py
+++ b/gnomeclocks/app.py
@@ -178,9 +178,6 @@ class ClockButton(Gtk.RadioButton):
class ClocksToolbar(Gtk.Toolbar):
- __gsignals__ = {'view-clock': (GObject.SignalFlags.RUN_LAST,
- None, (Clock,))}
-
def __init__(self, views, embed):
Gtk.Toolbar.__init__(self)
@@ -241,7 +238,7 @@ class ClocksToolbar(Gtk.Toolbar):
if view.hasSelectionMode:
view.connect("notify::can-select", self._on_can_select_changed)
if view == views[0]:
- self.set_current_view(view)
+ self.current_view = view
button.set_active(True)
self.titleLabel = Gtk.Label()
@@ -278,8 +275,14 @@ class ClocksToolbar(Gtk.Toolbar):
self.doneButton.connect("clicked", self._on_done_clicked)
rightBox.pack_end(self.doneButton, False, False, 0)
+ self.selectionHandler = 0
+
self.embed._selectionToolbar._toolbarDelete.connect("clicked", self._on_delete_clicked)
+ @GObject.Signal(arg_types=(Clock,))
+ def view_clock(self, view):
+ self.current_view = view
+
def activate_view(self, view):
if view is not self.current_view:
self.viewsButtons[view].set_active(True)
@@ -294,6 +297,9 @@ class ClocksToolbar(Gtk.Toolbar):
self.titleLabel.hide()
self.editButton.hide()
self.doneButton.hide()
+ if self.selectionHandler:
+ self.current_view.disconnect_by_func(self._on_selection_changed)
+ self.selectionHandler = 0
def show_standalone_toolbar(self, widget):
self.get_style_context().remove_class("selection-mode")
@@ -318,17 +324,11 @@ class ClocksToolbar(Gtk.Toolbar):
self.titleLabel.show()
self.editButton.hide()
self.doneButton.show()
-
- def set_current_view(self, view):
- if self.current_view:
- self.current_view.disconnect_by_func(self._on_selection_changed)
-
- self.current_view = view
- self.current_view.connect("selection-changed",
- self._on_selection_changed)
+ self.selectionHandler = \
+ self.current_view.connect("selection-changed",
+ self._on_selection_changed)
def _on_toggled(self, widget, view):
- self.set_current_view(view)
if view.hasNew:
self.newButton.get_children()[0].show_all()
self.newButton.show_all()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]