[gjc] We register to session manager. so if we save session and Gajim was running, next time we see Gajim. ME: IT ALSO WORKS FOR SVN!
This commit is contained in:
parent
63e01f0780
commit
aa7dc3e31f
3 changed files with 52 additions and 4 deletions
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd src
|
cd src
|
||||||
exec python -OOt gajim.py $@
|
exec python -OOt gajim.py $0 $@
|
||||||
|
|
|
@ -23,4 +23,4 @@ fi
|
||||||
|
|
||||||
cd PREFIX/share/gajim/src
|
cd PREFIX/share/gajim/src
|
||||||
export PYTHONPATH="$PYTHONPATH:PREFIXLIB/gajim"
|
export PYTHONPATH="$PYTHONPATH:PREFIXLIB/gajim"
|
||||||
exec python -OOt gajim.py $@
|
exec python -OOt gajim.py $0 $@
|
||||||
|
|
52
src/gajim.py
52
src/gajim.py
|
@ -25,6 +25,7 @@ exec python -OOt "$0" ${1+"$@"}
|
||||||
import sys
|
import sys
|
||||||
import pygtk
|
import pygtk
|
||||||
import os
|
import os
|
||||||
|
|
||||||
if not os.name == 'nt': # py2exe only in windows
|
if not os.name == 'nt': # py2exe only in windows
|
||||||
pygtk.require('2.0') # py2exe fails on this
|
pygtk.require('2.0') # py2exe fails on this
|
||||||
try:
|
try:
|
||||||
|
@ -58,8 +59,8 @@ from common import optparser
|
||||||
|
|
||||||
profile = ''
|
profile = ''
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], 'hvp:', ['help', 'verbose',
|
opts, args = getopt.getopt(sys.argv[2:], 'hvp:', ['help', 'verbose',
|
||||||
'profile='])
|
'profile=', 'sm-config-prefix=', 'sm-client-id='])
|
||||||
except getopt.error, msg:
|
except getopt.error, msg:
|
||||||
print msg
|
print msg
|
||||||
print 'for help use --help'
|
print 'for help use --help'
|
||||||
|
@ -1198,5 +1199,52 @@ if __name__ == '__main__':
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Session Management support
|
||||||
|
try:
|
||||||
|
import gnome.ui
|
||||||
|
except ImportError:
|
||||||
|
print >> sys.stderr, _('session management not available (missing gnome.ui module)')
|
||||||
|
else:
|
||||||
|
def die_cb(cli):
|
||||||
|
gtk.main_quit()
|
||||||
|
gnome.program_init('gajim', gajim.version)
|
||||||
|
cli = gnome.ui.master_client()
|
||||||
|
cli.connect('die', die_cb)
|
||||||
|
|
||||||
|
if os.path.isdir('.svn'): # we are svn user
|
||||||
|
cwd = os.getcwd()
|
||||||
|
svn_src = False
|
||||||
|
svn_trunk = False
|
||||||
|
|
||||||
|
script = '#!/bin/sh\n'
|
||||||
|
if cwd.endswith('trunk'): # we run with ./launch.sh
|
||||||
|
script += 'cd %s/src' % cwd
|
||||||
|
svn_trunk = True
|
||||||
|
elif cwd.endswith('src'): # we run with ./gajim.py in src/
|
||||||
|
script += 'cd %s' % cwd
|
||||||
|
svn_src = True
|
||||||
|
|
||||||
|
if svn_src or svn_trunk:
|
||||||
|
if svn_trunk:
|
||||||
|
path_to_gajim_script = cwd + '/scripts/gajim_sm_script'
|
||||||
|
elif svn_src:
|
||||||
|
path_to_gajim_script = cwd + '/../scripts/gajim_sm_script'
|
||||||
|
|
||||||
|
os.remove(path_to_gajim_script)
|
||||||
|
f = open(path_to_gajim_script, 'w')
|
||||||
|
script += '\nexec python -OOt gajim.py $0 $@\n'
|
||||||
|
f.write(script)
|
||||||
|
f.close()
|
||||||
|
os.chmod(path_to_gajim_script, 0700)
|
||||||
|
|
||||||
|
else: # normal user (not svn user)
|
||||||
|
# always make it like '/usr/local/bin/gajim'
|
||||||
|
path_to_gajim_script = helpers.is_in_path('gajim', True)
|
||||||
|
|
||||||
|
|
||||||
|
if path_to_gajim_script:
|
||||||
|
argv = [path_to_gajim_script]
|
||||||
|
cli.set_restart_command(len(argv), argv)
|
||||||
|
|
||||||
Interface()
|
Interface()
|
||||||
gtk.main()
|
gtk.main()
|
||||||
|
|
Loading…
Add table
Reference in a new issue