* src/RecentFiles.py: Add support for Gramps' own recent items.

* src/DbPrompter.py: Support for Gramps' own recent items.
* src/ArgHandler.py: Support for Gramps' own recent items.
* src/gramps.glade: Add Open Recent submenu.
* src/gramps_main.py: Preliminary support for Open Recent submenu.


svn: r3766
This commit is contained in:
Alex Roitman
2004-11-29 05:15:41 +00:00
parent df51c9b8a6
commit de8c6d6308
6 changed files with 370 additions and 170 deletions

View File

@@ -73,6 +73,7 @@ import TipOfDay
import ArgHandler
import Exporter
import RelImage
import RecentFiles
from QuestionDialog import *
@@ -269,6 +270,7 @@ class Gramps:
self.spouse_tab = self.gtop.get_widget("spouse_tab")
self.undolabel = self.gtop.get_widget('undolabel')
self.redolabel = self.gtop.get_widget('redolabel')
self.open_recent = self.gtop.get_widget('open_recent1')
self.db.set_undo_callback(self.undo_callback)
self.db.set_redo_callback(self.redo_callback)
@@ -282,6 +284,8 @@ class Gramps:
self.build_plugin_menus()
self.init_filters()
self.build_recent_menu()
self.toolbar.set_style(GrampsCfg.get_toolbar_style())
self.views.set_show_tabs(0)
@@ -404,6 +408,25 @@ class Gramps:
self.back = gtk.ImageMenuItem(gtk.STOCK_GO_BACK)
self.forward = gtk.ImageMenuItem(gtk.STOCK_GO_FORWARD)
def build_recent_menu(self):
gramps_rf = RecentFiles.GrampsRecentFiles()
gramps_rf.gramps_recent_files.sort()
gramps_rf.gramps_recent_files.reverse()
recent_menu = gtk.Menu()
recent_menu.show()
index = 0
for item in gramps_rf.gramps_recent_files:
index = index + 1
name = os.path.basename(item.get_path())
menu_item = gtk.MenuItem(name,False)
menu_item.connect("activate",self.recent_callback,item.get_path())
menu_item.show()
recent_menu.append(menu_item)
self.open_recent.set_submenu(recent_menu)
def recent_callback(self,obj,filename):
print "Will open %s when finished" % filename
def undo_callback(self,text):
if text == None:
self.undolabel.set_sensitive(0)