From 1085fbb6c520ca3f2f4ed1e44112101bd68359f9 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 1 Oct 2021 13:27:18 -0700 Subject: [PATCH] tab: don't inherit from GtkBox We need center box anyway, which does not expose the class. --- src/libsysprof-ui/sysprof-tab.c | 8 +++- src/libsysprof-ui/sysprof-tab.h | 2 +- src/libsysprof-ui/sysprof-tab.ui | 75 +++++++++++--------------------- 3 files changed, 32 insertions(+), 53 deletions(-) diff --git a/src/libsysprof-ui/sysprof-tab.c b/src/libsysprof-ui/sysprof-tab.c index fa76ef8f..8554cc71 100644 --- a/src/libsysprof-ui/sysprof-tab.c +++ b/src/libsysprof-ui/sysprof-tab.c @@ -28,8 +28,9 @@ struct _SysprofTab { - GtkBox parent_instance; + GtkWidget parent_instance; + GtkWidget *center_box; GtkButton *close_button; GtkLabel *title; GtkImage *recording; @@ -37,7 +38,7 @@ struct _SysprofTab SysprofDisplay *display; }; -G_DEFINE_TYPE (SysprofTab, sysprof_tab, GTK_TYPE_BOX) +G_DEFINE_TYPE (SysprofTab, sysprof_tab, GTK_TYPE_WIDGET) enum { PROP_0, @@ -71,6 +72,7 @@ sysprof_tab_dispose (GObject *object) { SysprofTab *self = (SysprofTab *)object; + g_clear_pointer (&self->center_box, gtk_widget_unparent); g_clear_weak_pointer (&self->display); G_OBJECT_CLASS (sysprof_tab_parent_class)->dispose (object); @@ -127,6 +129,8 @@ sysprof_tab_class_init (SysprofTabClass *klass) object_class->set_property = sysprof_tab_set_property; gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-tab.ui"); + gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT); + gtk_widget_class_bind_template_child (widget_class, SysprofTab, center_box); gtk_widget_class_bind_template_child (widget_class, SysprofTab, close_button); gtk_widget_class_bind_template_child (widget_class, SysprofTab, recording); gtk_widget_class_bind_template_child (widget_class, SysprofTab, title); diff --git a/src/libsysprof-ui/sysprof-tab.h b/src/libsysprof-ui/sysprof-tab.h index 1762244e..5aff386b 100644 --- a/src/libsysprof-ui/sysprof-tab.h +++ b/src/libsysprof-ui/sysprof-tab.h @@ -28,7 +28,7 @@ G_BEGIN_DECLS #define SYSPROF_TYPE_TAB (sysprof_tab_get_type()) -G_DECLARE_FINAL_TYPE (SysprofTab, sysprof_tab, SYSPROF, TAB, GtkBox) +G_DECLARE_FINAL_TYPE (SysprofTab, sysprof_tab, SYSPROF, TAB, GtkWidget) GtkWidget *sysprof_tab_new (SysprofDisplay *display); diff --git a/src/libsysprof-ui/sysprof-tab.ui b/src/libsysprof-ui/sysprof-tab.ui index 883cd25c..c07d5cf8 100644 --- a/src/libsysprof-ui/sysprof-tab.ui +++ b/src/libsysprof-ui/sysprof-tab.ui @@ -1,60 +1,35 @@ - - -