[sysprof/wip/gtk4-port] libsysprof-ui: more GTK 4 porting changes
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/gtk4-port] libsysprof-ui: more GTK 4 porting changes
- Date: Fri, 1 Oct 2021 20:05:10 +0000 (UTC)
commit 6388a4017c984a52f1a3dfba25dcb615cc2c0b4c
Author: Christian Hergert <chergert redhat com>
Date: Fri Oct 1 13:05:05 2021 -0700
libsysprof-ui: more GTK 4 porting changes
src/libsysprof-ui/egg-three-grid.c | 24 +++-
src/libsysprof-ui/sysprof-marks-page.c | 8 +-
src/libsysprof-ui/sysprof-marks-page.ui | 146 ++++++++++++---------
src/libsysprof-ui/sysprof-scrollmap.c | 8 ++
src/libsysprof-ui/sysprof-scrollmap.h | 15 ++-
.../sysprof-visualizer-group-header.c | 3 +-
src/libsysprof-ui/sysprof-visualizers-frame.c | 2 +-
7 files changed, 132 insertions(+), 74 deletions(-)
---
diff --git a/src/libsysprof-ui/egg-three-grid.c b/src/libsysprof-ui/egg-three-grid.c
index 455e3c06..20e5165a 100644
--- a/src/libsysprof-ui/egg-three-grid.c
+++ b/src/libsysprof-ui/egg-three-grid.c
@@ -53,7 +53,11 @@ typedef struct
int nat_below_baseline;
} EggThreeGridRowInfo;
-G_DEFINE_TYPE_WITH_PRIVATE (EggThreeGrid, egg_three_grid, GTK_TYPE_WIDGET)
+static void buildable_iface_init (GtkBuildableIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (EggThreeGrid, egg_three_grid, GTK_TYPE_WIDGET,
+ G_ADD_PRIVATE (EggThreeGrid)
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, buildable_iface_init))
enum {
PROP_0,
@@ -695,3 +699,21 @@ egg_three_grid_column_get_type (void)
return type_id;
}
+
+static void
+egg_three_grid_add_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ GObject *child,
+ const char *type)
+{
+ if (GTK_IS_WIDGET (child))
+ egg_three_grid_add (EGG_THREE_GRID (buildable), GTK_WIDGET (child), 0, EGG_THREE_GRID_COLUMN_LEFT);
+ else
+ g_warning ("%s cannot be added to %s", G_OBJECT_TYPE_NAME (child), G_OBJECT_TYPE_NAME (buildable));
+}
+
+static void
+buildable_iface_init (GtkBuildableIface *iface)
+{
+ iface->add_child = egg_three_grid_add_child;
+}
diff --git a/src/libsysprof-ui/sysprof-marks-page.c b/src/libsysprof-ui/sysprof-marks-page.c
index 3b7a7d35..c08381b9 100644
--- a/src/libsysprof-ui/sysprof-marks-page.c
+++ b/src/libsysprof-ui/sysprof-marks-page.c
@@ -50,6 +50,8 @@ typedef struct
GtkLabel *end;
GtkLabel *duration;
GtkTextView *message;
+ GtkWidget *failed;
+ GtkWidget *marks;
} SysprofMarksPagePrivate;
enum {
@@ -310,9 +312,9 @@ sysprof_marks_page_load_cb (GObject *object,
gtk_tree_view_set_model (priv->tree_view, GTK_TREE_MODEL (model));
if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL) == 0)
- gtk_stack_set_visible_child_name (priv->stack, "empty-state");
+ gtk_stack_set_visible_child (priv->stack, GTK_WIDGET (priv->failed));
else
- gtk_stack_set_visible_child_name (priv->stack, "marks");
+ gtk_stack_set_visible_child (priv->stack, GTK_WIDGET (priv->marks));
g_task_return_boolean (task, TRUE);
}
@@ -517,6 +519,8 @@ sysprof_marks_page_class_init (SysprofMarksPageClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksPage, duration);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksPage, time);
gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksPage, message);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksPage, marks);
+ gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksPage, failed);
properties [PROP_KIND] =
g_param_spec_enum ("kind", NULL, NULL,
diff --git a/src/libsysprof-ui/sysprof-marks-page.ui b/src/libsysprof-ui/sysprof-marks-page.ui
index 0697c835..e7f92c8d 100644
--- a/src/libsysprof-ui/sysprof-marks-page.ui
+++ b/src/libsysprof-ui/sysprof-marks-page.ui
@@ -3,10 +3,11 @@
<template class="SysprofMarksPage" parent="SysprofPage">
<child>
<object class="GtkStack" id="stack">
- <property name="homogeneous">false</property>
+ <property name="hhomogeneous">false</property>
+ <property name="vhomogeneous">false</property>
<property name="visible">true</property>
<child>
- <object class="GtkBox">
+ <object class="GtkBox" id="marks">
<property name="orientation">horizontal</property>
<property name="visible">true</property>
<child>
@@ -44,11 +45,11 @@
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="row">0</property>
+ <property name="column">0</property>
+ </layout>
</object>
- <packing>
- <property name="top-attach">0</property>
- <property name="left-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
@@ -59,11 +60,11 @@
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="row">1</property>
+ <property name="column">0</property>
+ </layout>
</object>
- <packing>
- <property name="top-attach">1</property>
- <property name="left-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
@@ -73,11 +74,11 @@
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="row">2</property>
+ <property name="column">0</property>
+ </layout>
</object>
- <packing>
- <property name="top-attach">2</property>
- <property name="left-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
@@ -87,11 +88,11 @@
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="row">3</property>
+ <property name="column">0</property>
+ </layout>
</object>
- <packing>
- <property name="top-attach">3</property>
- <property name="left-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
@@ -101,11 +102,11 @@
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="row">4</property>
+ <property name="column">0</property>
+ </layout>
</object>
- <packing>
- <property name="top-attach">4</property>
- <property name="left-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
@@ -116,22 +117,22 @@
<style>
<class name="dim-label"/>
</style>
+ <layout>
+ <property name="row">5</property>
+ <property name="column">0</property>
+ </layout>
</object>
- <packing>
- <property name="top-attach">5</property>
- <property name="left-attach">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="group">
<property name="visible">true</property>
<property name="xalign">0</property>
<property name="wrap">true</property>
+ <layout>
+ <property name="row">0</property>
+ <property name="column">1</property>
+ </layout>
</object>
- <packing>
- <property name="top-attach">0</property>
- <property name="left-attach">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="mark">
@@ -139,46 +140,45 @@
<property name="xalign">0</property>
<property name="max-width-chars">5</property>
<property name="ellipsize">end</property>
+ <layout>
+ <property name="row">1</property>
+ <property name="column">1</property>
+ </layout>
</object>
- <packing>
- <property name="top-attach">1</property>
- <property name="left-attach">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="time">
<property name="visible">true</property>
<property name="xalign">0</property>
+ <layout>
+ <property name="row">2</property>
+ <property name="column">1</property>
+ </layout>
</object>
- <packing>
- <property name="top-attach">2</property>
- <property name="left-attach">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="end">
<property name="visible">true</property>
<property name="xalign">0</property>
+ <layout>
+ <property name="row">3</property>
+ <property name="column">1</property>
+ </layout>
</object>
- <packing>
- <property name="top-attach">3</property>
- <property name="left-attach">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="duration">
<property name="visible">true</property>
<property name="xalign">0</property>
+ <layout>
+ <property name="row">4</property>
+ <property name="column">1</property>
+ </layout>
</object>
- <packing>
- <property name="top-attach">4</property>
- <property name="left-attach">1</property>
- </packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="hexpand">true</property>
- <property name="shadow-type">in</property>
<property name="visible">true</property>
<child>
<object class="GtkTextView" id="message">
@@ -186,11 +186,11 @@
<property name="visible">true</property>
</object>
</child>
+ <layout>
+ <property name="row">5</property>
+ <property name="column">1</property>
+ </layout>
</object>
- <packing>
- <property name="top-attach">5</property>
- <property name="left-attach">1</property>
- </packing>
</child>
</object>
</child>
@@ -238,20 +238,44 @@
</object>
</child>
</object>
- <packing>
- <property name="name">marks</property>
- </packing>
</child>
<child>
- <object class="DzlEmptyState">
- <property name="icon-name">computer-fail-symbolic</property>
- <property name="title" translatable="yes">No Timings Available</property>
- <property name="subtitle" translatable="yes">No timing data was found for the current
selection</property>
+ <object class="GtkBox" id="failed">
+ <property name="halign">center</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <property name="valign">center</property>
<property name="visible">true</property>
+ <child>
+ <object class="GtkImage">
+ <property name="icon-name">computer-fail-symbolic</property>
+ <property name="pixel-size">128</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="title">
+ <property name="label" translatable="yes">No Timings Available</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ <attributes>
+ <attribute name="scale" value="2.0"/>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="subtitle">
+ <property name="label" translatable="yes">No timing data was found for the current
selection</property>
+ <property name="use-markup">true</property>
+ <property name="wrap">true</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ </child>
</object>
- <packing>
- <property name="name">empty-state</property>
- </packing>
</child>
</object>
</child>
diff --git a/src/libsysprof-ui/sysprof-scrollmap.c b/src/libsysprof-ui/sysprof-scrollmap.c
index 05e7b9bd..e21683bc 100644
--- a/src/libsysprof-ui/sysprof-scrollmap.c
+++ b/src/libsysprof-ui/sysprof-scrollmap.c
@@ -318,3 +318,11 @@ sysprof_scrollmap_set_adjustment (SysprofScrollmap *self,
gtk_scrollbar_set_adjustment (GTK_SCROLLBAR (self->scrollbar), adjustment);
}
+
+GtkAdjustment *
+sysprof_scrollmap_get_adjustment (SysprofScrollmap *self)
+{
+ g_return_val_if_fail (SYSPROF_IS_SCROLLMAP (self), NULL);
+
+ return gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (self->scrollbar));
+}
diff --git a/src/libsysprof-ui/sysprof-scrollmap.h b/src/libsysprof-ui/sysprof-scrollmap.h
index 14371d9d..2fbe1721 100644
--- a/src/libsysprof-ui/sysprof-scrollmap.h
+++ b/src/libsysprof-ui/sysprof-scrollmap.h
@@ -28,12 +28,13 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (SysprofScrollmap, sysprof_scrollmap, SYSPROF, SCROLLMAP, GtkWidget)
-void sysprof_scrollmap_set_adjustment (SysprofScrollmap *self,
- GtkAdjustment *adjustment);
-void sysprof_scrollmap_set_timings (SysprofScrollmap *self,
- GArray *timings);
-void sysprof_scrollmap_set_time_range (SysprofScrollmap *self,
- gint64 begin_time,
- gint64 end_time);
+GtkAdjustment *sysprof_scrollmap_get_adjustment (SysprofScrollmap *self);
+void sysprof_scrollmap_set_adjustment (SysprofScrollmap *self,
+ GtkAdjustment *adjustment);
+void sysprof_scrollmap_set_timings (SysprofScrollmap *self,
+ GArray *timings);
+void sysprof_scrollmap_set_time_range (SysprofScrollmap *self,
+ gint64 begin_time,
+ gint64 end_time);
G_END_DECLS
diff --git a/src/libsysprof-ui/sysprof-visualizer-group-header.c
b/src/libsysprof-ui/sysprof-visualizer-group-header.c
index 84957b89..b870a82f 100644
--- a/src/libsysprof-ui/sysprof-visualizer-group-header.c
+++ b/src/libsysprof-ui/sysprof-visualizer-group-header.c
@@ -151,12 +151,11 @@ _sysprof_visualizer_group_header_add_row (SysprofVisualizerGroupHeader *self,
"icon-name", "view-more-symbolic",
"visible", TRUE,
NULL),
- "margin-right", 6,
+ "margin-end", 6,
"direction", GTK_ARROW_RIGHT,
"halign", GTK_ALIGN_CENTER,
"menu-model", menu,
"tooltip-text", _("Display supplemental graphs"),
- "use-popover", FALSE,
"valign", GTK_ALIGN_CENTER,
"visible", TRUE,
NULL);
diff --git a/src/libsysprof-ui/sysprof-visualizers-frame.c b/src/libsysprof-ui/sysprof-visualizers-frame.c
index 2f0fef1b..5e9740d3 100644
--- a/src/libsysprof-ui/sysprof-visualizers-frame.c
+++ b/src/libsysprof-ui/sysprof-visualizers-frame.c
@@ -706,7 +706,7 @@ sysprof_visualizers_frame_get_hadjustment (SysprofVisualizersFrame *self)
{
g_return_val_if_fail (SYSPROF_IS_VISUALIZERS_FRAME (self), NULL);
- return gtk_range_get_adjustment (GTK_RANGE (self->hscrollbar));
+ return sysprof_scrollmap_get_adjustment (self->hscrollbar);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]