Hi,

On 27/7/20 14:00, Carlo Wood <[email protected]> wrote:
Hi aitor,

thank you so much for your examples!
I will definitely study them in depth as soon as I get
my current problem resolved of how to add a 'Mode' to
my menu having a separate Gtk::Builder (aka, how to
combine multiple Gtk::Builder objects into a single
menu). Or, alternatively, I could have just a single
Gtk::Builder object, but then I still need to be
able to somehow add a Gio::SimpleActionGroup to my
menu.

It seems that your approach is entirely different:
you have a MenuBar class that deals with everything
related to the menu. From an object oriented point
of view that makes a lot of sense. You're not using
Gtk::Builder at all, but - instead of using an xml
string - hardcode the menu into the constructor of
myMenuBar.


Yes, Gtk::Builder is cool, but the other point of view simplifies dynamic changes because you can define an iterator which can be used for the addition/removal of the items in the
menu.


For some reason you're passing `*this` to every
sigc::mem_fun - aka*all*  `on_menu_*` menu callbacks
are member functions of myMenuBar. I'd prefer it
if I could use callbacks that are member functions
of several different objects (namely those that
they operate on). I suppose I can do that by passing
a pointer to all those objects to the constructor
of myMenuBar. Currently you pass only a WindowMain*,
for the on_menu_mode_quit method.

Why are you using the construct of passing this WindowMain*
as an argument to myMenuBar::on_menu_mode_quit?
Wouldn't it be possible, and make more sense, to do:

     m_QuitItem->signal_activate().connect (
         sigc::mem_fun(*caller, &WindowMain::on_menu_mode_quit)
     );

?


The sort answer: Yes, you are write! It makes more sense in the other way around, so i left the
callbackas follows:

m_QuitItem->signal_activate().connect (
            sigc::mem_fun(*caller, &WindowMain::hide)
);

Indeed, i was doing something similar in the callback of the status icon of my new network manager. I still didn't finish it, but shortly i'll share the code here in the mailing list.
Anyway, I can give you a link to the backend so far:

https://git.devuan.org/aitor_czr/libnetaid

Thanks for your constructive correctness :)

Aitor.





_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to