diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-06-21 17:19:00 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-06-21 17:19:00 +0800 |
commit | 9f03fdbe713fb5664626e19fa1b58e7eb4ca7e50 (patch) | |
tree | 1081aeeabc28a1f3326058afa5f406a4fd9af216 | |
parent | 946db1000fbbf2c04174bbbd2d84a1288ec4fe2d (diff) | |
download | gsoc2013-empathy-9f03fdbe713fb5664626e19fa1b58e7eb4ca7e50.tar gsoc2013-empathy-9f03fdbe713fb5664626e19fa1b58e7eb4ca7e50.tar.gz gsoc2013-empathy-9f03fdbe713fb5664626e19fa1b58e7eb4ca7e50.tar.bz2 gsoc2013-empathy-9f03fdbe713fb5664626e19fa1b58e7eb4ca7e50.tar.lz gsoc2013-empathy-9f03fdbe713fb5664626e19fa1b58e7eb4ca7e50.tar.xz gsoc2013-empathy-9f03fdbe713fb5664626e19fa1b58e7eb4ca7e50.tar.zst gsoc2013-empathy-9f03fdbe713fb5664626e19fa1b58e7eb4ca7e50.zip |
EmpathyChat: inherit from a GtkBox instead of a GtkBin
This allows us to get rid of the size_allocate method.
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 30 | ||||
-rw-r--r-- | 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 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,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 4b0540b20..0031410d6 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); |