Added new signal to database: home-person-changed, which is emitted when the default person is set

svn: r11534
This commit is contained in:
Doug Blank 2008-12-29 14:13:44 +00:00
parent b51cf87d8e
commit 983f6d3e71
2 changed files with 4 additions and 1 deletions

View File

@ -164,7 +164,8 @@ class GrampsDbBase(Callback):
'note-rebuild' : None, 'note-rebuild' : None,
'long-op-start' : (object, ), 'long-op-start' : (object, ),
'long-op-heartbeat' : None, 'long-op-heartbeat' : None,
'long-op-end' : None 'long-op-end' : None,
'home-person-changed': None,
} }
# If this is True logging will be turned on. # If this is True logging will be turned on.
@ -1924,6 +1925,7 @@ class GrampsDbBase(Callback):
"""Set the default Person to the passed instance.""" """Set the default Person to the passed instance."""
if (self.metadata is not None) and (not self.readonly): if (self.metadata is not None) and (not self.readonly):
self.metadata['default'] = str(handle) self.metadata['default'] = str(handle)
self.emit('home-person-changed')
def get_default_person(self): def get_default_person(self):
"""Return the default Person of the database.""" """Return the default Person of the database."""

View File

@ -393,6 +393,7 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback):
the_txn = self.env.txn_begin() the_txn = self.env.txn_begin()
self.metadata.put('default', str(handle), txn=the_txn) self.metadata.put('default', str(handle), txn=the_txn)
the_txn.commit() the_txn.commit()
self.emit('home-person-changed')
def get_default_person(self): def get_default_person(self):
try: try: