[libhandy] stackable-box: Add get_adjacent_child()
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy] stackable-box: Add get_adjacent_child()
- Date: Tue, 2 Jun 2020 07:16:53 +0000 (UTC)
commit 411afd2186fd9e2af450ce44e68be1d47b36d733
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Tue Jun 2 00:16:45 2020 +0500
stackable-box: Add get_adjacent_child()
Signed-off-by: Alexander Mikhaylenko <alexm gnome org>
src/hdy-stackable-box-private.h | 2 ++
src/hdy-stackable-box.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
---
diff --git a/src/hdy-stackable-box-private.h b/src/hdy-stackable-box-private.h
index ac403713..605e80b4 100644
--- a/src/hdy-stackable-box-private.h
+++ b/src/hdy-stackable-box-private.h
@@ -65,6 +65,8 @@ gboolean hdy_stackable_box_get_can_swipe_forward (HdyStackableBox *self)
void hdy_stackable_box_set_can_swipe_forward (HdyStackableBox *self,
gboolean can_swipe_forward);
+GtkWidget *hdy_stackable_box_get_adjacent_child (HdyStackableBox *self,
+ HdyNavigationDirection direction);
gboolean hdy_stackable_box_navigate (HdyStackableBox *self,
HdyNavigationDirection direction);
diff --git a/src/hdy-stackable-box.c b/src/hdy-stackable-box.c
index 318bd17c..51e93165 100644
--- a/src/hdy-stackable-box.c
+++ b/src/hdy-stackable-box.c
@@ -1333,6 +1333,36 @@ find_swipeable_child (HdyStackableBox *self,
return child;
}
+/**
+ * hdy_stackable_box_get_adjacent_child
+ * @self: a #HdyStackableBox
+ * @direction: the direction
+ *
+ * Gets the previous or next child that doesn't have 'allow-visible' child
+ * property set to %FALSE, or %NULL if it doesn't exist. This will be the same
+ * widget hdy_stackable_box_navigate() will navigate to.
+ *
+ * Returns: (nullable) (transfer none): the previous or next child, or
+ * %NULL if it doesn't exist.
+ *
+ * Since: 1.0
+ */
+GtkWidget *
+hdy_stackable_box_get_adjacent_child (HdyStackableBox *self,
+ HdyNavigationDirection direction)
+{
+ HdyStackableBoxChildInfo *child;
+
+ g_return_val_if_fail (HDY_IS_STACKABLE_BOX (self), NULL);
+
+ child = find_swipeable_child (self, direction);
+
+ if (!child)
+ return NULL;
+
+ return child->widget;
+}
+
/**
* hdy_stackable_box_navigate
* @self: a #HdyStackableBox
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]