def init(self, app): """File manager service initialization. The app parameter is the main application object. This method builds the action group in the file menu. The list of recent Gaphor files is then updated in the file menu.""" self.action_group = build_action_group(self) for name, label in (("file-recent-files", "_Recent files"),): action = Gtk.Action.new(name, label, None, None) action.set_property("hide-if-empty", False) self.action_group.add_action(action) for i in range(0, (MAX_RECENT - 1)): action = Gtk.Action.new("file-recent-%d" % i, None, None, None) action.set_property("visible", False) self.action_group.add_action(action) action.connect("activate", self.load_recent, i) self.update_recent_files()
def init(self, app): """File manager service initialization. The app parameter is the main application object. This method builds the action group in the file menu. The list of recent Gaphor files is then updated in the file menu.""" self.action_group = build_action_group(self) for name, label in (('file-recent-files', '_Recent files'),): action = gtk.Action(name, label, None, None) action.set_property('hide-if-empty', False) self.action_group.add_action(action) for i in range(0, (MAX_RECENT-1)): action = gtk.Action('file-recent-%d' % i, None, None, None) action.set_property('visible', False) self.action_group.add_action(action) action.connect('activate', self.load_recent, i) self.update_recent_files()
def __init__(self, event_manager, element_factory, main_window, properties): """File manager constructor. There is no current filename yet.""" self.event_manager = event_manager self.element_factory = element_factory self.main_window = main_window self.properties = properties self._filename = None self.action_group = build_action_group(self) for name, label in (("file-recent-files", "_Recent files"),): action = Gtk.Action.new(name, label, None, None) action.set_property("hide-if-empty", False) self.action_group.add_action(action) for i in range(0, (MAX_RECENT - 1)): action = Gtk.Action.new("file-recent-%d" % i, None, None, None) action.set_property("visible", False) self.action_group.add_action(action) action.connect("activate", self.load_recent, i) self.update_recent_files() event_manager.subscribe(self._on_window_close)