[gnome-builder/wip/chergert/glade3: 1/2] layout: add hold concept to transient sidebar for longer operations
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/glade3: 1/2] layout: add hold concept to transient sidebar for longer operations
- Date: Thu, 18 Oct 2018 03:48:27 +0000 (UTC)
commit dacfd13e2d70f0f5672d7b1b782dd8e29279ee9e
Author: Christian Hergert <chergert redhat com>
Date: Wed Oct 17 20:44:32 2018 -0700
layout: add hold concept to transient sidebar for longer operations
This allows us to keep the sidebar open for longer when we know we don't
want it to disappear.
src/libide/layout/ide-layout-transient-sidebar.c | 36 ++++++++++++++++++++++++
src/libide/layout/ide-layout-transient-sidebar.h | 4 +++
2 files changed, 40 insertions(+)
---
diff --git a/src/libide/layout/ide-layout-transient-sidebar.c
b/src/libide/layout/ide-layout-transient-sidebar.c
index 717861c6c..cfb687c4b 100644
--- a/src/libide/layout/ide-layout-transient-sidebar.c
+++ b/src/libide/layout/ide-layout-transient-sidebar.c
@@ -28,6 +28,7 @@ typedef struct
{
DzlSignalGroup *toplevel_signals;
GWeakRef view_ref;
+ gint hold_count;
} IdeLayoutTransientSidebarPrivate;
static void ide_layout_transient_sidebar_view_destroyed (IdeLayoutTransientSidebar *self,
@@ -104,6 +105,10 @@ ide_layout_transient_sidebar_after_set_focus (IdeLayoutTransientSidebar *self,
g_assert (IDE_IS_LAYOUT_TRANSIENT_SIDEBAR (self));
g_assert (!toplevel || GTK_IS_WINDOW (toplevel));
+ g_assert (priv->hold_count >= 0);
+
+ if (priv->hold_count > 0)
+ return;
/*
* If we are currently visible, then check to see if the focus has gone
@@ -272,3 +277,34 @@ ide_layout_transient_sidebar_set_panel (IdeLayoutTransientSidebar *self,
else
g_warning ("Failed to locate stack containing panel");
}
+
+void
+ide_layout_transient_sidebar_lock (IdeLayoutTransientSidebar *self)
+{
+ IdeLayoutTransientSidebarPrivate *priv = ide_layout_transient_sidebar_get_instance_private (self);
+
+ g_return_if_fail (IDE_IS_LAYOUT_TRANSIENT_SIDEBAR (self));
+ g_return_if_fail (priv->hold_count >= 0);
+
+ priv->hold_count++;
+
+ if (!dzl_dock_revealer_get_reveal_child (DZL_DOCK_REVEALER (self)))
+ dzl_dock_revealer_set_reveal_child (DZL_DOCK_REVEALER (self), TRUE);
+}
+
+void
+ide_layout_transient_sidebar_unlock (IdeLayoutTransientSidebar *self)
+{
+ IdeLayoutTransientSidebarPrivate *priv = ide_layout_transient_sidebar_get_instance_private (self);
+
+ g_return_if_fail (IDE_IS_LAYOUT_TRANSIENT_SIDEBAR (self));
+ g_return_if_fail (priv->hold_count > 0);
+
+ priv->hold_count--;
+
+ if (priv->hold_count == 0)
+ {
+ if (dzl_dock_revealer_get_reveal_child (DZL_DOCK_REVEALER (self)))
+ dzl_dock_revealer_set_reveal_child (DZL_DOCK_REVEALER (self), FALSE);
+ }
+}
diff --git a/src/libide/layout/ide-layout-transient-sidebar.h
b/src/libide/layout/ide-layout-transient-sidebar.h
index 5b61a0c1e..ffc1b7bad 100644
--- a/src/libide/layout/ide-layout-transient-sidebar.h
+++ b/src/libide/layout/ide-layout-transient-sidebar.h
@@ -51,5 +51,9 @@ void ide_layout_transient_sidebar_set_panel (IdeLayoutTransientSidebar *self,
IDE_AVAILABLE_IN_ALL
void ide_layout_transient_sidebar_set_view (IdeLayoutTransientSidebar *self,
IdeLayoutView *view);
+IDE_AVAILABLE_IN_3_32
+void ide_layout_transient_sidebar_lock (IdeLayoutTransientSidebar *self);
+IDE_AVAILABLE_IN_3_32
+void ide_layout_transient_sidebar_unlock (IdeLayoutTransientSidebar *self);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]