[sysprof/wip/gtk4-port: 94/125] tab: don't inherit from GtkBox
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/gtk4-port: 94/125] tab: don't inherit from GtkBox
- Date: Fri, 29 Oct 2021 02:02:34 +0000 (UTC)
commit 67d5df62ed3fbc9942ff8b91ec484f56c8407882
Author: Christian Hergert <chergert redhat com>
Date: Fri Oct 1 13:27:18 2021 -0700
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 | 73 +++++++++++++---------------------------
3 files changed, 31 insertions(+), 52 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 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.0 -->
<interface>
- <requires lib="gtk+" version="3.0"/>
- <template class="SysprofTab" parent="GtkBox">
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
+ <template class="SysprofTab" parent="GtkWidget">
+ <property name="hexpand">true</property>
<property name="spacing">6</property>
<child>
- <object class="GtkImage" id="recording">
- <property name="visible">false</property>
- <property name="icon-name">media-record-symbolic</property>
- <property name="pixel-size">16</property>
- <property name="hexpand">true</property>
- <property name="halign">end</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- <property name="pack-type">start</property>
- </packing>
- </child>
- <child type="center">
- <object class="GtkLabel" id="title">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="close_button">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="receives_default">False</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkCenterBox" id="center_box">
+ <child type="start">
+ <object class="GtkImage" id="recording">
+ <property name="visible">false</property>
+ <property name="icon-name">media-record-symbolic</property>
+ <property name="pixel-size">16</property>
+ <property name="hexpand">true</property>
+ <property name="halign">end</property>
+ </object>
+ </child>
+ <child type="center">
+ <object class="GtkLabel" id="title">
+ </object>
+ </child>
+ <child type="end">
+ <object class="GtkButton" id="close_button">
+ <property name="receives_default">False</property>
<property name="icon_name">window-close-symbolic</property>
+ <style>
+ <class name="flat"/>
+ <class name="small-button"/>
+ <class name="image-button"/>
+ </style>
</object>
</child>
- <style>
- <class name="flat"/>
- <class name="small-button"/>
- </style>
</object>
- <packing>
- <property name="pack-type">end</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</template>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]