How do I display pango markup on a pango-markup-enabled widget?

I need to display a bit of pango markup on a widget that uses pango markup. So I need to somehow tell pango to not interpret a piece of text but to display it literally.

How to achieve this? I have found neither <code> nor <verbatim> nor <[[CDATA ... ]]> seem to work.

That would depend on the widget your using.

If, for example, you’re using a GtkLabel, you just put the text into the label property, and set use-markup to true.

I am feeding the text to the second argument of notify-send.

notify-send is not part of the C GLib, which language binding contains this?

Apart from that notify is a signal for when a property was changed, it’s to my knowledge not responsible for setting it.
I would suggest you use set_label on the label directly, if possible.

The notify-send tool does not deal with widgets: it deals with sending a notification using the freedesktop.org notification spec. Whatever notification listener exist on the other end of the communication channel is responsible for setting the notification’s body into a widget, according to its own rules—for instance, some notification managers might decide to strip all markup.

The only markup allowed in the body of a notification is outlined in the specification—but, again, it’s only advisory.

Well, I certainly do not want my notification code be tied to a single notification handler daemon.

Surely there should be a feature to “just display stuff without any markup”.

There’s the opposite capability: “body-markup”.

For instance, GNOME supports the following capabilities:

  • actions
  • body
  • body-markup
  • icon-static
  • persistence
  • sound

Of course, the capabilities only tell you what the notification daemon accepts, not how it will present the data.

And, once again: the markup allowed is not the full Pango markup language, but the strict subset of the notification specification; this is because the renderer of the notification may not use Pango at all.

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