diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-04-02 17:42:13 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-04-02 17:42:13 +0800 |
commit | 370713a1df40ec01a7fca7a503580eebe6fc85bf (patch) | |
tree | fd10baf1ea6e73c570f370ca74969c5ba5425776 /libempathy-gtk | |
parent | d65be8a6c83ddb51e909500ebee1cbac2a34275b (diff) | |
download | gsoc2013-empathy-370713a1df40ec01a7fca7a503580eebe6fc85bf.tar gsoc2013-empathy-370713a1df40ec01a7fca7a503580eebe6fc85bf.tar.gz gsoc2013-empathy-370713a1df40ec01a7fca7a503580eebe6fc85bf.tar.bz2 gsoc2013-empathy-370713a1df40ec01a7fca7a503580eebe6fc85bf.tar.lz gsoc2013-empathy-370713a1df40ec01a7fca7a503580eebe6fc85bf.tar.xz gsoc2013-empathy-370713a1df40ec01a7fca7a503580eebe6fc85bf.tar.zst gsoc2013-empathy-370713a1df40ec01a7fca7a503580eebe6fc85bf.zip |
Redefine size_request and size_allocation on EmpathyChatClass
svn path=/trunk/; revision=850
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 51 | ||||
-rw-r--r-- | libempathy-gtk/empathy-chat.glade | 1 |
2 files changed, 47 insertions, 5 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 7079775cf..5533541ff 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -1267,6 +1267,46 @@ chat_create_ui (EmpathyChat *chat) } static void +chat_size_request (GtkWidget *widget, + GtkRequisition *requisition) +{ + GtkBin *bin = GTK_BIN (widget); + + requisition->width = GTK_CONTAINER (widget)->border_width * 2; + requisition->height = GTK_CONTAINER (widget)->border_width * 2; + + if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) + { + GtkRequisition child_requisition; + + gtk_widget_size_request (bin->child, &child_requisition); + + requisition->width += child_requisition.width; + requisition->height += child_requisition.height; + } +} + +static void +chat_size_allocate (GtkWidget *widget, + GtkAllocation *allocation) +{ + GtkBin *bin = GTK_BIN (widget); + GtkAllocation child_allocation; + + widget->allocation = *allocation; + + if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) + { + child_allocation.x = allocation->x + GTK_CONTAINER (widget)->border_width; + child_allocation.y = allocation->y + GTK_CONTAINER (widget)->border_width; + child_allocation.width = MAX (allocation->width - GTK_CONTAINER (widget)->border_width * 2, 0); + child_allocation.height = MAX (allocation->height - GTK_CONTAINER (widget)->border_width * 2, 0); + + gtk_widget_size_allocate (bin->child, &child_allocation); + } +} + +static void chat_finalize (GObject *object) { EmpathyChat *chat; @@ -1294,7 +1334,6 @@ chat_finalize (GObject *object) g_object_unref (priv->mc); g_object_unref (priv->log_manager); - if (priv->tp_chat) { g_object_unref (priv->tp_chat); } @@ -1323,15 +1362,17 @@ chat_constructed (GObject *object) static void empathy_chat_class_init (EmpathyChatClass *klass) { - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = chat_finalize; object_class->get_property = chat_get_property; object_class->set_property = chat_set_property; object_class->constructed = chat_constructed; + widget_class->size_request = chat_size_request; + widget_class->size_allocate = chat_size_allocate; + g_object_class_install_property (object_class, PROP_TP_CHAT, g_param_spec_object ("tp-chat", @@ -1396,7 +1437,7 @@ static void empathy_chat_init (EmpathyChat *chat) { EmpathyChatPriv *priv = GET_PRIV (chat); - GtkTextBuffer *buffer; + GtkTextBuffer *buffer; chat_create_ui (chat); diff --git a/libempathy-gtk/empathy-chat.glade b/libempathy-gtk/empathy-chat.glade index 0a801adc0..9428474b5 100644 --- a/libempathy-gtk/empathy-chat.glade +++ b/libempathy-gtk/empathy-chat.glade @@ -3,6 +3,7 @@ <!--*- mode: xml -*--> <glade-interface> <widget class="GtkWindow" id="chat_window"> + <property name="visible">True</property> <property name="border_width">6</property> <property name="title" translatable="yes">Group Chat</property> <property name="icon_name">system-users</property> |