From d88bc30b87b640fb4c11ebbb68d146810c379fde Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Fri, 27 Feb 2009 11:56:39 -0500 Subject: [PATCH] Allow NULL for clutter_text_set_text() As a convenience, if NULL is passed for the text argument of clutter_text_set_text() (and for consistency, clutter_text_set_markup()), treat that the same as "". --- clutter/clutter-text.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 4e8e38ad9..de80387f7 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -2887,11 +2887,9 @@ clutter_text_set_markup_internal (ClutterText *self, /** * clutter_text_set_text: * @self: a #ClutterText - * @text: the text to set + * @text: the text to set. Passing %NULL is the same as passing "" (the empty string) * - * Sets the contents of a #ClutterText actor. The @text string - * must not be %NULL; to unset the current contents of the - * #ClutterText actor simply pass "" (an empty string). + * Sets the contents of a #ClutterText actor. * * Since: 1.0 */ @@ -2900,10 +2898,9 @@ clutter_text_set_text (ClutterText *self, const gchar *text) { g_return_if_fail (CLUTTER_IS_TEXT (self)); - g_return_if_fail (text != NULL); clutter_text_set_use_markup_internal (self, FALSE); - clutter_text_set_text_internal (self, text); + clutter_text_set_text_internal (self, text ? text : ""); clutter_text_dirty_cache (self); @@ -2913,7 +2910,7 @@ clutter_text_set_text (ClutterText *self, /** * clutter_text_set_markup: * @self: a #ClutterText - * @markup: a string containing Pango markup + * @markup: a string containing Pango markup. Passing %NULL is the same as passing "" (the empty string) * * Sets @markup as the contents of a #ClutterText. * @@ -2932,10 +2929,9 @@ clutter_text_set_markup (ClutterText *self, const gchar *markup) { g_return_if_fail (CLUTTER_IS_TEXT (self)); - g_return_if_fail (markup != NULL); clutter_text_set_use_markup_internal (self, TRUE); - clutter_text_set_markup_internal (self, markup); + clutter_text_set_markup_internal (self, markup ? markup : ""); clutter_text_dirty_cache (self);