Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to render parentheses as part of url in gtk label?
    primarykey
    data
    text
    <p>I am using gtk in an application and I make use of the abilities of gtklabel text to be rendered automatically as a clickable url. This works well most of the time, however with a url which contains parentheses "(" and ")" this does not work. The versions I use are the ones available on debian (old)stable, i.e. debian 6 (2.20) and 7 (3.4.2).</p> <p>For example, I am trying to display the following url:</p> <pre><code>https://maps.google.com/maps?q=62.1891,+-141.5372+(Example+text+in+here+will+be+rendered+in+the+maps+label)&amp;iwloc=A&amp;hl=en </code></pre> <p>When I create a gtklabel with this text, for example:</p> <pre><code>text="&lt;b&gt;&lt;a href=\"https://maps.google.com/maps?q=62.1891,+-141.5372+(Example+text+in+here+will+be+rendered+in+the+maps+label)&amp;iwloc=A&amp;hl=en\" title=\"Map\"&gt;Click here for Map&lt;/a&gt;&lt;/b&gt;\n" </code></pre> <p>Then it will display fine in the label as an underlined link in bold with the text <strong>Click here for Map</strong></p> <p>However when you click the link it will not show correctly and this error appears:</p> <pre><code>Gtk-WARNING **: Unable to show '(null)': Operation not supported </code></pre> <p>It looks like the parentheses mess up the rendering of the url by gtk.</p> <p>Is there a way to escape the parentheses, or use a different character that works in the map url to create the label?</p> <p>I have tried various methods of escaping it, however none were effective so far. Such as using %28 and %29 to replace the parentheses as well as backslashes as an escape character.</p> <p>I am using the method described in <a href="https://developer.gnome.org/gtk2/2.24/GtkLabel.html" rel="nofollow">https://developer.gnome.org/gtk2/2.24/GtkLabel.html</a> and <a href="https://developer.gnome.org/gtk3/stable/GtkLabel.html" rel="nofollow">https://developer.gnome.org/gtk3/stable/GtkLabel.html</a> under "Links" which allows automatic rendering of links:</p> <blockquote> <p>Links</p> <p>Since 2.18, GTK+ supports markup for clickable hyperlinks in addition to regular Pango markup. The markup for links is borrowed from HTML, using the a with href and title attributes. GTK+ renders links similar to the way they appear in web browsers, with colored, underlined text. The title attribute is displayed as a tooltip on the link. An example looks like this:</p> <p>1 gtk_label_set_markup (label, "Go to the http://www.gtk.org\" title=\"&lt;i&gt;Our&amp;/i&gt; website\">GTK+ website for more...");</p> </blockquote> <p>I understand it is working in more recent releases of gtk (2.24 and 3.6), making sure to escape ampersands. But I was wondering if there is a work around for older gtk versions to avoid this problem?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload