diff options
author | Murray Cumming <murrayc@murrayc.com> | 2008-07-10 17:46:25 +0000 |
---|---|---|
committer | Murray Cumming <murrayc@src.gnome.org> | 2008-07-10 17:46:25 +0000 |
commit | 9c16d619b91dfd68a59eca8f99614dd1a55d599c (patch) | |
tree | 3b76a63b017c1b2ac12402faaf448833dfc3ac82 | |
parent | 418a348befa8607d0d69a4ffffe5f31fce128578 (diff) | |
download | gtk+-9c16d619b91dfd68a59eca8f99614dd1a55d599c.tar.gz |
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
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 17 |
2 files changed, 26 insertions, 0 deletions
@@ -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 diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index c1c8a496a6..686b0c1266 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -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, |