Add an 'autostart jack' parameter
git-svn-id: svn+ssh://svn.marcochapeau.org/laditools/trunk@93 bfe161da-02ef-4cea-8c43-ae261ea21ac6
This commit is contained in:
parent
0e03b86b20
commit
82818a7b03
20
jacktray
20
jacktray
|
@ -23,11 +23,24 @@ import gtk
|
|||
from gobject import timeout_add
|
||||
import pyjackctl
|
||||
|
||||
# Default configuration
|
||||
autostart_default = False
|
||||
|
||||
class jackctl_trayicon(gtk.StatusIcon, pyjackctl.jack_menu):
|
||||
def __init__(self):
|
||||
# Handle the configuration
|
||||
self.jacktray_config = pyjackctl.config()
|
||||
self.param_dict = self.jacktray_config.get('jacktray')
|
||||
if 'autostart' not in self.param_dict:
|
||||
self.param_dict['autostart'] = str(autostart_default), {}
|
||||
self.autostart, devnull = self.param_dict['autostart']
|
||||
self.autostart = bool(self.autostart)
|
||||
# Build the UI
|
||||
pyjackctl.jack_menu.__init__(self)
|
||||
gtk.StatusIcon.__init__(self)
|
||||
self.jack = None
|
||||
self.jack = pyjackctl.jack_controller()
|
||||
if self.autostart:
|
||||
self.jack.start()
|
||||
# Create the needed pixbufs to manage the status icon's look
|
||||
self.stopped_pixbuf = gtk.gdk.pixbuf_new_from_file("/usr/share/pyjackctl/data/stopped.svg")
|
||||
self.starting_pixbuf = gtk.gdk.pixbuf_new_from_file("/usr/share/pyjackctl/data/starting.svg")
|
||||
|
@ -52,7 +65,6 @@ class jackctl_trayicon(gtk.StatusIcon, pyjackctl.jack_menu):
|
|||
try:
|
||||
if not self.jack:
|
||||
self.jack = pyjackctl.jack_controller()
|
||||
|
||||
if self.jack.is_started():
|
||||
# Get Realtime status
|
||||
if self.jack.is_realtime():
|
||||
|
@ -74,14 +86,14 @@ class jackctl_trayicon(gtk.StatusIcon, pyjackctl.jack_menu):
|
|||
# Take a look at the processes we've started so we don't get any zombies
|
||||
for i in self.proc_list:
|
||||
i.poll()
|
||||
|
||||
return True
|
||||
|
||||
def run(self):
|
||||
gtk.main()
|
||||
self.jacktray_config.set('jacktray', self.param_dict)
|
||||
return 0
|
||||
|
||||
def get_controller(self):
|
||||
return self.jack
|
||||
|
||||
jackctl_trayicon().run()
|
||||
jackctl_trayicon().run()
|
Loading…
Reference in New Issue