Commits

nakamura committed 25a0bcf

toggle checkbox when label is clicked

Comments (0)

Files changed (1)

         self._sync_check.set_active(True)
         self._hbox.pack_start(self._sync_check, False, False, 0)
 
+        self._eb = Gtk.EventBox()
         self._label = Gtk.Label(command)
-        self._hbox.pack_start(self._label, True, True, 0)
+        self._hbox.pack_start(self._eb, True, True, 0)
+        self._eb.add(self._label)
 
         self.terminal = Terminal(command, terminal_size)
         self.pack_end(self.terminal, True, True, 0)
 
-        # FIXME: why isn't this work?
-        #self._label.connect('button-release-event',
-        #                    lambda *_: self._sync_check.toggled())
+        self._eb.connect('button-release-event', self.do_eb_button_release)
 
         # TODO: "press Enter to restert command"
         # TODO: provide keyboard shortcut to toggle sync check button
     def is_synced(self):
         return self._sync_check.get_active()
 
+    def do_eb_button_release(self, *args):
+        self._sync_check.set_active(not self._sync_check.get_active())
+
 
 class Config(object):
     def __init__(self, **kwargs):