]> git.0d.be Git - empathy.git/commitdiff
CallWindow: properly determine the sidebar width
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Mon, 11 Jul 2011 15:04:47 +0000 (16:04 +0100)
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Tue, 12 Jul 2011 08:46:23 +0000 (09:46 +0100)
The first time we show the sidebar, gtk_widget_get_allocation()
doesn't return the correct width as the allocation hasn't been
done yet. So use gtk_widget_get_preferred_width() as the minimum
width is what is actually allocated.

src/empathy-call-window.c

index 5103eb901577d775bda32aa347a1e95b110a39f6..091a6e3c7d0859abba8712e9b91868ef95b89acf 100644 (file)
@@ -2859,8 +2859,8 @@ empathy_call_window_show_sidebar (EmpathyCallWindow *window,
     gboolean active)
 {
   EmpathyCallWindowPriv *priv = GET_PRIV (window);
-  int w, h, handle_size;
-  GtkAllocation allocation, sidebar_allocation;
+  int w, h, sidebar_width, handle_size;
+  GtkAllocation allocation;
   gchar *page;
   gboolean dialpad_shown;
 
@@ -2870,16 +2870,16 @@ empathy_call_window_show_sidebar (EmpathyCallWindow *window,
 
   gtk_widget_style_get (priv->pane, "handle_size", &handle_size, NULL);
 
-  gtk_widget_get_allocation (priv->sidebar, &sidebar_allocation);
+  gtk_widget_get_preferred_width (priv->sidebar, &sidebar_width, NULL);
 
   if (active)
     {
       gtk_widget_show (priv->sidebar);
-      w += sidebar_allocation.width + handle_size;
+      w += sidebar_width + handle_size;
     }
   else
     {
-      w -= sidebar_allocation.width + handle_size;
+      w -= sidebar_width + handle_size;
       gtk_widget_hide (priv->sidebar);
     }