[libhandy/wip/haecker-felix/flap-widget: 134/138] WIP: Implement lock logic




commit 080b49b3759167ccd84380cf1eae1e1e1869c74d
Author: Felix Häcker <haeckerfelix gnome org>
Date:   Sat Aug 1 20:35:58 2020 +0200

    WIP: Implement lock logic

 src/hdy-flap.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/hdy-flap.c b/src/hdy-flap.c
index 64cdb272..7ffd9885 100644
--- a/src/hdy-flap.c
+++ b/src/hdy-flap.c
@@ -293,6 +293,10 @@ set_folded (HdyFlap  *self,
   self->folded = folded;
   animate_overlay(self);
 
+  if (!self->locked)
+    hdy_flap_set_reveal_flap(self, !self->folded);
+
+
   g_object_notify_by_pspec (G_OBJECT (self), props[PROP_FOLDED]);
 }
 
@@ -449,9 +453,14 @@ allocate_content (HdyFlap       *self,
 
   if (self->orientation == GTK_ORIENTATION_HORIZONTAL){
       int min = content_min.width + flap_min.width;
-      if (self->flap_fold_policy == HDY_FLAP_FOLD_POLICY_AUTO)
+      if (self->flap_fold_policy == HDY_FLAP_FOLD_POLICY_AUTO){
         set_folded (self, widget_alloc->width <= min);
 
+        if (!self->locked)
+          hdy_flap_set_reveal_flap(self, !self->folded);
+      }
+
+
       if (self->flap_position == adjust_for_text_direction (self, GTK_PACK_START)){
           content_x = widget_alloc->x + adjust_for_overlay (self, get_flap_size(self, widget_alloc, 
GTK_ORIENTATION_HORIZONTAL));
           content_y = widget_alloc->y;
@@ -618,7 +627,7 @@ hdy_flap_class_init (HdyFlapClass *klass)
                          _("Flap Fold Policy"),
                          _("Flap Fold Policy"),
                          HDY_TYPE_FLAP_FOLD_POLICY,
-                         HDY_FLAP_FOLD_POLICY_NEVER,
+                         HDY_FLAP_FOLD_POLICY_AUTO,
                          G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
 
   /**
@@ -711,7 +720,7 @@ hdy_flap_init (HdyFlap *self)
 {
   self->orientation = GTK_ORIENTATION_HORIZONTAL;
   self->flap_position = GTK_PACK_START;
-  self->flap_fold_policy = HDY_FLAP_FOLD_POLICY_NEVER;
+  self->flap_fold_policy = HDY_FLAP_FOLD_POLICY_AUTO;
   self->reveal_flap = TRUE;
   self->locked = FALSE;
   self->reveal_progress = 1;
@@ -932,7 +941,6 @@ hdy_flap_set_locked (HdyFlap  *self,
     return;
 
   self->locked = locked;
-  animate_reveal(self);
 
   g_object_notify_by_pspec (G_OBJECT (self), props[PROP_LOCKED]);
 }


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