Gtk4-migrating-from-gtk3: menu items and markup

Dear All,
thanks in advance for reading me, I am migrating a Gtk3 app to Gtk4.
In my app some menu item labels where using markup labels:

   GtkWidget * markup_menu_item (gchar * label)
     GtkWidget * item = gtk_menu_item_new ();
     GtkWidget * lab = gtk_label_new (label);
     gtk_label_set_use_markup (GTK_LABEL(lab), TRUE);
     gtk_container_add (GTK_CONTAINER(item), lab);
     return item;

Now with the new API, I need to create menu items using:

   GMenuItem * menu_item (const gchar * label, 
                          const gchar * action, 
                          const gchar * accel,
                          const gchar * custom,
                          gboolean use_markup)
     GMenuItem * item = g_menu_item_new (label, action);
     if (accel) g_menu_item_set_attribute (item, "accel", "s", accel, NULL);
     if (custom) g_menu_item_set_attribute (item, "custom", "s", custom, NULL);
     if (use_markup)
       // What would be the attribute (if any ?)
       // g_menu_item_set_attribute (item,  ???, use_markup, NULL);

Is there an attribute to pass to the menu item or is the only way to insert a Widget latter on using the “custom” attribute ?

Thanks in advance for your help.

Best regards.


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