[empathy] EmpathyChat: inherit from a GtkBox instead of a GtkBin



commit 9f03fdbe713fb5664626e19fa1b58e7eb4ca7e50
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue Jun 21 11:19:00 2011 +0200

    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 ++----------------------------
 libempathy-gtk/empathy-chat.h |    4 ++--
 2 files changed, 4 insertions(+), 30 deletions(-)
---
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index ecf849a..bb33130 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,34 +2941,11 @@ 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)
 {
 	EmpathyChat     *chat;
@@ -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",
diff --git a/libempathy-gtk/empathy-chat.h b/libempathy-gtk/empathy-chat.h
index 4b0540b..0031410 100644
--- a/libempathy-gtk/empathy-chat.h
+++ b/libempathy-gtk/empathy-chat.h
@@ -50,7 +50,7 @@ typedef struct _EmpathyChatClass  EmpathyChatClass;
 typedef struct _EmpathyChatPriv   EmpathyChatPriv;
 
 struct _EmpathyChat {
-	GtkBin parent;
+	GtkBox parent;
 	EmpathyChatPriv *priv;
 
 	/* Protected */
@@ -59,7 +59,7 @@ struct _EmpathyChat {
 };
 
 struct _EmpathyChatClass {
-	GtkBinClass parent;
+	GtkBoxClass parent;
 };
 
 GType              empathy_chat_get_type             (void);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]