code: 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 _, p=project: self.open_project(path=p))
                          )
                      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()
docs: Setup and update the menu actions.