diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 028a6154b..69f27bb0b 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2005-11-08 Martin Hawlisch + * src/DbPrompter.py (DbPrompter): Give possibility to open + the recent file + * src/gramps.glade: Add recent file to DbPrompter + 2005-11-08 Alex Roitman * src/EditPlace.py: Fix idle for new objects. * src/EditSource.py: Fix idle for new objects. diff --git a/gramps2/src/DbPrompter.py b/gramps2/src/DbPrompter.py index f02a1e031..2b6ad1720 100644 --- a/gramps2/src/DbPrompter.py +++ b/gramps2/src/DbPrompter.py @@ -92,16 +92,50 @@ class DbPrompter: title = opendb.get_widget('title') Utils.set_titles(top,title,_('Open a database')) - + + recent = opendb.get_widget("recent") + existing = opendb.get_widget("existing") new = opendb.get_widget("new") - new.set_active(want_new) + + # write in recent file + gramps_rf = RecentFiles.GrampsRecentFiles() + gramps_rf.gramps_recent_files.sort() + gramps_rf.gramps_recent_files.reverse() + if gramps_rf.gramps_recent_files: + self.recent_file = gramps_rf.gramps_recent_files[0].get_path() + try: + self.recent_filetype = get_mime_type(self.recent_file) + filename = os.path.basename(self.recent_file).replace("_", "__") + recent.set_label( _("_Recent file: %s") % filename) + except RuntimeError: + recent.set_sensitive(False) + self.recent_file = None + else: + recent.set_sensitive(False) + self.recent_file = None + + if want_new: + new.set_active(True) + else: + if not self.recent_file: + existing.set_active(True) while 1: top.show() response = top.run() top.hide() if response == gtk.RESPONSE_OK: - if new.get_active(): + if recent.get_active(): + try: + if open_native(self.parent,self.recent_file,self.recent_filetype): + break + except RuntimeError,msg: + QuestionDialog.ErrorDialog( + _("Could not open file: %s") % self.recent_file, + str(msg)) + recent.set_sensitive(False) + continue + elif new.get_active(): prompter = NewNativeDbPrompter(self.parent, self.parent_window) else: diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index ff34ba21d..e211fc030 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -5706,6 +5706,26 @@ Other + + + 5 + True + True + Open recent file: + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + 5 @@ -5718,6 +5738,7 @@ Other True False True + recent 0 @@ -5738,7 +5759,7 @@ Other False False True - existing + recent 0