Gtk_entry_set_extra_menu() -- is there a equivalent for gtk_spin_button? And how to set a callback vs action id?

I look for a way to port the obsoleted

g_signal_connect (G_OBJECT (entry), "populate_popup", ...)

where I previously used

menuitem = gtk_menu_item_new_with_label (cfg_label);
g_signal_connect (menuitem, "activate",
		  G_CALLBACK (ec_pcs_adjustment_configure), gpcs);

to add a callback to my new menuitem.

This worked for gtk_entry and also spin_entry…

Now I was able to add a menuitem via gtk_entry_set_extra_menu ():

            GMenu *menu = g_menu_new ();
            GMenuItem *menu_item_config = g_menu_item_new (cfg_label, NULL);
            //g_signal_connect (menu_item_config, "activate",
            //                  G_CALLBACK (ec_pcs_adjustment_configure), this);
            g_menu_append_item (menu, menu_item_config);
            gtk_entry_set_extra_menu (GTK_ENTRY (entry), G_MENU_MODEL (menu));
            g_object_unref (menu_item_config);

a) however, do I really need to create all this action stuff? how to add a callback to a menu_item most directly?

b) Now this works so far for gtk_entry() but I have not found a hook to do this for the new gtk_spin_button () menu. Is there a similar “set_extra_menu” function?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.