[libhandy/wip/exalm/leaflet-transltions: 7/10] leaflet: Add child-visible-changed signal
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy/wip/exalm/leaflet-transltions: 7/10] leaflet: Add child-visible-changed signal
- Date: Tue, 16 Jun 2020 12:49:55 +0000 (UTC)
commit b23d783b9d0537d8529fe42c70b2f7737c5ee38b
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Fri May 29 01:02:04 2020 +0500
leaflet: Add child-visible-changed signal
Expose the new HdyStackableBox signal.
Signed-off-by: Alexander Mikhaylenko <alexm gnome org>
src/hdy-leaflet.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
---
diff --git a/src/hdy-leaflet.c b/src/hdy-leaflet.c
index 0addd255..898a2744 100644
--- a/src/hdy-leaflet.c
+++ b/src/hdy-leaflet.c
@@ -76,6 +76,11 @@ enum {
LAST_CHILD_PROP,
};
+enum {
+ SIGNAL_CHILD_VISIBLE_CHANGED,
+ SIGNAL_LAST_SIGNAL,
+};
+
typedef struct
{
HdyStackableBox *box;
@@ -83,6 +88,7 @@ typedef struct
static GParamSpec *props[LAST_PROP];
static GParamSpec *child_props[LAST_CHILD_PROP];
+static guint signals[SIGNAL_LAST_SIGNAL];
static void hdy_leaflet_swipeable_init (HdySwipeableInterface *iface);
@@ -1124,6 +1130,27 @@ hdy_leaflet_class_init (HdyLeafletClass *klass)
gtk_container_class_install_child_properties (container_class, LAST_CHILD_PROP, child_props);
+ /**
+ * HdyLeaflet::child-visible-changed:
+ * @self: The #HdyLeaflet instance
+ * @child: The child
+ * @visible: The new value
+ *
+ * This signal is emitted after a child has been shown or hidden.
+ *
+ * Since: 1.0
+ */
+ signals[SIGNAL_CHILD_VISIBLE_CHANGED] =
+ g_signal_new ("child-visible-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL, NULL,
+ G_TYPE_NONE,
+ 2,
+ GTK_TYPE_WIDGET,
+ G_TYPE_BOOLEAN);
+
gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_PANEL);
gtk_widget_class_set_css_name (widget_class, "leaflet");
}
@@ -1161,6 +1188,18 @@ notify_orientation_cb (HdyLeaflet *self)
g_object_notify (G_OBJECT (self), "orientation");
}
+static void
+child_visible_changed_cb (HdyLeaflet *self,
+ GtkWidget *child,
+ gboolean visible)
+{
+ g_signal_emit (G_OBJECT (self),
+ signals[SIGNAL_CHILD_VISIBLE_CHANGED],
+ 0,
+ child,
+ visible);
+}
+
static void
hdy_leaflet_init (HdyLeaflet *self)
{
@@ -1185,6 +1224,7 @@ hdy_leaflet_init (HdyLeaflet *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-visible-changed", G_CALLBACK (child_visible_changed_cb), self,
G_CONNECT_SWAPPED);
/*
* HACK: GTK3 has no other way to get events on capture phase.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]