[libhandy] deck: Add the get_child_by_name() method



commit 7089f2dea9c51c8efe471ed4098dba4ec3f02a9d
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Mon Jul 20 08:36:49 2020 +0200

    deck: Add the get_child_by_name() method
    
    This will make it easier to replace GtkStack by HdyDeck in applications.

 debian/libhandy-1-0.symbols |  1 +
 src/hdy-deck.c              | 21 +++++++++++++++++++++
 src/hdy-deck.h              |  3 +++
 3 files changed, 25 insertions(+)
---
diff --git a/debian/libhandy-1-0.symbols b/debian/libhandy-1-0.symbols
index 800cb2fa..8095c08b 100644
--- a/debian/libhandy-1-0.symbols
+++ b/debian/libhandy-1-0.symbols
@@ -93,6 +93,7 @@ libhandy-1.so.0 libhandy-1-0 #MINVER#
  hdy_deck_get_adjacent_child@LIBHANDY_1_0 0.81.0
  hdy_deck_get_can_swipe_back@LIBHANDY_1_0 0.80.0
  hdy_deck_get_can_swipe_forward@LIBHANDY_1_0 0.80.0
+ hdy_deck_get_child_by_name@LIBHANDY_1_0 0.85.0
  hdy_deck_get_homogeneous@LIBHANDY_1_0 0.80.0
  hdy_deck_get_interpolate_size@LIBHANDY_1_0 0.80.0
  hdy_deck_get_transition_duration@LIBHANDY_1_0 0.80.0
diff --git a/src/hdy-deck.c b/src/hdy-deck.c
index 62baf4bc..56750227 100644
--- a/src/hdy-deck.c
+++ b/src/hdy-deck.c
@@ -504,6 +504,27 @@ hdy_deck_navigate (HdyDeck                *self,
   return hdy_stackable_box_navigate (HDY_GET_HELPER (self), direction);
 }
 
+/**
+ * hdy_deck_get_child_by_name:
+ * @self: a #HdyDeck
+ * @name: the name of the child to find
+ *
+ * Finds the child of @self with the name given as the argument. Returns %NULL
+ * if there is no child with this name.
+ *
+ * Returns: (transfer none) (nullable): the requested child of @self
+ *
+ * Since: 1.0
+ */
+GtkWidget *
+hdy_deck_get_child_by_name (HdyDeck     *self,
+                            const gchar *name)
+{
+  g_return_val_if_fail (HDY_IS_DECK (self), NULL);
+
+  return hdy_stackable_box_get_child_by_name (HDY_GET_HELPER (self), name);
+}
+
 /* This private method is prefixed by the call name because it will be a virtual
  * method in GTK 4.
  */
diff --git a/src/hdy-deck.h b/src/hdy-deck.h
index 471875fa..f7be6c9a 100644
--- a/src/hdy-deck.h
+++ b/src/hdy-deck.h
@@ -69,4 +69,7 @@ GtkWidget       *hdy_deck_get_adjacent_child (HdyDeck                *self,
 gboolean         hdy_deck_navigate (HdyDeck                *self,
                                     HdyNavigationDirection  direction);
 
+GtkWidget       *hdy_deck_get_child_by_name (HdyDeck     *self,
+                                             const gchar *name);
+
 G_END_DECLS


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]