mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
window: disable sidebar button when not available
This commit is contained in:
@ -42,6 +42,8 @@ struct _SysprofWindow
|
|||||||
|
|
||||||
SysprofDocument *document;
|
SysprofDocument *document;
|
||||||
SysprofSession *session;
|
SysprofSession *session;
|
||||||
|
|
||||||
|
GtkToggleButton *show_right_sidebar;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -138,11 +140,17 @@ main_view_notify_sidebar (SysprofWindow *self,
|
|||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
AdwOverlaySplitView *main_view)
|
AdwOverlaySplitView *main_view)
|
||||||
{
|
{
|
||||||
|
GtkWidget *sidebar;
|
||||||
|
|
||||||
g_assert (SYSPROF_IS_WINDOW (self));
|
g_assert (SYSPROF_IS_WINDOW (self));
|
||||||
g_assert (ADW_IS_OVERLAY_SPLIT_VIEW (main_view));
|
g_assert (ADW_IS_OVERLAY_SPLIT_VIEW (main_view));
|
||||||
|
|
||||||
if (adw_overlay_split_view_get_sidebar (main_view) == NULL)
|
sidebar = adw_overlay_split_view_get_sidebar (main_view);
|
||||||
|
|
||||||
|
if (sidebar == NULL)
|
||||||
adw_overlay_split_view_set_show_sidebar (main_view, FALSE);
|
adw_overlay_split_view_set_show_sidebar (main_view, FALSE);
|
||||||
|
|
||||||
|
gtk_widget_set_sensitive (GTK_WIDGET (self->show_right_sidebar), sidebar != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -224,6 +232,7 @@ sysprof_window_class_init (SysprofWindowClass *klass)
|
|||||||
|
|
||||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/sysprof-window.ui");
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/sysprof-window.ui");
|
||||||
|
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, show_right_sidebar);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, main_view_notify_sidebar);
|
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.open-capture", NULL, sysprof_window_open_capture_action);
|
||||||
|
|||||||
Reference in New Issue
Block a user