[Xfce4-commits] <midori:master> Allocation/ requisition accessors in KatzeThrobber

Christian Dywan noreply at xfce.org
Fri Feb 19 19:08:02 CET 2010


Updating branch refs/heads/master
         to ff97ec62321548dd24209dbac064b8f195fdd215 (commit)
       from 42cf0287819d7a865a23b4f874176f7ca22e74a0 (commit)

commit ff97ec62321548dd24209dbac064b8f195fdd215
Author: Christian Dywan <christian at twotoasts.de>
Date:   Fri Feb 19 16:39:14 2010 +0100

    Allocation/ requisition accessors in KatzeThrobber

 katze/katze-throbber.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/katze/katze-throbber.c b/katze/katze-throbber.c
index e6ab7df..2846625 100644
--- a/katze/katze-throbber.c
+++ b/katze/katze-throbber.c
@@ -16,6 +16,10 @@
 #include <glib/gi18n.h>
 #include <math.h>
 
+#if !GTK_CHECK_VERSION (2, 18, 0)
+    #define gtk_widget_get_allocation (wdgt, alloc) *alloc = wdgt->allocation
+#endif
+
 struct _KatzeThrobber
 {
     GtkMisc parent_instance;
@@ -793,16 +797,20 @@ katze_throbber_aligned_coords (GtkWidget* widget,
 {
     gfloat xalign, yalign;
     gint xpad, ypad;
+    GtkAllocation allocation;
+    GtkRequisition requisition;
 
     gtk_misc_get_alignment (GTK_MISC (widget), &xalign, &yalign);
     if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
         xalign = 1.0f - xalign;
     gtk_misc_get_padding (GTK_MISC (widget), &xpad, &ypad);
 
-    *ax = floor (widget->allocation.x + xpad
-        + ((widget->allocation.width - widget->requisition.width) * xalign));
-    *ay = floor (widget->allocation.y + ypad
-        + ((widget->allocation.height - widget->requisition.height) * yalign));
+    gtk_widget_get_allocation (widget, &allocation);
+    gtk_widget_size_request (widget, &requisition);
+    *ax = floor (allocation.x + xpad
+        + ((allocation.width - requisition.width) * xalign));
+    *ay = floor (allocation.y + ypad
+        + ((allocation.height - requisition.height) * yalign));
 }
 
 static gboolean



More information about the Xfce4-commits mailing list