From 9f03fdbe713fb5664626e19fa1b58e7eb4ca7e50 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 21 Jun 2011 11:19:00 +0200 Subject: EmpathyChat: inherit from a GtkBox instead of a GtkBin This allows us to get rid of the size_allocate method. --- libempathy-gtk/empathy-chat.c | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'libempathy-gtk/empathy-chat.c') diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index ecf849aaf..bb33130e3 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -180,7 +180,7 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; -G_DEFINE_TYPE (EmpathyChat, empathy_chat, GTK_TYPE_BIN); +G_DEFINE_TYPE (EmpathyChat, empathy_chat, GTK_TYPE_BOX); static gboolean update_misspelled_words (gpointer data); @@ -2941,33 +2941,10 @@ chat_create_ui (EmpathyChat *chat) g_list_free (list); /* Add the main widget in the chat widget */ - gtk_container_add (GTK_CONTAINER (chat), priv->widget); + gtk_box_pack_start (GTK_BOX (chat), priv->widget, TRUE, TRUE, 0); g_object_unref (gui); } -static void -chat_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - GtkBin *bin = GTK_BIN (widget); - GtkAllocation child_allocation; - GtkWidget *child; - - gtk_widget_set_allocation (widget, allocation); - - child = gtk_bin_get_child (bin); - - if (child && gtk_widget_get_visible (child)) - { - child_allocation.x = allocation->x + gtk_container_get_border_width (GTK_CONTAINER (widget)); - child_allocation.y = allocation->y + gtk_container_get_border_width (GTK_CONTAINER (widget)); - child_allocation.width = MAX (allocation->width - gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2, 0); - child_allocation.height = MAX (allocation->height - gtk_container_get_border_width (GTK_CONTAINER (widget)) * 2, 0); - - gtk_widget_size_allocate (child, &child_allocation); - } -} - static void chat_finalize (GObject *object) { @@ -3058,7 +3035,6 @@ chat_constructed (GObject *object) static void empathy_chat_class_init (EmpathyChatClass *klass) { - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = chat_finalize; @@ -3066,8 +3042,6 @@ empathy_chat_class_init (EmpathyChatClass *klass) object_class->set_property = chat_set_property; object_class->constructed = chat_constructed; - widget_class->size_allocate = chat_size_allocate; - g_object_class_install_property (object_class, PROP_TP_CHAT, g_param_spec_object ("tp-chat", -- cgit v1.2.3