Re: GtkUIManager, GtkActionGroup and GtkAction

From: Date: Sat, 09 Sep 2006 20:37:33 +0000
Subject: Re: GtkUIManager, GtkActionGroup and GtkAction
References: 1  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-3405@lists.php.net to get a copy of this message
Now you have to provide an action for every item in the xml definition, or it will not be shown. You can define the actions by a) creating an GtkAction object for every single action, connecting a callback to the "activate" signal and adding it to the action group via ->add_action($action). The drawback is that you cannot just do
$group->add_action(new GtkAction("Name", "_Title", "Tooltip", Gtk::STOCK_NEW));
because you need to add the callback, too. Therefore I vote for adding a fifth, optional parameter that represents a callback and is connected if passed to the constructor.
Sounds fine to me.
b) by using the currently not implemented $group->add_actions(array of GtkActionEntries). A GtkActionEntry is a struct that just contains the same information as a GtkAction, just the plain text version - so it can be represented by an array in php:
$group->add_actions( array( array($name, $stock_id, $label, $accelerator, $tooltip), array($name2, $stock_id2, $label2, $accelerator2, $tooltip2) );
I am wondering now if we should allow passing an array of GtkActions to the method, not only arrays? I personally think it is useful in some special cases only, but if you really want to customize your actions it is useful. And the name also implies that you can add actions, not arrays only.
I agree. Go for it. -Andrei

« previous php.gtk.dev (#3405) next »