sysprof: hide utility when there is no sidebar widget

This commit is contained in:
Christian Hergert
2023-07-12 15:53:38 -07:00
parent ea8befb624
commit f3418c42e9
2 changed files with 15 additions and 0 deletions

View File

@ -114,6 +114,18 @@ sysprof_window_set_document (SysprofWindow *self,
}
}
static void
main_view_notify_sidebar (SysprofWindow *self,
GParamSpec *pspec,
AdwOverlaySplitView *main_view)
{
g_assert (SYSPROF_IS_WINDOW (self));
g_assert (ADW_IS_OVERLAY_SPLIT_VIEW (main_view));
if (adw_overlay_split_view_get_sidebar (main_view) == NULL)
adw_overlay_split_view_set_show_sidebar (main_view, FALSE);
}
static void
sysprof_window_dispose (GObject *object)
{
@ -193,6 +205,8 @@ sysprof_window_class_init (SysprofWindowClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/sysprof-window.ui");
gtk_widget_class_bind_template_callback (widget_class, main_view_notify_sidebar);
gtk_widget_class_install_action (widget_class, "win.open-capture", NULL, sysprof_window_open_capture_action);
gtk_widget_class_install_action (widget_class, "win.record-capture", NULL, sysprof_window_record_capture_action);

View File

@ -62,6 +62,7 @@
<property name="sidebar-position">end</property>
<property name="show-sidebar" bind-source="show_right_sidebar" bind-property="active" bind-flags="bidirectional|sync-create"/>
<property name="max-sidebar-width">200</property>
<signal name="notify::sidebar" handler="main_view_notify_sidebar" swapped="true"/>
<property name="content">
<object class="AdwToolbarView">
<child type="top">