mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
sysprof: clear sidebar on dispose
This commit is contained in:
@ -44,6 +44,9 @@ struct _SysprofWindow
|
||||
|
||||
GtkToggleButton *show_right_sidebar;
|
||||
GtkWidget *left_split_overlay;
|
||||
GtkWidget *right_split_overlay;
|
||||
|
||||
guint disposed : 1;
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -168,6 +171,9 @@ main_view_notify_sidebar (SysprofWindow *self,
|
||||
g_assert (SYSPROF_IS_WINDOW (self));
|
||||
g_assert (ADW_IS_OVERLAY_SPLIT_VIEW (main_view));
|
||||
|
||||
if (self->disposed)
|
||||
return;
|
||||
|
||||
sidebar = adw_overlay_split_view_get_sidebar (main_view);
|
||||
|
||||
if (sidebar == NULL)
|
||||
@ -300,6 +306,11 @@ sysprof_window_dispose (GObject *object)
|
||||
{
|
||||
SysprofWindow *self = (SysprofWindow *)object;
|
||||
|
||||
self->disposed = TRUE;
|
||||
|
||||
if (self->right_split_overlay)
|
||||
adw_overlay_split_view_set_sidebar (ADW_OVERLAY_SPLIT_VIEW (self->right_split_overlay), NULL);
|
||||
|
||||
gtk_widget_dispose_template (GTK_WIDGET (self), SYSPROF_TYPE_WINDOW);
|
||||
|
||||
g_clear_object (&self->document);
|
||||
@ -376,6 +387,7 @@ sysprof_window_class_init (SysprofWindowClass *klass)
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, show_right_sidebar);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, left_split_overlay);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, right_split_overlay);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, main_view_notify_sidebar);
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
<property name="content">
|
||||
<object class="AdwNavigationPage">
|
||||
<property name="child">
|
||||
<object class="AdwOverlaySplitView">
|
||||
<object class="AdwOverlaySplitView" id="right_split_overlay">
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user