aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/text
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-07-08 06:21:12 +0800
committerChris Lahey <clahey@src.gnome.org>2001-07-08 06:21:12 +0800
commit23bb03e9939cc86b68b546570edc7884d7a1b051 (patch)
treeee9770862dbdaa1bfa5f29aad61f09f7dd032efc /widgets/text
parentc7fac300f31e086be19d0291d618130ef01c09b7 (diff)
downloadgsoc2013-evolution-23bb03e9939cc86b68b546570edc7884d7a1b051.tar
gsoc2013-evolution-23bb03e9939cc86b68b546570edc7884d7a1b051.tar.gz
gsoc2013-evolution-23bb03e9939cc86b68b546570edc7884d7a1b051.tar.bz2
gsoc2013-evolution-23bb03e9939cc86b68b546570edc7884d7a1b051.tar.lz
gsoc2013-evolution-23bb03e9939cc86b68b546570edc7884d7a1b051.tar.xz
gsoc2013-evolution-23bb03e9939cc86b68b546570edc7884d7a1b051.tar.zst
gsoc2013-evolution-23bb03e9939cc86b68b546570edc7884d7a1b051.zip
Destroy the tooltip if we're the owner when we're destroyed. Also, keep a
2001-07-07 Christopher James Lahey <clahey@ximian.com> * gal/e-text/e-text.c, gal/e-text/e-text.h (e_text_destroy): Destroy the tooltip if we're the owner when we're destroyed. Also, keep a reference to the text object in case we get a signal on the window after the text object is destroyed. * gal/widgets/e-canvas.c (e_canvas_destroy): Hide the tooltip if there is one when the canvas is destroyed. svn path=/trunk/; revision=10888
Diffstat (limited to 'widgets/text')
-rw-r--r--widgets/text/e-text.c21
-rw-r--r--widgets/text/e-text.h2
2 files changed, 22 insertions, 1 deletions
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index fadb390c4f..d838518d5f 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -354,7 +354,7 @@ e_text_init (EText *text)
{
text->model = e_text_model_new ();
text->text = e_text_model_get_text (text->model);
-
+
gtk_object_ref (GTK_OBJECT (text->model));
gtk_object_sink (GTK_OBJECT (text->model));
@@ -420,6 +420,7 @@ e_text_init (EText *text)
text->tooltip_timeout = 0;
text->tooltip_count = 0;
+ text->tooltip_owner = FALSE;
text->dbl_timeout = 0;
text->tpl_timeout = 0;
@@ -445,6 +446,10 @@ e_text_destroy (GtkObject *object)
text = E_TEXT (object);
+ if (text->tooltip_owner) {
+ e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas));
+ }
+
if (text->model_changed_signal_id)
gtk_signal_disconnect (GTK_OBJECT (text->model),
text->model_changed_signal_id);
@@ -2682,6 +2687,9 @@ static gboolean
tooltip_event(GtkWidget *tooltip, GdkEvent *event, EText *text)
{
gint ret_val = FALSE;
+ if (GTK_OBJECT_DESTROYED (text)) {
+ return FALSE;
+ }
switch (event->type) {
case GDK_LEAVE_NOTIFY:
e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas));
@@ -2703,6 +2711,13 @@ tooltip_event(GtkWidget *tooltip, GdkEvent *event, EText *text)
return ret_val;
}
+static void
+tooltip_destroy(GtkWidget *tooltip, EText *text)
+{
+ text->tooltip_owner = FALSE;
+ gtk_object_unref (GTK_OBJECT (text));
+}
+
static gboolean
_do_tooltip (gpointer data)
{
@@ -2883,11 +2898,15 @@ _do_tooltip (gpointer data)
gtk_widget_realize (tooltip_window);
gtk_signal_connect (GTK_OBJECT(tooltip_window), "event",
GTK_SIGNAL_FUNC(tooltip_event), text);
+ gtk_signal_connect (GTK_OBJECT(tooltip_window), "destroy",
+ GTK_SIGNAL_FUNC(tooltip_destroy), text);
+ gtk_object_ref (GTK_OBJECT (text));
e_canvas_popup_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas),
tooltip_window,
pixel_origin.x - 2 + tooltip_x,
pixel_origin.y - 2 + tooltip_y);
+ text->tooltip_owner = TRUE;
text->tooltip_timeout = 0;
return FALSE;
diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h
index dfb25d21b5..b3126bf291 100644
--- a/widgets/text/e-text.h
+++ b/widgets/text/e-text.h
@@ -206,6 +206,8 @@ struct _EText {
guint bold : 1;
guint strikeout : 1;
+ guint tooltip_owner : 1;
+
EFontStyle style;
gchar *break_characters; /* Characters to optionally break after */