]> Pileus Git - ~andy/gtk/commitdiff
tooltip-text and tooltip-markup properties: Interpret an empty string as a
authorMurray Cumming <murrayc@murrayc.com>
Thu, 10 Jul 2008 17:46:25 +0000 (17:46 +0000)
committerMurray Cumming <murrayc@src.gnome.org>
Thu, 10 Jul 2008 17:46:25 +0000 (17:46 +0000)
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

ChangeLog
gtk/gtkwidget.c

index 5774a751b824a054e5195e59148df5e1507e7ed4..7f37b8650f693c714a0a95428fb70dbc3b8e820c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index c1c8a496a6983c22adc93e96a5b5b793a5b05561..686b0c1266d097696681ab5aa0d953c392239c0e 100644 (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,