Gio::SimpleAction, Gtk::Action



Hi,

I'm trying to port the menu of my program (Gelide) from the old interface using Gtk::Action to the new one using Gio::SimpleAction.
This new interface is a bit strange for me, or simply I can't find much documentation about.

In the old interface, we can create an Action and add its stock icon like this:

myaction = Gtk::Action::create("MyAction", Gtk::StockID("stock-icon-myaction"), _("_My Action"), _("A example action"));

Now, how can I achieve this with the new interface? I can't find information on how to add a stock icon to my actions.

Also in the old interface, we can set the Action's label and tooltip, now the label seems that has been moved to the new XML ui, but what happens to the tooltip?, where can I find information about the new XML format?
If we need to put the labels in the XML this force us to have the XML in a separate file for transtation, does it?, this is, if we want a translated menu, we can put the ui xml info in the code.

I'm also trying to por the toolbar, but it is harder that the menu. In the old interface we simply can put the toolbar items in the XML and then instantiate with a simple call to:

toolbar = (Gtk::Toolbar *) m_ui_manager->get_widget("/ToolBar");

Now (from the menus_and_toolbars example) seems that we have to put button by button and do some repetitive stuff like:

Gtk::Toolbar* toolbar = Gtk::manage(new Gtk::Toolbar());
Gtk::ToolButton* button = Gtk::manage(new Gtk::ToolButton());
button->set_icon_name("document-new");
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button->gobj()), "example.new");
toolbar->add(*button);

I think that the old interface seems to be easier than the new one, so what should I do? try to dive into the new interface or continue with the old one?

Greetings.
--
Atentamente:
Juan Ángel Moreno Fernández
jamf gm gmail com


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