diff --git a/ChangeLog b/ChangeLog index 8294927bf..79ee6fc13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-10-05 James G. Sack + * src/GrampsDb/_GrampsDbBase.py: + * src/GrampsDb/_GrampsGEDDB.py: + * src/GrampsDb/_GrampsXMLDB.py: + * src/GrampsDb/_GrampsInMemDB.py: + * src/Bookmarks.py: + issue #1261: creating bookmark does not lead to save of xml + 2007-10-03 Brian Matherly * src/plugins/NarrativeWeb.py: 0001238: Web report: sort references for places and media (use remove case sensitive sort and use normalized strings diff --git a/src/Bookmarks.py b/src/Bookmarks.py index dc92b7df4..91946276a 100644 --- a/src/Bookmarks.py +++ b/src/Bookmarks.py @@ -109,7 +109,7 @@ class Bookmarks : def display(self): """ - Redraw teh display + Redraw the display """ self.redraw() @@ -122,6 +122,11 @@ class Bookmarks : self.uistate.uimanager.remove_action_group(self.action_group) self.active = DISABLED + def redraw_and_report_change(self): + """Create the pulldown menu and set bookmarks to changed""" + self.dbstate.db.report_bm_change() + self.redraw() + def redraw(self): """Create the pulldown menu""" text = StringIO() @@ -166,7 +171,7 @@ class Bookmarks : """appends the person to the bottom of the bookmarks""" if person_handle not in self.bookmarks.get(): self.bookmarks.append(person_handle) - self.redraw() + self.redraw_and_report_change() def remove_handles(self, handle_list): """ @@ -182,7 +187,7 @@ class Bookmarks : self.bookmarks.remove(handle) modified = True if modified: - self.redraw() + self.redraw_and_report_change() def draw_window(self): """Draws the bookmark dialog box""" @@ -246,7 +251,7 @@ class Bookmarks : if self.response == gtk.RESPONSE_HELP: self.help_clicked() if self.modified: - self.redraw() + self.redraw_and_report_change() self.top.destroy() def delete_clicked(self, obj): diff --git a/src/GrampsDb/_GrampsDbBase.py b/src/GrampsDb/_GrampsDbBase.py index 150ee79ae..e314b7e1a 100644 --- a/src/GrampsDb/_GrampsDbBase.py +++ b/src/GrampsDb/_GrampsDbBase.py @@ -260,6 +260,7 @@ class GrampsDbBase(GrampsDBCallback): self.repo_bookmarks = GrampsDbBookmarks() self.media_bookmarks = GrampsDbBookmarks() self.note_bookmarks = GrampsDbBookmarks() + self._bm_changes = 0 self.path = "" self.name_group = {} self.surname_list = [] @@ -2322,6 +2323,12 @@ class GrampsDbBase(GrampsDBCallback): cursor.close() return + + def report_bm_change(self): + self._bm_changes += 1; + + def db_has_bm_changes(self): + return self._bm_changes > 0 class Transaction: """ diff --git a/src/GrampsDb/_GrampsGEDDB.py b/src/GrampsDb/_GrampsGEDDB.py index 135fc1228..abd53f919 100644 --- a/src/GrampsDb/_GrampsGEDDB.py +++ b/src/GrampsDb/_GrampsGEDDB.py @@ -90,8 +90,7 @@ class GrampsGEDDB(GrampsInMemDB): log.warning("Failed to load Gedcom writer", exc_info=True) raise GrampsDbException("Failed to load Gedcom writer") - if (not self.readonly) and ((len(self.undodb)>0) or - not self.abort_possible): + if self.db_is_changed(): writer = GedcomWriter(self,self.get_default_person()) writer.export_data(self.full_name) self.db_is_open = False diff --git a/src/GrampsDb/_GrampsInMemDB.py b/src/GrampsDb/_GrampsInMemDB.py index 033bfe2ae..70ea4860b 100644 --- a/src/GrampsDb/_GrampsInMemDB.py +++ b/src/GrampsDb/_GrampsInMemDB.py @@ -378,3 +378,8 @@ class GrampsInMemDB(GrampsDbBase): obj.unserialize(data) return obj return None + + def db_is_changed(self): + return not self.readonly and \ + (len(self.undodb) > 0 or + not self.abort_possible) diff --git a/src/GrampsDb/_GrampsXMLDB.py b/src/GrampsDb/_GrampsXMLDB.py index 52f2fc881..082652495 100644 --- a/src/GrampsDb/_GrampsXMLDB.py +++ b/src/GrampsDb/_GrampsXMLDB.py @@ -94,8 +94,7 @@ class GrampsXMLDB(GrampsInMemDB): log.warning("Failed to load XML writer", exc_info=True) raise GrampsDbException("Failed to load XML writer") - if (not self.readonly) and ((len(self.undodb)>0) or - not self.abort_possible): + if self.db_is_changed() or self.db_has_bm_changes(): quick_write(self,self.full_name) self.db_is_open = False GrampsInMemDB.close(self)