[libhandy/wip/exalm/leaflet-transltions: 31/31] leaflet: Add 'progress' child property
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy/wip/exalm/leaflet-transltions: 31/31] leaflet: Add 'progress' child property
- Date: Tue, 4 Aug 2020 10:17:17 +0000 (UTC)
commit 189567ef4ebb8130ca0ac12cc87e6eb6be95f65b
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Fri Jul 31 22:57:00 2020 +0500
leaflet: Add 'progress' child property
Signed-off-by: Alexander Mikhaylenko <alexm gnome org>
src/hdy-leaflet.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
---
diff --git a/src/hdy-leaflet.c b/src/hdy-leaflet.c
index 2e6e1761..e8e23945 100644
--- a/src/hdy-leaflet.c
+++ b/src/hdy-leaflet.c
@@ -87,6 +87,7 @@ enum {
CHILD_PROP_NAME,
CHILD_PROP_NAVIGATABLE,
CHILD_PROP_VISIBLE,
+ CHILD_PROP_PROGRESS,
LAST_CHILD_PROP,
};
@@ -842,6 +843,10 @@ hdy_leaflet_get_child_property (GtkContainer *container,
g_value_set_boolean (value, hdy_stackable_box_get_child_visible (HDY_GET_HELPER (container), widget));
break;
+ case CHILD_PROP_PROGRESS:
+ g_value_set_double (value, hdy_stackable_box_get_child_progress (HDY_GET_HELPER (container), widget));
+ break;
+
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
break;
@@ -1186,6 +1191,21 @@ hdy_leaflet_class_init (HdyLeafletClass *klass)
FALSE,
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY);
+ /**
+ * HdyLeaflet:progress:
+ *
+ * The child transition animation progress value. 0 means invisible, 1 means
+ * fully visible.
+ *
+ * Since: 1.0
+ */
+ child_props[CHILD_PROP_PROGRESS] =
+ g_param_spec_double ("progress",
+ _("Progress"),
+ _("The child transition animation progress value"),
+ 0.0, 1.0, 1.0,
+ 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);
@@ -1234,6 +1254,15 @@ child_notify_visible_cb (HdyLeaflet *self,
child_props[CHILD_PROP_VISIBLE]);
}
+static void
+child_notify_progress_cb (HdyLeaflet *self,
+ GtkWidget *child)
+{
+ gtk_container_child_notify_by_pspec (GTK_CONTAINER (self),
+ child,
+ child_props[CHILD_PROP_PROGRESS]);
+}
+
static void
hdy_leaflet_init (HdyLeaflet *self)
{
@@ -1260,6 +1289,7 @@ hdy_leaflet_init (HdyLeaflet *self)
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);
+ g_signal_connect_object (priv->box, "child-notify-progress", G_CALLBACK (child_notify_progress_cb), self,
G_CONNECT_SWAPPED);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]