diff --git a/modules/other/gail/gailpaned.c b/modules/other/gail/gailpaned.c index 5ac2d2340..c224d8e77 100644 --- a/modules/other/gail/gailpaned.c +++ b/modules/other/gail/gailpaned.c @@ -43,6 +43,14 @@ static void gail_paned_get_minimum_value (AtkValue *obj, GValue *value); static gboolean gail_paned_set_current_value (AtkValue *obj, const GValue *value); +#if ATK_CHECK_VERSION (2, 12, 0) +static void gail_paned_get_value_and_text (AtkValue *obj, + gdouble *value, + gchar **text); +static AtkRange *gail_paned_get_range (AtkValue *obj); +static void gail_paned_set_value (AtkValue *obj, + gdouble new_value); +#endif G_DEFINE_TYPE_WITH_CODE (GailPaned, gail_paned, GAIL_TYPE_CONTAINER, G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init)) @@ -112,6 +120,11 @@ atk_value_interface_init (AtkValueIface *iface) iface->get_maximum_value = gail_paned_get_maximum_value; iface->get_minimum_value = gail_paned_get_minimum_value; iface->set_current_value = gail_paned_set_current_value; +#if ATK_CHECK_VERSION (2, 12, 0) + iface->get_value_and_text = gail_paned_get_value_and_text; + iface->get_range = gail_paned_get_range; + iface->set_value = gail_paned_set_value; +#endif } static void @@ -197,3 +210,56 @@ gail_paned_set_current_value (AtkValue *obj, else return FALSE; } + +#if ATK_CHECK_VERSION (2, 12, 0) +static void +gail_paned_get_value_and_text (AtkValue *obj, + gdouble *value, + gchar **text) +{ + GtkWidget *widget; + + if (text) + *text = NULL; + + if (!value) + return; + + widget = GTK_ACCESSIBLE (obj)->widget; + if (widget == NULL) + { + *value = 0.0; + return; + } + + *value = gtk_paned_get_position (GTK_PANED (widget)); +} + +static AtkRange * +gail_paned_get_range (AtkValue *obj) +{ + GtkWidget *widget; + GtkPaned *paned; + + widget = GTK_ACCESSIBLE (obj)->widget; + if (widget == NULL) + return NULL; + + paned = GTK_PANED (widget); + + return atk_range_new (paned->min_position, paned->max_position, NULL); +} + +static void +gail_paned_set_value (AtkValue *obj, + gdouble new_value) +{ + GtkWidget *widget; + + widget = GTK_ACCESSIBLE (obj)->widget; + if (widget == NULL) + return; + + gtk_paned_set_position (GTK_PANED (widget), (gint) new_value); +} +#endif