From ecaf8c79100edb021581e1e409aeb7055800d469 Mon Sep 17 00:00:00 2001 From: Cody Russell Date: Thu, 7 Oct 2010 12:19:20 -0500 Subject: Listen to GtkMenuItem's 'toggle-size-allocate' signal to get the toggle size instead of using the GSEAL'd GtkMenuItem::toggle_size value. --- src/idoscalemenuitem.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/idoscalemenuitem.c') diff --git a/src/idoscalemenuitem.c b/src/idoscalemenuitem.c index f29c2dc..39cecbb 100644 --- a/src/idoscalemenuitem.c +++ b/src/idoscalemenuitem.c @@ -70,6 +70,7 @@ struct _IdoScaleMenuItemPrivate { gboolean grabbed; IdoScaleMenuItemStyle style; IdoRangeStyle range_style; + gint toggle_size; }; enum { @@ -188,7 +189,7 @@ ido_scale_menu_item_size_allocate (GtkWidget *widget, priv->child_allocation.y = GTK_CONTAINER (widget)->border_width + widget->style->ythickness; priv->child_allocation.x += horizontal_padding; - priv->child_allocation.x += GTK_MENU_ITEM (widget)->toggle_size; + priv->child_allocation.x += priv->toggle_size; priv->child_allocation.width = MAX (1, (gint)allocation->width - priv->child_allocation.x * 2); priv->child_allocation.width -= (primary_padding + secondary_padding); @@ -197,6 +198,16 @@ ido_scale_menu_item_size_allocate (GtkWidget *widget, gtk_widget_set_size_request (priv->scale, priv->child_allocation.width, -1); } +static void +ido_scale_menu_item_toggle_size_allocate (IdoScaleMenuItem *item, + gint toggle_size, + gpointer user_data) +{ + IdoScaleMenuItemPrivate *priv = GET_PRIVATE (item); + + priv->toggle_size = toggle_size; +} + static void ido_scale_menu_item_constructed (GObject *object) { @@ -235,6 +246,10 @@ ido_scale_menu_item_constructed (GObject *object) update_packing (self, priv->style, priv->style); + g_signal_connect (self, "toggle-size-allocate", + G_CALLBACK (ido_scale_menu_item_toggle_size_allocate), + NULL); + g_signal_connect (self, "notify", G_CALLBACK (ido_scale_menu_item_notify), NULL); -- cgit v1.2.3