diff options
author | Cody Russell <crussell@canonical.com> | 2010-02-09 09:19:48 -0600 |
---|---|---|
committer | Cody Russell <crussell@canonical.com> | 2010-02-09 09:19:48 -0600 |
commit | e8c2d569fa0cbec8a4d6877c10716d73fdfc0bae (patch) | |
tree | 20385a0749c16da3e0603ac640c14d7b21d4c184 | |
parent | bd5faca60860c60a5a9075b7a7b084f379e3dcf4 (diff) | |
download | ayatana-ido-e8c2d569fa0cbec8a4d6877c10716d73fdfc0bae.tar.gz ayatana-ido-e8c2d569fa0cbec8a4d6877c10716d73fdfc0bae.tar.bz2 ayatana-ido-e8c2d569fa0cbec8a4d6877c10716d73fdfc0bae.zip |
Upper/lower clamping on icon click
-rw-r--r-- | src/idoscalemenuitem.c | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/src/idoscalemenuitem.c b/src/idoscalemenuitem.c index db1546e..97cee06 100644 --- a/src/idoscalemenuitem.c +++ b/src/idoscalemenuitem.c @@ -379,15 +379,14 @@ ido_scale_menu_item_button_release_event (GtkWidget *menuitem, event->x < priv->child_allocation.x + priv->left_padding) { GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (priv->scale)); - gdouble value = gtk_adjustment_get_value (adj); if (gtk_widget_get_direction (menuitem) == GTK_TEXT_DIR_LTR) { - gtk_adjustment_set_value (adj, value - gtk_adjustment_get_step_increment (adj)); + gtk_adjustment_set_value (adj, gtk_adjustment_get_lower (adj)); } else { - gtk_adjustment_set_value (adj, value + gtk_adjustment_get_step_increment (adj)); + gtk_adjustment_set_value (adj, gtk_adjustment_get_upper (adj)); } return TRUE; @@ -397,15 +396,14 @@ ido_scale_menu_item_button_release_event (GtkWidget *menuitem, event->x > priv->child_allocation.x + priv->child_allocation.width + priv->left_padding) { GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (priv->scale)); - gdouble value = gtk_adjustment_get_value (adj); if (gtk_widget_get_direction (menuitem) == GTK_TEXT_DIR_LTR) { - gtk_adjustment_set_value (adj, value + gtk_adjustment_get_step_increment (adj)); + gtk_adjustment_set_value (adj, gtk_adjustment_get_upper (adj)); } else { - gtk_adjustment_set_value (adj, value - gtk_adjustment_get_step_increment (adj)); + gtk_adjustment_set_value (adj, gtk_adjustment_get_lower (adj)); } return TRUE; @@ -467,36 +465,6 @@ ido_scale_menu_item_secondary_image_notify (GtkImage *image, gtk_widget_show (GTK_WIDGET (image)); } -#if 0 -static void -ido_scale_menu_item_primary_button_press (GtkWidget *image, - GdkEventButton *event, - IdoScaleMenuItem *item) -{ - IdoScaleMenuItemPrivate *priv = GET_PRIVATE (item); - GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (priv->scale)); - gdouble value = gtk_adjustment_get_value (adj); - - g_print ("button primary\n"); - - gtk_adjustment_set_value (adj, value - gtk_adjustment_get_step_increment (adj)); -} - -static void -ido_scale_menu_item_secondary_button_press (GtkWidget *image, - GdkEventButton *event, - IdoScaleMenuItem *item) -{ - IdoScaleMenuItemPrivate *priv = GET_PRIVATE (item); - GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (priv->scale)); - gdouble value = gtk_adjustment_get_value (adj); - - g_print ("button secondary\n"); - - gtk_adjustment_set_value (adj, value + gtk_adjustment_get_step_increment (adj)); -} -#endif - /** * ido_scale_menu_item_new: * @label: the text of the new menu item. |