def mk_examples_menu(text, root_dir=None, depth=<NUM_LIT:0>):
<EOL>examples_dir = ide_utils.get_example_dir()<EOL>if not examples_dir:<EOL><INDENT>return None, []<EOL><DEDENT>root_dir = root_dir or examples_dir    <EOL>file_actions = []<EOL>menu = Gio.Menu.new()<EOL>base_item = Gio.MenuItem.new_submenu(text, menu)<EOL>for fn in sorted(os.listdir(root_dir)):<EOL><INDENT>path = os.path.join(root_dir, fn)<EOL>rel_path = path[len(examples_dir):]<EOL>if os.path.isdir(path):<EOL><INDENT>label = fn.capitalize()<EOL>item, sm_file_actions = mk_examples_menu(label, os.path.join(root_dir, fn))<EOL>menu.append_item(item)<EOL>file_actions.extend(sm_file_actions)<EOL><DEDENT>elif os.path.splitext(path)[<NUM_LIT:1>] in ['<STR_LIT>', '<STR_LIT>'] and not fn.startswith('<STR_LIT:_>'):<EOL><INDENT>label = ide_utils.make_readable_filename(fn)<EOL>action_name = "<STR_LIT>" % encode_relpath(rel_path)<EOL>menu.append(label, action_name)<EOL>file_actions.append(rel_path)<EOL><DEDENT><DEDENT>return base_item, file_actions<EOL>
:return: base_item, rel_paths