textview: do not destroy the layout in unrealize

Now instead of invalidating when we create the layout we invalidate
when we realize the widget and we remove the invalidation when
unrealizing. It was pointless too destroying the layout in unrealize
as at the end what we just wanted was to remove the invalidation idles.
This commit is contained in:
Ignacio Casal Quinteiro 2011-06-12 17:52:23 +02:00
parent deed7175ca
commit 391917063e

View File

@ -307,7 +307,6 @@ static void gtk_text_view_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_text_view_realize (GtkWidget *widget);
static void gtk_text_view_unrealize (GtkWidget *widget);
static void gtk_text_view_unmap (GtkWidget *widget);
static void gtk_text_view_style_updated (GtkWidget *widget);
static void gtk_text_view_direction_changed (GtkWidget *widget,
GtkTextDirection previous_direction);
@ -603,7 +602,6 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
widget_class->destroy = gtk_text_view_destroy;
widget_class->realize = gtk_text_view_realize;
widget_class->unrealize = gtk_text_view_unrealize;
widget_class->unmap = gtk_text_view_unmap;
widget_class->style_updated = gtk_text_view_style_updated;
widget_class->direction_changed = gtk_text_view_direction_changed;
widget_class->grab_notify = gtk_text_view_grab_notify;
@ -4029,6 +4027,7 @@ gtk_text_view_realize (GtkWidget *widget)
text_window_realize (priv->bottom_window, widget);
gtk_text_view_ensure_layout (text_view);
gtk_text_view_invalidate (text_view);
if (priv->buffer)
{
@ -4067,8 +4066,7 @@ gtk_text_view_unrealize (GtkWidget *widget)
gtk_text_buffer_remove_selection_clipboard (priv->buffer, clipboard);
}
/* the idles have been removed in unmap */
g_assert (priv->first_validate_idle == 0 && priv->incremental_validate_idle == 0);
gtk_text_view_remove_validate_idles (text_view);
if (priv->popup_menu)
{
@ -4090,23 +4088,9 @@ gtk_text_view_unrealize (GtkWidget *widget)
if (priv->bottom_window)
text_window_unrealize (priv->bottom_window);
gtk_text_view_destroy_layout (text_view);
GTK_WIDGET_CLASS (gtk_text_view_parent_class)->unrealize (widget);
}
static void
gtk_text_view_unmap (GtkWidget *widget)
{
GtkTextView *text_view;
text_view = GTK_TEXT_VIEW (widget);
gtk_text_view_remove_validate_idles (text_view);
GTK_WIDGET_CLASS (gtk_text_view_parent_class)->unmap (widget);
}
static void
gtk_text_view_set_background (GtkTextView *text_view)
{
@ -6744,8 +6728,6 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
tmp_list = g_slist_next (tmp_list);
}
gtk_text_view_invalidate (text_view);
}
}