gail: read spin button adjustment values directly
This commit is contained in:
parent
bec4c7bdb4
commit
d4729ecf19
1 changed files with 71 additions and 5 deletions
|
|
@ -127,7 +127,17 @@ gail_spin_button_get_current_value (AtkValue *obj,
|
|||
*/
|
||||
return;
|
||||
|
||||
atk_value_get_current_value (ATK_VALUE (spin_button->adjustment), value);
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
adjustment = GAIL_ADJUSTMENT (spin_button->adjustment)->adjustment;
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, adjustment->value);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -145,7 +155,17 @@ gail_spin_button_get_maximum_value (AtkValue *obj,
|
|||
*/
|
||||
return;
|
||||
|
||||
atk_value_get_maximum_value (ATK_VALUE (spin_button->adjustment), value);
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
adjustment = GAIL_ADJUSTMENT (spin_button->adjustment)->adjustment;
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, adjustment->upper);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -163,7 +183,17 @@ gail_spin_button_get_minimum_value (AtkValue *obj,
|
|||
*/
|
||||
return;
|
||||
|
||||
atk_value_get_minimum_value (ATK_VALUE (spin_button->adjustment), value);
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
adjustment = GAIL_ADJUSTMENT (spin_button->adjustment)->adjustment;
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, adjustment->lower);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -180,7 +210,31 @@ gail_spin_button_get_minimum_increment (AtkValue *obj, GValue *value)
|
|||
*/
|
||||
return;
|
||||
|
||||
atk_value_get_minimum_increment (ATK_VALUE (spin_button->adjustment), value);
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
gdouble minimum_increment;
|
||||
|
||||
adjustment = GAIL_ADJUSTMENT (spin_button->adjustment)->adjustment;
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
if (adjustment->step_increment != 0 &&
|
||||
adjustment->page_increment != 0)
|
||||
{
|
||||
if (ABS (adjustment->step_increment) < ABS (adjustment->page_increment))
|
||||
minimum_increment = adjustment->step_increment;
|
||||
else
|
||||
minimum_increment = adjustment->page_increment;
|
||||
}
|
||||
else if (adjustment->step_increment != 0)
|
||||
minimum_increment = adjustment->step_increment;
|
||||
else
|
||||
minimum_increment = adjustment->page_increment;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, minimum_increment);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
@ -198,7 +252,19 @@ gail_spin_button_set_current_value (AtkValue *obj,
|
|||
*/
|
||||
return FALSE;
|
||||
|
||||
return atk_value_set_current_value (ATK_VALUE (spin_button->adjustment), value);
|
||||
if (G_VALUE_HOLDS_DOUBLE (value))
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
adjustment = GAIL_ADJUSTMENT (spin_button->adjustment)->adjustment;
|
||||
if (adjustment == NULL)
|
||||
return FALSE;
|
||||
|
||||
gtk_adjustment_set_value (adjustment, g_value_get_double (value));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Reference in a new issue