comparison gcp @ 12:bbe09d5791dd

Fixed double initialisation - Journal and copy queue were started 2 times when new files were added throught DBus
author Goffi <goffi@goffi.org>
date Tue, 28 Sep 2010 14:24:18 +0800
parents c065a70c3e7b
children 894530949e30
comparison
equal deleted inserted replaced
11:c065a70c3e7b 12:bbe09d5791dd
152 if e._dbus_error_name=='org.freedesktop.DBus.Error.ServiceUnknown': 152 if e._dbus_error_name=='org.freedesktop.DBus.Error.ServiceUnknown':
153 self.launchDbusMainInstance() 153 self.launchDbusMainInstance()
154 debug (_("gcp launched")) 154 debug (_("gcp launched"))
155 self._main_instance = True 155 self._main_instance = True
156 self.buffer_size = const_BUFF_SIZE 156 self.buffer_size = const_BUFF_SIZE
157 self.__launched = False #True when journal is initialised and copy is started
157 else: 158 else:
158 raise e 159 raise e
159 160
160 def launchDbusMainInstance(self): 161 def launchDbusMainInstance(self):
161 debug (_("Init DBus...")) 162 debug (_("Init DBus..."))
472 if len(args) < 2: 473 if len(args) < 2:
473 _error_msg = _("Wrong number of arguments") 474 _error_msg = _("Wrong number of arguments")
474 return (False, _error_msg) 475 return (False, _error_msg)
475 debug(_("adding args to gcp: %s") % str(args).decode('utf-8','replace')) 476 debug(_("adding args to gcp: %s") % str(args).decode('utf-8','replace'))
476 self.__checkArgs(options, source_path, args) 477 self.__checkArgs(options, source_path, args)
477 self.journal = Journal() 478 if not self.__launched:
478 gobject.idle_add(self.__copyNextFile) 479 self.journal = Journal()
480 gobject.idle_add(self.__copyNextFile)
481 self.__launched = True
479 return (True,'') 482 return (True,'')
480 483
481 def go(self): 484 def go(self):
482 """Launch main loop""" 485 """Launch main loop"""
483 self.loop = gobject.MainLoop() 486 self.loop = gobject.MainLoop()