def METHOD_NAME(self):
    uimanager = self.main_window.uimanager
    # Create an ActionGroup
    actiongroup = Gtk.ActionGroup("FormatActionGroup")
    def apply_format(action):
        format_ = action.get_name().lower()
        iter_ = self.main_window.categories_tree_view.get_selected_node()
        if iter_:
            markup = self.FORMAT_TO_MARKUP[format_]
            text = self.main_window.categories_tree_view.get_iter_value(iter_)
            text = f"{markup}{text}{markup}"
            self.main_window.categories_tree_view.set_iter_value(iter_, text)
        else:
            self.main_window.day_text_field.apply_format(format_)
    def shortcut(char):
        # Translators: The Control (Ctrl) key
        return ""  # return ' (%s+%s)' % (_('Ctrl'), char)
    # Create actions
    actions = [
        (
            "Bold",
            None,
            _("Bold") + shortcut("B"),
            "<Control>B",
            None,
            apply_format,
        ),
        (
            "Italic",
            None,
            _("Italic") + shortcut("I"),
            "<Control>I",
            None,
            apply_format,
        ),
        (
            "Monospace",
            None,
            _("Monospace") + shortcut("M"),
            "<Control>M",
            None,
            apply_format,
        ),
        (
            "Underline",
            None,
            _("Underline") + shortcut("U"),
            "<Control>U",
            None,
            apply_format,
        ),
        (
            "Strikethrough",
            None,
            _("Strikethrough") + shortcut("K"),
            "<Control>K",
            None,
            apply_format,
        ),
        (
            "Clear",
            None,
            _("Clear Format") + shortcut("R"),
            "<Control>R",
            None,
            self.on_clear_format,
        ),
        # Translators: Noun
        ("FormatMenuBar", None, _("_Format")),
    ]
    actiongroup.add_actions(actions)
    # Add the actiongroup to the uimanager
    uimanager.insert_action_group(actiongroup, 0)
    # Add a UI description
    uimanager.add_ui_from_string(TOOLBAR_XML)
    # Create a Menu
    menu = uimanager.get_widget("/FormatMenu")
    self.main_window.format_button = customwidgets.ToolbarMenuButton(
        "format-text-bold", menu
    )
    # Translators: Noun
    self.main_window.format_button.set_label(_("Format"))
    tip = _("Format the selected text or tag")
    self.main_window.format_button.set_tooltip_text(tip)
    self.main_window.builder.get_object("edit_toolbar").insert(
        self.main_window.format_button, -1
    )
    self.main_window.format_actiongroup = actiongroup