[libhandy/wip/exalm/leaflet-transltions: 26/31] deck: Add 'visible' child property
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy/wip/exalm/leaflet-transltions: 26/31] deck: Add 'visible' child property
- Date: Tue, 4 Aug 2020 10:17:17 +0000 (UTC)
commit 7475c9772adeae381496bd44ea4195e6dd08db60
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Fri Jul 31 21:26:48 2020 +0500
deck: Add 'visible' child property
Expose HdyStackableBox child visibility.
Signed-off-by: Alexander Mikhaylenko <alexm gnome org>
src/hdy-deck.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
---
diff --git a/src/hdy-deck.c b/src/hdy-deck.c
index 01dc45e9..a778ecd6 100644
--- a/src/hdy-deck.c
+++ b/src/hdy-deck.c
@@ -75,6 +75,7 @@ enum {
enum {
CHILD_PROP_0,
CHILD_PROP_NAME,
+ CHILD_PROP_VISIBLE,
LAST_CHILD_PROP,
};
@@ -745,6 +746,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_VISIBLE:
+ g_value_set_boolean (value, hdy_stackable_box_get_child_visible (HDY_GET_HELPER (container), widget));
+ break;
+
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
break;
@@ -1033,6 +1038,18 @@ hdy_deck_class_init (HdyDeckClass *klass)
NULL,
G_PARAM_READWRITE);
+ /**
+ * HdyDeck:visible:
+ *
+ * Since: 1.0
+ */
+ child_props[CHILD_PROP_VISIBLE] =
+ g_param_spec_boolean ("visible",
+ _("Visible"),
+ _("Whether the child is currently visible"),
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY);
+
gtk_container_class_install_child_properties (container_class, LAST_CHILD_PROP, child_props);
gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_PANEL);
@@ -1068,6 +1085,15 @@ notify_orientation_cb (HdyDeck *self)
g_object_notify (G_OBJECT (self), "orientation");
}
+static void
+child_notify_visible_cb (HdyDeck *self,
+ GtkWidget *child)
+{
+ gtk_container_child_notify_by_pspec (GTK_CONTAINER (self),
+ child,
+ child_props[CHILD_PROP_VISIBLE]);
+}
+
static void
hdy_deck_init (HdyDeck *self)
{
@@ -1088,6 +1114,7 @@ hdy_deck_init (HdyDeck *self)
g_signal_connect_object (priv->box, "notify::can-swipe-back", G_CALLBACK (notify_can_swipe_back_cb), self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->box, "notify::can-swipe-forward", G_CALLBACK (notify_can_swipe_forward_cb),
self, G_CONNECT_SWAPPED);
g_signal_connect_object (priv->box, "notify::orientation", G_CALLBACK (notify_orientation_cb), self,
G_CONNECT_SWAPPED);
+ g_signal_connect_object (priv->box, "child-notify-visible", G_CALLBACK (child_notify_visible_cb), self,
G_CONNECT_SWAPPED);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]