gtk+ r20815 - in branches/gtk-2-12: . gtk



Author: murrayc
Date: Thu Jul 10 17:47:17 2008
New Revision: 20815
URL: http://svn.gnome.org/viewvc/gtk+?rev=20815&view=rev

Log:
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.

Modified:
   branches/gtk-2-12/ChangeLog
   branches/gtk-2-12/gtk/gtkwidget.c

Modified: branches/gtk-2-12/gtk/gtkwidget.c
==============================================================================
--- branches/gtk-2-12/gtk/gtkwidget.c	(original)
+++ branches/gtk-2-12/gtk/gtkwidget.c	Thu Jul 10 17:47:17 2008
@@ -2435,6 +2435,15 @@
       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);
 
@@ -2443,7 +2452,15 @@
       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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]