[libhandy] stackable-box: Add the get_child_by_name() method
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy] stackable-box: Add the get_child_by_name() method
- Date: Mon, 20 Jul 2020 10:51:03 +0000 (UTC)
commit dbd66ac0dd4791c1c90c9b8137f53699ddb84ac1
Author: Adrien Plazas <kekun plazas laposte net>
Date: Mon Jul 20 08:35:36 2020 +0200
stackable-box: 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-stackable-box-private.h | 3 +++
src/hdy-stackable-box.c | 26 ++++++++++++++++++++++++++
3 files changed, 30 insertions(+)
---
diff --git a/debian/libhandy-1-0.symbols b/debian/libhandy-1-0.symbols
index 82371b09..800cb2fa 100644
--- a/debian/libhandy-1-0.symbols
+++ b/debian/libhandy-1-0.symbols
@@ -290,6 +290,7 @@ libhandy-1.so.0 libhandy-1-0 #MINVER#
hdy_stackable_box_get_can_swipe_forward@LIBHANDY_1_0 0.80.0
hdy_stackable_box_get_cancel_progress@LIBHANDY_1_0 0.81.0
hdy_stackable_box_get_child_allow_visible@LIBHANDY_1_0 0.80.0
+ hdy_stackable_box_get_child_by_name@LIBHANDY_1_0 0.85.0
hdy_stackable_box_get_child_name@LIBHANDY_1_0 0.80.0
hdy_stackable_box_get_child_transition_duration@LIBHANDY_1_0 0.80.0
hdy_stackable_box_get_child_transition_running@LIBHANDY_1_0 0.80.0
diff --git a/src/hdy-stackable-box-private.h b/src/hdy-stackable-box-private.h
index 9d50298d..20053919 100644
--- a/src/hdy-stackable-box-private.h
+++ b/src/hdy-stackable-box-private.h
@@ -70,6 +70,9 @@ GtkWidget *hdy_stackable_box_get_adjacent_child (HdyStackableBox *s
gboolean hdy_stackable_box_navigate (HdyStackableBox *self,
HdyNavigationDirection direction);
+GtkWidget *hdy_stackable_box_get_child_by_name (HdyStackableBox *self,
+ const gchar *name);
+
GtkOrientation hdy_stackable_box_get_orientation (HdyStackableBox *self);
void hdy_stackable_box_set_orientation (HdyStackableBox *self,
GtkOrientation orientation);
diff --git a/src/hdy-stackable-box.c b/src/hdy-stackable-box.c
index ac799704..937b00ae 100644
--- a/src/hdy-stackable-box.c
+++ b/src/hdy-stackable-box.c
@@ -1279,6 +1279,32 @@ hdy_stackable_box_navigate (HdyStackableBox *self,
return TRUE;
}
+/**
+ * hdy_stackable_box_get_child_by_name:
+ * @self: a #HdyStackableBox
+ * @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_stackable_box_get_child_by_name (HdyStackableBox *self,
+ const gchar *name)
+{
+ HdyStackableBoxChildInfo *child_info;
+
+ g_return_val_if_fail (HDY_IS_STACKABLE_BOX (self), NULL);
+ g_return_val_if_fail (name != NULL, NULL);
+
+ child_info = find_child_info_for_name (self, name);
+
+ return child_info ? child_info->widget : NULL;
+}
+
static void
get_preferred_size (gint *min,
gint *nat,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]