[gtkmm] Gtk::MenuItem: Fix add_accel_label()
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Gtk::MenuItem: Fix add_accel_label()
- Date: Sun, 11 Feb 2018 10:22:58 +0000 (UTC)
commit 336eb15a408063a93a501ee80470f54159075cfb
Author: Christian Schoenebeck <schoenebeck linuxsampler org>
Date: Sun Feb 11 11:21:16 2018 +0100
Gtk::MenuItem: Fix add_accel_label()
Make sure accelator keys are shown right-aligned, by calling
gtk_menu_item_set_label().
https://mail.gnome.org/archives/gtkmm-list/2018-February/msg00006.html
gtk/src/menuitem.ccg | 13 ++-----------
1 files changed, 2 insertions(+), 11 deletions(-)
---
diff --git a/gtk/src/menuitem.ccg b/gtk/src/menuitem.ccg
index 5cd7242..dd2013b 100644
--- a/gtk/src/menuitem.ccg
+++ b/gtk/src/menuitem.ccg
@@ -40,17 +40,8 @@ MenuItem::MenuItem(const Glib::ustring& label, bool mnemonic)
void MenuItem::add_accel_label(const Glib::ustring& label, bool mnemonic)
{
- auto pLabel = manage(new AccelLabel(label, mnemonic));
-
- //Labels are centered by default, but in menus they should be left-aligned.
- pLabel->set_halign(Align::START);
-
- add(*pLabel);
-
- //Note that we have to unset the accel_widget in MenuList::remove() to avoid
- //a memory leak due to the extra reference:
- pLabel->set_accel_widget(*this);
- pLabel->show();
+ set_label(label);
+ set_use_underline(mnemonic);
}
void MenuItem::set_accel_key(const AccelKey& accel_key)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]