nakamura avatar 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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.