diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-11-11 22:03:46 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-11-11 22:13:44 +0800 |
commit | c87c03791366d2d038f2854c171e0c91e17207aa (patch) | |
tree | 4ea22423b38ff34405a43bbfd04272563663fb1d | |
parent | 379f636d605a99f04fbd29481ff755e783f34707 (diff) | |
download | gsoc2013-empathy-c87c03791366d2d038f2854c171e0c91e17207aa.tar gsoc2013-empathy-c87c03791366d2d038f2854c171e0c91e17207aa.tar.gz gsoc2013-empathy-c87c03791366d2d038f2854c171e0c91e17207aa.tar.bz2 gsoc2013-empathy-c87c03791366d2d038f2854c171e0c91e17207aa.tar.lz gsoc2013-empathy-c87c03791366d2d038f2854c171e0c91e17207aa.tar.xz gsoc2013-empathy-c87c03791366d2d038f2854c171e0c91e17207aa.tar.zst gsoc2013-empathy-c87c03791366d2d038f2854c171e0c91e17207aa.zip |
input-text-view: use get_preferred_height instead of size_request
-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)); } |