Skip to content
Snippets Groups Projects
Commit fd133716 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

if migration fails (python2.3 for ex) Gajim shows a dialog and exit

parent 5873a8bd
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@ class Migration:
def __init__(self):
self.constants = logger.Constants()
self.DONE = False
self.PROCESSING = False
if os.path.exists(PATH_TO_DB):
print '%s already exists. Exiting..' % PATH_TO_DB
......@@ -202,6 +203,7 @@ def migrate(self, queue = None):
self.con.commit()
self.PROCESSING = True
os.path.walk(PATH_TO_LOGS_BASE_DIR, self.visit, None)
s = '''
......
......@@ -1449,6 +1449,19 @@ def __init__(self):
gobject.timeout_add(200, self.process_connections)
gobject.timeout_add(500, self.read_sleepy)
def test_migration(migration):
if not migration.PROCESSING:
dialog = gtk.Dialog()
#FIXME: translate these strings after 0.9
dialog = gtk.MessageDialog(None,
gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL,
gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, message_format = 'Migration failed')
dialog.format_secondary_text('Automatic migration failed. You can run it manually by doing /PATH/TO/GAJIM/src/common/migrate_logs_to_dot9_db.py.')
dialog.run()
dialog.destroy()
sys.exit()
def wait_migration(migration):
if not migration.DONE:
return True # loop for ever
......@@ -1530,6 +1543,8 @@ def die_cb(cli):
t = threading.Thread(target = m.migrate, args = (q,))
t.start()
gobject.timeout_add(500, wait_migration, m)
# In 10 seconds, we test if migration began
gobject.timeout_add(10000, test_migration, m)
gtk.main()
# Init logger values (self.con/cur, jid_already_in)
gajim.logger.init_vars()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment