tooltip-text and tooltip-markup properties: Interpret an empty string as a

2008-07-03  Murray Cumming  <murrayc@murrayc.com>

* gtk/gtkwidget.c (gtk_widget_set_property):  tooltip-text and 
tooltip-markup properties: Interpret an empty string as a NULL 
string because an empty tooltip is silly. This will help 
language bindings that do not bother to have the two types of 
empty/null strings.
Bug #541399.

svn path=/trunk/; revision=20814
This commit is contained in:
Murray Cumming 2008-07-10 17:46:25 +00:00 committed by Murray Cumming
parent 418a348bef
commit 9c16d619b9
2 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2008-07-03 Murray Cumming <murrayc@murrayc.com>
* gtk/gtkwidget.c (gtk_widget_set_property): tooltip-text and
tooltip-markup properties: Interpret an empty string as a NULL
string because an empty tooltip is silly. This will help
language bindings that do not bother to have the two types of
empty/null strings.
Bug #541399.
2008-07-10 Matthias Clasen <mclasen@redhat.com>
Bug 542234 iconview a11y implementation segfaults

View File

@ -2478,6 +2478,15 @@ gtk_widget_set_property (GObject *object,
tooltip_window = g_object_get_qdata (object, quark_tooltip_window);
tooltip_markup = g_value_dup_string (value);
/* Treat an empty string as a NULL string,
* because an empty string would be useless for a tooltip:
*/
if (tooltip_markup && (strlen (tooltip_markup) == 0))
{
g_free (tooltip_markup);
tooltip_markup = NULL;
}
g_object_set_qdata_full (object, quark_tooltip_markup,
tooltip_markup, g_free);
@ -2486,7 +2495,15 @@ gtk_widget_set_property (GObject *object,
break;
case PROP_TOOLTIP_TEXT:
tooltip_window = g_object_get_qdata (object, quark_tooltip_window);
tooltip_text = g_value_get_string (value);
/* Treat an empty string as a NULL string,
* because an empty string would be useless for a tooltip:
*/
if (tooltip_text && (strlen (tooltip_text) == 0))
tooltip_text = NULL;
tooltip_markup = tooltip_text ? g_markup_escape_text (tooltip_text, -1) : NULL;
g_object_set_qdata_full (object, quark_tooltip_markup,