Re: several MenuItem and only One callback



Xavier,
I suggest you bind an extra argument (e.g. the plugin's name) when you
connect the signal.  For example:

void MyClass::my_unload_plugin(const Glib::ustring & plugin_name) {
    // unload the named plugin
}

...
  myPluginMenuItems[myPlugin[i].get_name()].signal_activate_item().connect(
    sigc::bind<-1>(
      sigc::mem_fun(*this, &MyNamespace::MyClass::my_unload_plugin),
      myPlugin[i].get_name())
    );
...

See the doco for sigc::bind http://libsigc.sourceforge.net/libsigc2/docs/reference/html/group__bind.html#_details

Regards,
Clive

----- Original Message ----
From: Xavier Larrode <Xavier Larrode irisa fr>
To: gtkmm-list <gtkmm-list gnome org>
Sent: Wednesday, 11 June, 2008 6:04:40 PM
Subject: several MenuItem and only One callback

Hi all,
i would like to associate the same callback for several different MenuItem.
For example an unload Plugin SubMenu with several PluginName.
So right now i have connected all MenuItem to the callBack 'unload 
Plugin' but i don't know how to get the MenuItem getname information, in 
order to delete the selected plugin.

Any idea how i can do that ?
Maybe an other signal may get this information, but i didn"t find any.
Thanks

Send instant messages to your online friends http://au.messenger.yahoo.com


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]