diff options
-rw-r--r-- | libempathy-gtk/empathy-input-text-view.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/libempathy-gtk/empathy-input-text-view.c b/libempathy-gtk/empathy-input-text-view.c index 4b9a61150..78502ef83 100644 --- a/libempathy-gtk/empathy-input-text-view.c +++ b/libempathy-gtk/empathy-input-text-view.c @@ -37,26 +37,22 @@ struct _EmpathyInputTextViewPrivate gboolean has_input_vscroll; }; -static gboolean -chat_input_set_size_request_idle (gpointer sw) -{ - gtk_widget_set_size_request (sw, -1, MAX_INPUT_HEIGHT); - - return FALSE; -} - static void -empathy_input_text_view_size_request (GtkWidget *widget, - GtkRequisition *requisition) +empathy_input_text_view_get_preferred_height (GtkWidget *widget, + gint *minimum_height, + gint *natural_height) { EmpathyInputTextView *self = (EmpathyInputTextView *) widget; GtkWidget *sw; + GTK_WIDGET_CLASS (empathy_input_text_view_parent_class)->get_preferred_height + (widget, minimum_height, natural_height); + sw = gtk_widget_get_parent (widget); - if (requisition->height >= MAX_INPUT_HEIGHT && !self->priv->has_input_vscroll) + if (*minimum_height >= MAX_INPUT_HEIGHT && !self->priv->has_input_vscroll) { /* Display scroll bar */ - g_idle_add (chat_input_set_size_request_idle, sw); + gtk_widget_set_size_request (sw, -1, MAX_INPUT_HEIGHT); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_NEVER, @@ -65,7 +61,7 @@ empathy_input_text_view_size_request (GtkWidget *widget, self->priv->has_input_vscroll = TRUE; } - if (requisition->height < MAX_INPUT_HEIGHT && self->priv->has_input_vscroll) + if (*minimum_height < MAX_INPUT_HEIGHT && self->priv->has_input_vscroll) { /* Hide scroll bar */ gtk_widget_set_size_request (sw, -1, -1); @@ -83,7 +79,8 @@ empathy_input_text_view_class_init (EmpathyInputTextViewClass *cls) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (cls); - widget_class->size_request = empathy_input_text_view_size_request; + widget_class->get_preferred_height = + empathy_input_text_view_get_preferred_height; g_type_class_add_private (cls, sizeof (EmpathyInputTextViewPrivate)); } |