diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-07-27 12:56:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-07-27 15:25:11 +0200 |
commit | 1b517e049001b856e8043c6892a4819709b8efcf (patch) | |
tree | 46ba92d04ea458924757cc50b1c441d20a1bc01e /vcl | |
parent | 4d855bb916bd41221e2b23d6d782e19b4b2740f9 (diff) |
gtk4: fill in more of this menu related stub
Change-Id: Ia646d6f98804ffbec1177d5964550708588ce88f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137500
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 05a0622577c2..0236f1aa9529 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -11285,13 +11285,29 @@ public: gtk_menu_reorder_child(m_pMenu, pItem, pos); #else SAL_WARN("vcl.gtk", "needs to be implemented for gtk4"); - (void)pos; - (void)rId; - (void)rStr; (void)pIconName; (void)pImageSurface; (void)rGraphic; - (void)eCheckRadioFalse; + + if (GMenuModel* pMenuModel = m_pMenu ? gtk_popover_menu_get_menu_model(m_pMenu) : nullptr) + { + auto aSectionAndPos = get_section_and_pos_for(pMenuModel, pos); + GMenu* pMenu = G_MENU(aSectionAndPos.first); + // action with a target value ... the action name and target value are separated by a double + // colon ... For example: "app.action::target" + OUString sActionAndTarget; + if (eCheckRadioFalse == TRISTATE_INDET) + sActionAndTarget = "menu.normal." + rId + "::" + rId; + else + sActionAndTarget = "menu.radio." + rId + "::" + rId; + g_menu_insert(pMenu, aSectionAndPos.second, MapToGtkAccelerator(rStr).getStr(), sActionAndTarget.toUtf8().getStr()); + + assert(eCheckRadioFalse == TRISTATE_INDET); // come back to this later + + // TODO not redo entire group + update_action_group_from_popover_model(); + } + #endif } |