X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fgtk%2FGMenubar.C;h=45a2159d62a9fb364c1ee93ce843ac7691ff6338;hb=005955b52744830d3531b78b671a325b5ba8f41a;hp=2450c68f0467da3426be4a595408f5bd3ff701bb;hpb=66e8220540f43e85dc8c178ac904507911db6ce1;p=lyx.git diff --git a/src/frontends/gtk/GMenubar.C b/src/frontends/gtk/GMenubar.C index 2450c68f04..45a2159d62 100644 --- a/src/frontends/gtk/GMenubar.C +++ b/src/frontends/gtk/GMenubar.C @@ -9,7 +9,6 @@ */ #include -#include #include "GMenubar.h" #include "GView.h" @@ -85,7 +84,7 @@ GMenubar::GMenubar(LyXView * lyxView, MenuBackend const & /*menuBackend*/) : labelTrans(i->label(), i->shortcut()), *gmenu)); menubar_.items().back().signal_activate().connect( - SigC::bind(SigC::slot(*this, &GMenubar::onSubMenuActivate), &(*i), + sigc::bind(sigc::mem_fun(*this, &GMenubar::onSubMenuActivate), &(*i), &menubar_.items().back())); mainMenuNames_.push_back(i->submenuname()); } @@ -173,7 +172,7 @@ void GMenubar::onSubMenuActivate(MenuItem const * item, labelTrans(i->label(), i->shortcut()), *gmenu_new)); gmenu->items().back().signal_activate().connect( - SigC::bind(SigC::slot(*this, &GMenubar::onSubMenuActivate), + sigc::bind(sigc::mem_fun(*this, &GMenubar::onSubMenuActivate), &(*i), &gmenu->items().back())); if (submenuDisabled(&(*i))) @@ -181,9 +180,6 @@ void GMenubar::onSubMenuActivate(MenuItem const * item, break; case MenuItem::Command: { -#ifdef WITH_WARNINGS -#warning Bindings are not inserted into the menu labels here. (Lgb) -#endif FuncStatus const flag = view_->getLyXFunc().getStatus(i->func()); bool on = flag.onoff(true); @@ -199,14 +195,25 @@ void GMenubar::onSubMenuActivate(MenuItem const * item, gmenu->items().back()); citem.set_active(on); } else { - gmenu->items().push_back( - Gtk::Menu_Helpers::MenuElem( - labelTrans(i->label(), - i->shortcut()))); + //This is necessary because add_accel_label is protected, + //and even if you subclass Gtk::MenuItem then add_accel_label + //doesn't do what you'd expect. + Gtk::MenuItem * item = Gtk::manage(new Gtk::MenuItem); + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox); + Gtk::Label * label1 = Gtk::manage(new Gtk::Label( + labelTrans(i->label(), i->shortcut()), true)); + Gtk::Label * label2 = Gtk::manage(new Gtk::Label( + " " + i->binding(), false)); + hbox->pack_start(*label1, false, false, 0); + hbox->pack_end(*label2, false, false, 0); + item->add(*hbox); + + gmenu->append(*item); + item->show_all(); } Gtk::MenuItem & item = gmenu->items().back(); item.signal_activate().connect( - SigC::bind(SigC::slot(*this, &GMenubar::onCommandActivate), + sigc::bind(sigc::mem_fun(*this, &GMenubar::onCommandActivate), &(*i), &item)); if (!flag.enabled()) item.set_sensitive(false);