[gnome-text-editor] window: handle flap dismissal via modal click



commit d873fe3d33c4aae69933aabb4dbf0bb26649ea04
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 7 16:02:57 2021 -0700

    window: handle flap dismissal via modal click

 src/editor-window-actions.c |  1 -
 src/editor-window.c         | 13 +++++++++++++
 src/editor-window.ui        |  1 +
 3 files changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/src/editor-window-actions.c b/src/editor-window-actions.c
index 1057e79..8185bb3 100644
--- a/src/editor-window-actions.c
+++ b/src/editor-window-actions.c
@@ -537,7 +537,6 @@ editor_window_actions_hide_preferences_cb (GtkWidget  *widget,
   g_assert (EDITOR_IS_WINDOW (self));
 
   adw_flap_set_reveal_flap (self->flap, FALSE);
-  adw_flap_set_locked (self->flap, TRUE);
 }
 
 void
diff --git a/src/editor-window.c b/src/editor-window.c
index d1c7f25..1cb5f32 100644
--- a/src/editor-window.c
+++ b/src/editor-window.c
@@ -435,6 +435,18 @@ _editor_window_request_close_page (EditorWindow *self,
   return TRUE;
 }
 
+static void
+on_notify_reveal_flap_cb (EditorWindow *self,
+                          GParamSpec   *pspec,
+                          AdwFlap      *flap)
+{
+  g_assert (EDITOR_IS_WINDOW (self));
+  g_assert (ADW_IS_FLAP (flap));
+
+  if (!adw_flap_get_reveal_flap (flap))
+    adw_flap_set_locked (flap, TRUE);
+}
+
 static void
 editor_window_dispose (GObject *object)
 {
@@ -549,6 +561,7 @@ editor_window_class_init (EditorWindowClass *klass)
   gtk_widget_class_bind_template_child (widget_class, EditorWindow, title);
 
   gtk_widget_class_bind_template_callback (widget_class, on_tab_view_close_page_cb);
+  gtk_widget_class_bind_template_callback (widget_class, on_notify_reveal_flap_cb);
 
   gtk_widget_class_add_binding_action (widget_class, GDK_KEY_w, GDK_CONTROL_MASK, 
"win.close-page-or-window", NULL);
   gtk_widget_class_add_binding_action (widget_class, GDK_KEY_o, GDK_CONTROL_MASK, "win.open", NULL);
diff --git a/src/editor-window.ui b/src/editor-window.ui
index 8727e28..bbbc840 100644
--- a/src/editor-window.ui
+++ b/src/editor-window.ui
@@ -125,6 +125,7 @@
             <property name="transition-type">over</property>
             <property name="reveal-flap">false</property>
             <property name="locked">true</property>
+            <signal name="notify::reveal-flap" handler="on_notify_reveal_flap_cb" swapped="true"/>
             <child type="separator">
               <object class="GtkSeparator">
                 <property name="orientation">vertical</property>


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