0001977: Breaking a database lock closes the family tree manager
svn: r10433
This commit is contained in:
parent
d5962794fa
commit
e7a6115c91
@ -303,7 +303,6 @@ class DbManager(CLIDbManager):
|
||||
self.top.drag_dest_set(gtk.DEST_DEFAULT_ALL, ddtargets, ACTION_COPY)
|
||||
|
||||
self.remove.connect('clicked', self.__remove_db)
|
||||
self.connect.connect('clicked', self.__load_selected)
|
||||
self.new.connect('clicked', self.__new_db)
|
||||
self.rename.connect('clicked', self.__rename_db)
|
||||
self.repair.connect('clicked', self.__repair_db)
|
||||
@ -325,28 +324,10 @@ class DbManager(CLIDbManager):
|
||||
"""
|
||||
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
||||
if self.connect.get_property('sensitive'):
|
||||
return self.__load_selected()
|
||||
self.top.response(gtk.RESPONSE_OK)
|
||||
return True
|
||||
return False
|
||||
|
||||
def __load_selected(self, obj=None):
|
||||
"""
|
||||
Load the selected family tree if possible, return True
|
||||
if ok, and set RESPONSE_OK
|
||||
"""
|
||||
store, node = self.selection.get_selected()
|
||||
if not node:
|
||||
return
|
||||
# don't open a locked file
|
||||
if store.get_value(node, STOCK_COL) == 'gramps-lock':
|
||||
self.__ask_to_break_lock(store, node)
|
||||
return
|
||||
# don't open a version
|
||||
if len(store.get_path(node)) > 1:
|
||||
return
|
||||
if store.get_value(node, PATH_COL):
|
||||
self.top.response(gtk.RESPONSE_OK)
|
||||
return True
|
||||
|
||||
def __key_press(self, obj, event):
|
||||
"""
|
||||
Grab ENTER so it does not start editing the cell, but behaves
|
||||
@ -355,7 +336,8 @@ class DbManager(CLIDbManager):
|
||||
if not event.state or event.state in (gtk.gdk.MOD2_MASK,):
|
||||
if event.keyval in (_RETURN, _KP_ENTER):
|
||||
if self.connect.get_property('sensitive'):
|
||||
return self.__load_selected()
|
||||
self.top.response(gtk.RESPONSE_OK)
|
||||
return True
|
||||
return False
|
||||
|
||||
def __selection_changed(self, selection):
|
||||
@ -500,15 +482,24 @@ class DbManager(CLIDbManager):
|
||||
Runs the dialog, returning None if nothing has been chosen,
|
||||
or the path and name if something has been selected
|
||||
"""
|
||||
value = self.top.run()
|
||||
if value == gtk.RESPONSE_OK:
|
||||
(model, node) = self.selection.get_selected()
|
||||
if node:
|
||||
while True:
|
||||
value = self.top.run()
|
||||
if value == gtk.RESPONSE_OK:
|
||||
store, node = self.selection.get_selected()
|
||||
# don't open a locked file
|
||||
if store.get_value(node, STOCK_COL) == 'gramps-lock':
|
||||
self.__ask_to_break_lock(store, node)
|
||||
continue
|
||||
# don't open a version
|
||||
if len(store.get_path(node)) > 1:
|
||||
continue
|
||||
if node:
|
||||
self.top.destroy()
|
||||
return (store.get_value(node, PATH_COL),
|
||||
store.get_value(node, NAME_COL))
|
||||
else:
|
||||
self.top.destroy()
|
||||
return (model.get_value(node, PATH_COL),
|
||||
model.get_value(node, NAME_COL))
|
||||
self.top.destroy()
|
||||
return None
|
||||
return None
|
||||
|
||||
def __ask_to_break_lock(self, store, node):
|
||||
"""
|
||||
|
@ -15889,7 +15889,7 @@ Very High</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="response_id">-5</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment8">
|
||||
|
Loading…
Reference in New Issue
Block a user