joshf/emesene — comment on commit a29091591685fe022f16f1aa229ec81a54791fde
File: emesene/gui/gtkui/Preferences.py line 559
By Sbte:

This is because you now declare the do_hideshow method within the init method, so it's not a class method. self.do_hideshow can't be called because it's not defined in the class, where the "self." requires it to be.

The proper way to do it is

```
if sys.platform == 'darwin':
self.append_markup(''+_('OS X Integration:')+'')
self.session.config.get_or_set('b_show_dock_icon', True)
button = self.append_check(_('Show dock icon (requires restart of emesene)'),
'session.config.b_show_dock_icon')
button.connect("toggled", self._do_hideshow)

self.show_all()

def _do_hideshow(self, widget):
if widget.get_active():
subprocess.call('defaults write /Applications/emesene.app/Contents/Info LSUIElement -bool false', shell=True)
else:
subprocess.call('defaults write /Applications/emesene.app/Contents/Info LSUIElement -bool true', shell=True)
```

or

```
if sys.platform == 'darwin':

def do_hideshow(widget):
if widget.get_active():
subprocess.call('defaults write /Applications/emesene.app/Contents/Info LSUIElement -bool false', shell=True)
else:
subprocess.call('defaults write /Applications/emesene.app/Contents/Info LSUIElement -bool true', shell=True)

self.append_markup(''+_('OS X Integration:')+'')
self.session.config.get_or_set('b_show_dock_icon', True)
button = self.append_check(_('Show dock icon (requires restart of emesene)'),
'session.config.b_show_dock_icon')
button.connect("toggled", do_hideshow)

self.show_all()
```