[empathy] Don't rely on the widget allocation to be != 0.



commit 3b1dc603c5f7174904bc1c6c01566700f0bab894
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Sep 23 18:43:43 2009 +0200

    Don't rely on the widget allocation to be != 0.
    
    This should fix bug #595945.

 src/empathy-call-window.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index e7cbadc..363d294 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -887,8 +887,18 @@ static void
 contact_avatar_changed_cb (EmpathyContact *contact,
     GParamSpec *pspec, GtkWidget *avatar_widget)
 {
-  init_contact_avatar_with_size (contact, avatar_widget,
-      avatar_widget->allocation.height);
+  int size;
+
+  size = avatar_widget->allocation.height;
+
+  if (size == 0)
+    {
+      /* the widget is not allocated yet, set a default size */
+      size = MIN (REMOTE_CONTACT_AVATAR_DEFAULT_HEIGHT,
+          REMOTE_CONTACT_AVATAR_DEFAULT_WIDTH);
+    }
+
+  init_contact_avatar_with_size (contact, avatar_widget, size);
 }
 
 static void



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