[libhandy] header-group: Add the update-decoration-layouts signal



commit 9c0922cdcd43b35d4cc97c83891865f5f7a2d2a0
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue Jul 7 14:18:10 2020 +0200

    header-group: Add the update-decoration-layouts signal
    
    Add the update-decoration-layouts signal and emits it when the
    decoration layout will be updated. This will be used to let nested
    header groups warn the parent it should update its decoration layout,
    e.g. following a mapping event.

 src/hdy-header-group.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
---
diff --git a/src/hdy-header-group.c b/src/hdy-header-group.c
index f2bac5e2..4105073d 100644
--- a/src/hdy-header-group.c
+++ b/src/hdy-header-group.c
@@ -29,6 +29,13 @@ struct _HdyHeaderGroupChild
   GObject *object;
 };
 
+enum {
+  SIGNAL_UPDATE_DECORATION_LAYOUTS,
+  SIGNAL_LAST_SIGNAL,
+};
+
+static guint signals[SIGNAL_LAST_SIGNAL];
+
 G_DEFINE_TYPE (HdyHeaderGroupChild, hdy_header_group_child, G_TYPE_OBJECT)
 
 struct _HdyHeaderGroup
@@ -89,6 +96,8 @@ forward_update_decoration_layouts (HdyHeaderGroupChild *self)
 
   g_assert (HDY_IS_HEADER_GROUP (header_group));
 
+  g_signal_emit (header_group, signals[SIGNAL_UPDATE_DECORATION_LAYOUTS], 0);
+
   update_decoration_layouts (header_group);
 }
 
@@ -710,6 +719,23 @@ hdy_header_group_class_init (HdyHeaderGroupClass *klass)
                           G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
 
   g_object_class_install_properties (object_class, N_PROPS, props);
+
+  /**
+   * HdyHeaderGroup::update-decoration-layouts:
+   * @self: The #HdyHeaderGroup instance
+   *
+   * This signal is emitted before updating the decoration layouts.
+   *
+   * Since: 1.0
+   */
+  signals[SIGNAL_UPDATE_DECORATION_LAYOUTS] =
+    g_signal_new ("update-decoration-layouts",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  0,
+                  NULL, NULL, NULL,
+                  G_TYPE_NONE,
+                  0);
 }
 
 static void


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