After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 651940 - "use-markup" is ignored when set after "text"?
"use-markup" is ignored when set after "text"?
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: ClutterText
1.6.x
Other All
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2011-06-05 16:05 UTC by Damien Lespiau
Modified: 2011-09-07 12:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
text: Make :use-markup set idempotent (7.56 KB, patch)
2011-09-06 11:50 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description Damien Lespiau 2011-06-05 16:05:02 UTC
When I'm creating a ClutterText from a json file with

{
  "type": "ClutterText",
  "use-markup": true,
  "text": "<b>Editor</b>"
}

the text displayed is "<b>Editor</b>" but while using

{
  "type": "ClutterText",
  "text": "<b>Editor</b>",
  "use-markup": true
}

it does works and displays a bold "Editor".

I'm guessing this is due to the ordering the properties are applied to the ClutterText, and potentially the text is not re-rendered if you set "use-markup" after "text"?
Comment 1 Emmanuele Bassi (:ebassi) 2011-09-06 11:50:00 UTC
Created attachment 195775 [details] [review]
text: Make :use-markup set idempotent

Setting :use-markup and :text is currently not idempotent, and it
depends on the ordering, e.g.:

  g_object_set (actor, "use-markup", TRUE, "text", value, NULL);

does not yield the same results as:

  g_object_set (actor, "text", value, "use-markup", TRUE, NULL);

This is particularly jarring when using ClutterText from ClutterScript,
but in general GObject properties should not rely on the order when used
from g_object_set().

The fix is to store the contents of the ClutterText as a separate string
from the displayed text, and use the contents, instead of the displayed
text, when toggling the :use-markup property.

Let's also add a unit test for good measure, to try and catch
regressions.
Comment 2 Emmanuele Bassi (:ebassi) 2011-09-07 12:01:17 UTC
Attachment 195775 [details] pushed as 0bd1e47 - text: Make :use-markup set idempotent