Skip to content

Commit

Permalink
Gtk::MenuItem: Fix add_accel_label()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Christian Schoenebeck authored and kjellahl committed Feb 11, 2018
1 parent f569a6c commit 336eb15
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions gtk/src/menuitem.ccg
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 336eb15

Please sign in to comment.