[misc@zarb] gajim-remote can run without X now. fixes #1467

This commit is contained in:
Nikos Kouremenos 2006-02-07 12:04:17 +00:00
parent e0d8b0c3dc
commit 98521fa2c3
1 changed files with 7 additions and 6 deletions

View File

@ -31,7 +31,7 @@ exec python -OOt "$0" ${1+"$@"}
# gajim-remote help will show you the DBUS API of Gajim # gajim-remote help will show you the DBUS API of Gajim
import sys import sys
import gtk
import gobject import gobject
import signal import signal
@ -231,8 +231,9 @@ class GajimRemote:
self.print_result(res) self.print_result(res)
if self.command == 'contact_info': if self.command == 'contact_info':
gobject.timeout_add(10000, self.gtk_quit) # wait 10 sec for response gobject.timeout_add(10000, self.gobject_quit) # wait 10 sec for response
gtk.main() self.loop = gobject.MainLoop()
self.loop.run()
def print_result(self, res): def print_result(self, res):
''' Print retrieved result to the output ''' ''' Print retrieved result to the output '''
@ -519,7 +520,7 @@ class GajimRemote:
self.sbus.remove_signal_receiver(self.show_vcard_info, 'VcardInfo', self.sbus.remove_signal_receiver(self.show_vcard_info, 'VcardInfo',
INTERFACE, SERVICE, OBJ_PATH) INTERFACE, SERVICE, OBJ_PATH)
gtk.main_quit() self.loop.quit()
def check_arguments(self): def check_arguments(self):
''' Make check if all necessary arguments are given ''' ''' Make check if all necessary arguments are given '''
@ -530,11 +531,11 @@ class GajimRemote:
send_error(_('Argument "%s" is not specified. \n\ send_error(_('Argument "%s" is not specified. \n\
Type "%s help %s" for more info') % (args[argv_len][0], BASENAME, self.command)) Type "%s help %s" for more info') % (args[argv_len][0], BASENAME, self.command))
def gtk_quit(self): def gobject_quit(self):
if _version[1] >= 41: if _version[1] >= 41:
self.sbus.remove_signal_receiver(self.show_vcard_info, 'VcardInfo', self.sbus.remove_signal_receiver(self.show_vcard_info, 'VcardInfo',
INTERFACE, SERVICE, OBJ_PATH) INTERFACE, SERVICE, OBJ_PATH)
gtk.main_quit() self.loop.quit()
# FIXME - didn't find more clever way for the below method. # FIXME - didn't find more clever way for the below method.
# method(sys.argv[2:]) doesn't work, cos sys.argv[2:] is a tuple # method(sys.argv[2:]) doesn't work, cos sys.argv[2:] is a tuple