From b04c37a7641b474ca066627da27d42e6134c4e17 Mon Sep 17 00:00:00 2001 From: infirit Date: Mon, 14 Sep 2015 19:07:06 +0200 Subject: Remove deprecated GTK+ symbols and use accessor functions Direct struct access has been deprecated, so use the appropriate replacements to build with GSEAL enabled. --- src/ui/metaaccellabel.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'src/ui/metaaccellabel.c') diff --git a/src/ui/metaaccellabel.c b/src/ui/metaaccellabel.c index e20bdeaa..da040ee8 100644 --- a/src/ui/metaaccellabel.c +++ b/src/ui/metaaccellabel.c @@ -426,48 +426,57 @@ meta_accel_label_expose_event (GtkWidget *widget, if (gtk_widget_is_drawable (GTK_WIDGET (accel_label))) { int ac_width; + GtkAllocation allocation; + GtkRequisition requisition; + gtk_widget_get_allocation (widget, &allocation); + gtk_widget_get_requisition (widget, &requisition); ac_width = meta_accel_label_get_accel_width (accel_label); - if (widget->allocation.width >= widget->requisition.width + ac_width) + if (allocation.width >= requisition.width + ac_width) { GtkTextDirection direction = gtk_widget_get_direction (widget); - gint x; - gint y; + gfloat xalign, yalign; + gint x, y; + gint xpad, ypad; + + gtk_misc_get_padding (misc, &xpad, &ypad); + gtk_misc_get_alignment (misc, &xalign, &yalign); if (direction == GTK_TEXT_DIR_RTL) { - widget->allocation.x += ac_width; + allocation.x += ac_width; } - widget->allocation.width -= ac_width; + allocation.width -= ac_width; + gtk_widget_set_allocation (widget, &allocation); if (GTK_WIDGET_CLASS (parent_class)->expose_event) GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); if (direction == GTK_TEXT_DIR_RTL) { - widget->allocation.x -= ac_width; + allocation.x -= ac_width; } - widget->allocation.width += ac_width; + allocation.width += ac_width; + gtk_widget_set_allocation (widget, &allocation); if (direction == GTK_TEXT_DIR_RTL) { - x = widget->allocation.x + misc->xpad; + x = allocation.x + allocation.width - xpad - ac_width; } else { - x = widget->allocation.x + widget->allocation.width - misc->xpad - ac_width; + x = allocation.x + allocation.width - xpad - ac_width; } - y = (widget->allocation.y * (1.0 - misc->yalign) + - (widget->allocation.y + widget->allocation.height - - (widget->requisition.height - misc->ypad * 2)) * - misc->yalign) + 1.5; + y = (allocation.y * (1.0 - yalign) + + (allocation.y + allocation.height - + (requisition.height - ypad * 2)) * yalign) + 1.5; layout = gtk_widget_create_pango_layout (widget, accel_label->accel_string); - gtk_paint_layout (widget->style, - widget->window, + gtk_paint_layout (gtk_widget_get_style (widget), + gtk_widget_get_window (widget), gtk_widget_get_state (widget), FALSE, &event->area, -- cgit v1.2.1