]> Pileus Git - ~andy/gtk/commitdiff
create a dummy tip_window and tip_label, so old applications with code
authorKristian Rietveld <kris@imendio.com>
Tue, 7 Aug 2007 13:32:19 +0000 (13:32 +0000)
committerKristian Rietveld <kristian@src.gnome.org>
Tue, 7 Aug 2007 13:32:19 +0000 (13:32 +0000)
2007-08-07  Kristian Rietveld  <kris@imendio.com>

* gtk/gtktooltips.c (gtk_tooltips_init),
(gtk_tooltips_destroy), (gtk_tooltips_force_window): create a dummy
tip_window and tip_label, so old applications with code accessing
those fields won't crash.

svn path=/trunk/; revision=18587

ChangeLog
gtk/gtktooltips.c

index fb0709a3d203f17bed02eeb1011c0823dae6683c..bd7c772f6788ca7ab62f997272f2d51b66f03303 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-08-07  Kristian Rietveld  <kris@imendio.com>
+
+       * gtk/gtktooltips.c (gtk_tooltips_init),
+       (gtk_tooltips_destroy), (gtk_tooltips_force_window): create a dummy
+       tip_window and tip_label, so old applications with code accessing
+       those fields won't crash.
+
 2007-08-07  Kristian Rietveld  <kris@imendio.com>
 
        * gtk/gtktooltip.c (_gtk_tooltip_handle_event): Disable tooltips
index 1a560cd9a2ec2f51f42afd68ff3675c04f62ccc4..1a539738677890aa2561c33316552dac4c1d999c 100644 (file)
@@ -103,6 +103,8 @@ gtk_tooltips_init (GtkTooltips *tooltips)
   private->tips_data_table =
     g_hash_table_new_full (NULL, NULL, NULL,
                            (GDestroyNotify) gtk_tooltips_destroy_data);
+
+  gtk_tooltips_force_window (tooltips);
 }
 
 static void
@@ -144,6 +146,12 @@ gtk_tooltips_destroy (GtkObject *object)
 
   g_return_if_fail (tooltips != NULL);
 
+  if (tooltips->tip_window)
+    {
+      gtk_widget_destroy (tooltips->tip_window);
+      tooltips->tip_window = NULL;
+    }
+
   g_hash_table_remove_all (private->tips_data_table);
 
   GTK_OBJECT_CLASS (gtk_tooltips_parent_class)->destroy (object);
@@ -154,7 +162,18 @@ gtk_tooltips_force_window (GtkTooltips *tooltips)
 {
   g_return_if_fail (GTK_IS_TOOLTIPS (tooltips));
 
-  /* nop */
+  if (!tooltips->tip_window)
+    {
+      tooltips->tip_window = gtk_window_new (GTK_WINDOW_POPUP);
+      g_signal_connect (tooltips->tip_window,
+                       "destroy",
+                       G_CALLBACK (gtk_widget_destroyed),
+                       &tooltips->tip_window);
+
+      tooltips->tip_label = gtk_label_new (NULL);
+      gtk_container_add (GTK_CONTAINER (tooltips->tip_window),
+                        tooltips->tip_label);
+    }
 }
 
 void