Commit b579b436 authored by Adrien Plazas's avatar Adrien Plazas
Browse files

deck: Add the navigatable child property

This can be used to skip children during navigation.
parent 709e0863
Pipeline #200315 passed with stages
in 18 minutes and 32 seconds
......@@ -75,6 +75,7 @@ enum {
enum {
CHILD_PROP_0,
CHILD_PROP_NAME,
CHILD_PROP_NAVIGATABLE,
LAST_CHILD_PROP,
};
......@@ -398,8 +399,8 @@ hdy_deck_get_interpolate_size (HdyDeck *self)
* @self: a #HdyDeck
* @can_swipe_back: the new value
*
* Sets whether or not @self allows switching to the previous child via a swipe
* gesture.
* Sets whether or not @self allows switching to the previous child that has
* 'navigatable' child property set to %TRUE via a swipe gesture
*
* Since: 1.0
*/
......@@ -435,8 +436,8 @@ hdy_deck_get_can_swipe_back (HdyDeck *self)
* @self: a #HdyDeck
* @can_swipe_forward: the new value
*
* Sets whether or not @self allows switching to the next child via a swipe
* gesture.
* Sets whether or not @self allows switching to the next child that has
* 'navigatable' child property set to %TRUE via a swipe gesture.
*
* Since: 1.0
*/
......@@ -472,8 +473,9 @@ hdy_deck_get_can_swipe_forward (HdyDeck *self)
* @self: a #HdyDeck
* @direction: the direction
*
* Gets the previous or next child, or %NULL if it doesn't exist. This will be
* the same widget hdy_deck_navigate() will navigate to.
* Gets the previous or next child that doesn't have 'navigatable' child
* property set to %FALSE, or %NULL if it doesn't exist. This will be the same
* widget hdy_deck_navigate() will navigate to.
*
* Returns: (nullable) (transfer none): the previous or next child, or
* %NULL if it doesn't exist.
......@@ -494,8 +496,9 @@ hdy_deck_get_adjacent_child (HdyDeck *self,
* @self: a #HdyDeck
* @direction: the direction
*
* Switches to the previous or next child, similar to performing a swipe
* gesture to go in @direction.
* Switches to the previous or next child that doesn't have 'navigatable' child
* property set to %FALSE, similar to performing a swipe gesture to go in
* @direction.
*
* Returns: %TRUE if visible child was changed, %FALSE otherwise.
*
......@@ -745,6 +748,10 @@ hdy_deck_get_child_property (GtkContainer *container,
g_value_set_string (value, hdy_stackable_box_get_child_name (HDY_GET_HELPER (container), widget));
break;
case CHILD_PROP_NAVIGATABLE:
g_value_set_boolean (value, hdy_stackable_box_get_child_navigatable (HDY_GET_HELPER (container), widget));
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
break;
......@@ -764,6 +771,11 @@ hdy_deck_set_child_property (GtkContainer *container,
gtk_container_child_notify_by_pspec (container, widget, pspec);
break;
case CHILD_PROP_NAVIGATABLE:
hdy_stackable_box_set_child_navigatable (HDY_GET_HELPER (container), widget, g_value_get_boolean (value));
gtk_container_child_notify_by_pspec (container, widget, pspec);
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
break;
......@@ -997,8 +1009,8 @@ hdy_deck_class_init (HdyDeckClass *klass)
/**
* HdyDeck:can-swipe-back:
*
* Whether or not the deck allows switching to the previous child via a swipe
* gesture.
* Whether or not the deck allows switching to the previous child that has
* 'navigatable' child property set to %TRUE via a swipe gesture.
*
* Since: 1.0
*/
......@@ -1012,8 +1024,8 @@ hdy_deck_class_init (HdyDeckClass *klass)
/**
* HdyDeck:can-swipe-forward:
*
* Whether or not the deck allows switching to the next child via a swipe
* gesture.
* Whether or not the deck allows switching to the next child that has
* 'navigatable' child property set to %TRUE via a swipe gesture.
*
* Since: 1.0
*/
......@@ -1033,6 +1045,22 @@ hdy_deck_class_init (HdyDeckClass *klass)
NULL,
G_PARAM_READWRITE);
/**
* HdyDeck:navigatable:
*
* Whether the child can be navigated to.
* If %FALSE, the child will be ignored by hdy_deck_get_adjacent_child(),
* hdy_deck_navigate(), and swipe gestures.
*
* Since: 1.0
*/
child_props[CHILD_PROP_NAVIGATABLE] =
g_param_spec_boolean ("navigatable",
_("Allow navigation"),
_("Whether the child can be navigated to"),
TRUE,
G_PARAM_READWRITE);
gtk_container_class_install_child_properties (container_class, LAST_CHILD_PROP, child_props);
gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_PANEL);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment