aboutsummaryrefslogtreecommitdiff
path: root/src/idoscalemenuitem.c
diff options
context:
space:
mode:
authorCody Russell <crussell@canonical.com>2010-10-07 12:19:20 -0500
committerCody Russell <crussell@canonical.com>2010-10-07 12:19:20 -0500
commitecaf8c79100edb021581e1e409aeb7055800d469 (patch)
tree52f44e173adc957892b6c654e4bb120a5dd06ce8 /src/idoscalemenuitem.c
parent193b506128b7ebb7246047fe61e7a188d48f66cf (diff)
downloadayatana-ido-ecaf8c79100edb021581e1e409aeb7055800d469.tar.gz
ayatana-ido-ecaf8c79100edb021581e1e409aeb7055800d469.tar.bz2
ayatana-ido-ecaf8c79100edb021581e1e409aeb7055800d469.zip
Listen to GtkMenuItem's 'toggle-size-allocate' signal to get the toggle size instead of using the GSEAL'd GtkMenuItem::toggle_size value.
Diffstat (limited to 'src/idoscalemenuitem.c')
-rw-r--r--src/idoscalemenuitem.c17
1 files changed, 16 insertions, 1 deletions
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);
@@ -198,6 +199,16 @@ ido_scale_menu_item_size_allocate (GtkWidget *widget,
}
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)
{
IdoScaleMenuItem *self = IDO_SCALE_MENU_ITEM (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);