'Setup and update the menu actions.'

def setup_menu_actions(self):

    self.recent_project_menu.clear()
    self.recent_projects_actions = []
    if self.recent_projects:
        for project in self.recent_projects:
            if self.is_valid_project(project):
                name = project.replace(get_home_dir(), '~')
                action = create_action(self, name, icon=ima.icon('project'), triggered=(lambda v, path=project: self.open_project(path=path)))
                self.recent_projects_actions.append(action)
            else:
                self.recent_projects.remove(project)
        self.recent_projects_actions += [None, self.clear_recent_projects_action]
    else:
        self.recent_projects_actions = [self.clear_recent_projects_action]
    add_actions(self.recent_project_menu, self.recent_projects_actions)
    self.update_project_actions()
