From 2888ae2ad8b34942bb33ae916511df761159e7f5 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 28 Sep 2021 12:47:58 -0700 Subject: [PATCH 001/127] visualizergroup: remove dazzle usage --- src/libsysprof-ui/sysprof-visualizer-group.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libsysprof-ui/sysprof-visualizer-group.c b/src/libsysprof-ui/sysprof-visualizer-group.c index 56f7f630..fb10da9a 100644 --- a/src/libsysprof-ui/sysprof-visualizer-group.c +++ b/src/libsysprof-ui/sysprof-visualizer-group.c @@ -22,7 +22,6 @@ #include "config.h" -#include #include #include "sysprof-visualizer.h" @@ -186,7 +185,7 @@ sysprof_visualizer_group_finalize (GObject *object) g_clear_object (&priv->rows_menu); g_clear_object (&priv->actions); - dzl_clear_weak_pointer (&priv->header); + g_clear_weak_pointer (&priv->header); G_OBJECT_CLASS (sysprof_visualizer_group_parent_class)->finalize (object); } @@ -343,7 +342,7 @@ _sysprof_visualizer_group_set_header (SysprofVisualizerGroup *self, g_return_if_fail (SYSPROF_IS_VISUALIZER_GROUP (self)); g_return_if_fail (!header || SYSPROF_IS_VISUALIZER_GROUP_HEADER (header)); - if (dzl_set_weak_pointer (&priv->header, header)) + if (g_set_weak_pointer (&priv->header, header)) { if (header != NULL) { From f56c36b054dc3ee1948edc193623bc67c0c1203b Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 28 Sep 2021 13:00:08 -0700 Subject: [PATCH 002/127] callgraphpage: remove dazzle for shortcuts We can do this manually with a key controller. In the future, we will do this with GTK 4's shortcut controller. --- src/libsysprof-ui/sysprof-callgraph-page.c | 39 ++++++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/src/libsysprof-ui/sysprof-callgraph-page.c b/src/libsysprof-ui/sysprof-callgraph-page.c index 354cdf1c..6db7e850 100644 --- a/src/libsysprof-ui/sysprof-callgraph-page.c +++ b/src/libsysprof-ui/sysprof-callgraph-page.c @@ -39,7 +39,6 @@ #include "config.h" -#include #include #include "../stackstash.h" @@ -769,6 +768,25 @@ sysprof_callgraph_page_copy_cb (GtkWidget *widget, copy_tree_view_selection (priv->functions_view); } +static gboolean +on_key_pressed_cb (SysprofCallgraphPage *self, + guint keyval, + guint keycode, + GdkModifierType state, + GtkEventControllerKey *controller) +{ + g_assert (SYSPROF_IS_CALLGRAPH_PAGE (self)); + g_assert (GTK_IS_EVENT_CONTROLLER_KEY (controller)); + + if ((state & GDK_CONTROL_MASK) != 0 && keyval == GDK_KEY_c) + { + sysprof_callgraph_page_copy_cb (GTK_WIDGET (self), self); + return GDK_EVENT_STOP; + } + + return GDK_EVENT_PROPAGATE; +} + static void sysprof_callgraph_page_generate_cb (GObject *object, GAsyncResult *result, @@ -937,7 +955,7 @@ static void sysprof_callgraph_page_init (SysprofCallgraphPage *self) { SysprofCallgraphPagePrivate *priv = sysprof_callgraph_page_get_instance_private (self); - DzlShortcutController *controller; + GtkEventController *controller; GtkTreeSelection *selection; GtkCellRenderer *cell; @@ -992,15 +1010,14 @@ sysprof_callgraph_page_init (SysprofCallgraphPage *self) gtk_tree_selection_set_mode (gtk_tree_view_get_selection (priv->descendants_view), GTK_SELECTION_MULTIPLE); - controller = dzl_shortcut_controller_find (GTK_WIDGET (self)); - - dzl_shortcut_controller_add_command_callback (controller, - "org.gnome.sysprof3.capture.copy", - "c", - DZL_SHORTCUT_PHASE_BUBBLE, - (GtkCallback) sysprof_callgraph_page_copy_cb, - self, - NULL); + controller = gtk_event_controller_key_new (GTK_WIDGET (self)); + gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_BUBBLE); + g_signal_connect_object (controller, + "key-pressed", + G_CALLBACK (on_key_pressed_cb), + self, + G_CONNECT_SWAPPED); + g_object_unref (controller); } typedef struct _Descendant Descendant; From 94d7e902065a93331036109b896823ed5a02d773 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 28 Sep 2021 13:00:50 -0700 Subject: [PATCH 003/127] display: use GtkPaned We don't need MultiPaned here (other than it works nicer than GtkPaned). We can move to PanelMultiPaned in the future if we need it. --- src/libsysprof-ui/sysprof-display.c | 2 -- src/libsysprof-ui/sysprof-display.ui | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libsysprof-ui/sysprof-display.c b/src/libsysprof-ui/sysprof-display.c index b2ba2bc5..bc968bdb 100644 --- a/src/libsysprof-ui/sysprof-display.c +++ b/src/libsysprof-ui/sysprof-display.c @@ -22,7 +22,6 @@ #include "config.h" -#include #include #include "sysprof-details-page.h" @@ -499,7 +498,6 @@ sysprof_display_class_init (SysprofDisplayClass *klass) g_object_class_install_properties (object_class, N_PROPS, properties); - g_type_ensure (DZL_TYPE_MULTI_PANED); g_type_ensure (SYSPROF_TYPE_DETAILS_PAGE); g_type_ensure (SYSPROF_TYPE_FAILED_STATE_VIEW); g_type_ensure (SYSPROF_TYPE_PROFILER_ASSISTANT); diff --git a/src/libsysprof-ui/sysprof-display.ui b/src/libsysprof-ui/sysprof-display.ui index 13f80ced..8ab984c6 100644 --- a/src/libsysprof-ui/sysprof-display.ui +++ b/src/libsysprof-ui/sysprof-display.ui @@ -14,7 +14,7 @@ - + vertical true From fb167457239a7f0c9266afcea352938294185efb Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 28 Sep 2021 13:01:24 -0700 Subject: [PATCH 004/127] visualizer: remove DzlBin usage We can just use GtkBin for now, and in GTK 4 we'll switch to using GtkWidget as the parent type. But this helps us progress on de-dazzling. --- src/libsysprof-ui/sysprof-visualizer.c | 2 +- src/libsysprof-ui/sysprof-visualizer.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libsysprof-ui/sysprof-visualizer.c b/src/libsysprof-ui/sysprof-visualizer.c index eae12774..1f9bdd23 100644 --- a/src/libsysprof-ui/sysprof-visualizer.c +++ b/src/libsysprof-ui/sysprof-visualizer.c @@ -38,7 +38,7 @@ typedef struct GtkAllocation cache_alloc; } SysprofVisualizerPrivate; -G_DEFINE_TYPE_WITH_PRIVATE (SysprofVisualizer, sysprof_visualizer, DZL_TYPE_BIN) +G_DEFINE_TYPE_WITH_PRIVATE (SysprofVisualizer, sysprof_visualizer, GTK_TYPE_BIN) enum { PROP_0, diff --git a/src/libsysprof-ui/sysprof-visualizer.h b/src/libsysprof-ui/sysprof-visualizer.h index 38b94d42..133fd420 100644 --- a/src/libsysprof-ui/sysprof-visualizer.h +++ b/src/libsysprof-ui/sysprof-visualizer.h @@ -24,7 +24,7 @@ # error "Only can be included directly." #endif -#include +#include #include G_BEGIN_DECLS @@ -44,11 +44,11 @@ typedef struct #define SYSPROF_TYPE_VISUALIZER (sysprof_visualizer_get_type()) SYSPROF_AVAILABLE_IN_ALL -G_DECLARE_DERIVABLE_TYPE (SysprofVisualizer, sysprof_visualizer, SYSPROF, VISUALIZER, DzlBin) +G_DECLARE_DERIVABLE_TYPE (SysprofVisualizer, sysprof_visualizer, SYSPROF, VISUALIZER, GtkBin) struct _SysprofVisualizerClass { - DzlBinClass parent_class; + GtkBinClass parent_class; void (*set_reader) (SysprofVisualizer *self, SysprofCaptureReader *reader); From 07d2de5d3a75088d2d995794e1b4c5171f043292 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 28 Sep 2021 13:03:02 -0700 Subject: [PATCH 005/127] cellrendererduration: inline rounded rectangle We can just embed this instead of relying on dazzle, and inline it at the same time. --- .../sysprof-cell-renderer-duration.c | 50 ++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/src/libsysprof-ui/sysprof-cell-renderer-duration.c b/src/libsysprof-ui/sysprof-cell-renderer-duration.c index d1cebda6..94576227 100644 --- a/src/libsysprof-ui/sysprof-cell-renderer-duration.c +++ b/src/libsysprof-ui/sysprof-cell-renderer-duration.c @@ -55,6 +55,54 @@ G_DEFINE_TYPE_WITH_PRIVATE (SysprofCellRendererDuration, sysprof_cell_renderer_d static GParamSpec *properties [N_PROPS]; +static inline void +rounded_rectangle (cairo_t *cr, + const GdkRectangle *rect, + int x_radius, + int y_radius) +{ + int x; + int y; + int width; + int height; + int x1, x2; + int y1, y2; + int xr1, xr2; + int yr1, yr2; + + g_assert (cr); + g_assert (rect); + + x = rect->x; + y = rect->y; + width = rect->width; + height = rect->height; + + x1 = x; + x2 = x1 + width; + y1 = y; + y2 = y1 + height; + + x_radius = MIN (x_radius, width / 2.0); + y_radius = MIN (y_radius, width / 2.0); + + xr1 = x_radius; + xr2 = x_radius / 2.0; + yr1 = y_radius; + yr2 = y_radius / 2.0; + + cairo_move_to (cr, x1 + xr1, y1); + cairo_line_to (cr, x2 - xr1, y1); + cairo_curve_to (cr, x2 - xr2, y1, x2, y1 + yr2, x2, y1 + yr1); + cairo_line_to (cr, x2, y2 - yr1); + cairo_curve_to (cr, x2, y2 - yr2, x2 - xr2, y2, x2 - xr1, y2); + cairo_line_to (cr, x1 + xr1, y2); + cairo_curve_to (cr, x1 + xr2, y2, x1, y2 - yr2, x1, y2 - yr1); + cairo_line_to (cr, x1, y1 + yr1); + cairo_curve_to (cr, x1, y1 + yr2, x1 + xr2, y1, x1 + xr1, y1); + cairo_close_path (cr); +} + static void sysprof_cell_renderer_duration_render (GtkCellRenderer *renderer, cairo_t *cr, @@ -108,7 +156,7 @@ sysprof_cell_renderer_duration_render (GtkCellRenderer *renderer, if (r.width > 3) { - dzl_cairo_rounded_rectangle (cr, &r, 2, 2); + rounded_rectangle (cr, &r, 2, 2); cairo_fill (cr); } else if (r.width > 1) From 99a4cd83093c9d94a4d3a3bf0ff5862c72ce8c29 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 28 Sep 2021 13:03:48 -0700 Subject: [PATCH 006/127] css: remove dead CSS --- src/libsysprof-ui/css/SysprofDisplay-shared.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/libsysprof-ui/css/SysprofDisplay-shared.css b/src/libsysprof-ui/css/SysprofDisplay-shared.css index 7b75023c..abddcde6 100644 --- a/src/libsysprof-ui/css/SysprofDisplay-shared.css +++ b/src/libsysprof-ui/css/SysprofDisplay-shared.css @@ -1,7 +1,3 @@ -SysprofDisplay dzlmultipaned { - -DzlMultiPaned-handle-size: 0; - } - SysprofVisualizer { background: @content_view_bg; } From 5a6e0a35949929df9c928325290af4a85feec56e Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 28 Sep 2021 13:19:13 -0700 Subject: [PATCH 007/127] marksaid: embed rgba shading code --- src/libsysprof-ui/sysprof-marks-aid.c | 173 +++++++++++++++++++++++++- 1 file changed, 172 insertions(+), 1 deletion(-) diff --git a/src/libsysprof-ui/sysprof-marks-aid.c b/src/libsysprof-ui/sysprof-marks-aid.c index 98744c91..4361dfab 100644 --- a/src/libsysprof-ui/sysprof-marks-aid.c +++ b/src/libsysprof-ui/sysprof-marks-aid.c @@ -46,6 +46,177 @@ typedef struct G_DEFINE_TYPE (SysprofMarksAid, sysprof_marks_aid, SYSPROF_TYPE_AID) +static void +rgb_to_hls (gdouble *r, + gdouble *g, + gdouble *b) +{ + gdouble min; + gdouble max; + gdouble red; + gdouble green; + gdouble blue; + gdouble h, l, s; + gdouble delta; + + red = *r; + green = *g; + blue = *b; + if (red > green) + { + if (red > blue) + max = red; + else + max = blue; + if (green < blue) + min = green; + else + min = blue; + } + else + { + if (green > blue) + max = green; + else + max = blue; + if (red < blue) + min = red; + else + min = blue; + } + l = (max + min) / 2; + s = 0; + h = 0; + if (max != min) + { + if (l <= 0.5) + s = (max - min) / (max + min); + else + s = (max - min) / (2 - max - min); + delta = max - min; + if (red == max) + h = (green - blue) / delta; + else if (green == max) + h = 2 + (blue - red) / delta; + else if (blue == max) + h = 4 + (red - green) / delta; + h *= 60; + if (h < 0.0) + h += 360; + } + *r = h; + *g = l; + *b = s; +} + +static void +hls_to_rgb (gdouble *h, + gdouble *l, + gdouble *s) +{ + gdouble hue; + gdouble lightness; + gdouble saturation; + gdouble m1, m2; + gdouble r, g, b; + + lightness = *l; + saturation = *s; + if (lightness <= 0.5) + m2 = lightness * (1 + saturation); + else + m2 = lightness + saturation - lightness * saturation; + m1 = 2 * lightness - m2; + if (saturation == 0) + { + *h = lightness; + *l = lightness; + *s = lightness; + } + else + { + hue = *h + 120; + while (hue > 360) + hue -= 360; + while (hue < 0) + hue += 360; + if (hue < 60) + r = m1 + (m2 - m1) * hue / 60; + else if (hue < 180) + r = m2; + else if (hue < 240) + r = m1 + (m2 - m1) * (240 - hue) / 60; + else + r = m1; + hue = *h; + while (hue > 360) + hue -= 360; + while (hue < 0) + hue += 360; + if (hue < 60) + g = m1 + (m2 - m1) * hue / 60; + else if (hue < 180) + g = m2; + else if (hue < 240) + g = m1 + (m2 - m1) * (240 - hue) / 60; + else + g = m1; + hue = *h - 120; + while (hue > 360) + hue -= 360; + while (hue < 0) + hue += 360; + if (hue < 60) + b = m1 + (m2 - m1) * hue / 60; + else if (hue < 180) + b = m2; + else if (hue < 240) + b = m1 + (m2 - m1) * (240 - hue) / 60; + else + b = m1; + *h = r; + *l = g; + *s = b; + } +} + +static void +rgba_shade (const GdkRGBA *rgba, + GdkRGBA *dst, + gdouble k) +{ + gdouble red; + gdouble green; + gdouble blue; + + red = rgba->red; + green = rgba->green; + blue = rgba->blue; + + rgb_to_hls (&red, &green, &blue); + + green *= k; + + if (green > 1.0) + green = 1.0; + else if (green < 0.0) + green = 0.0; + + blue *= k; + + if (blue > 1.0) + blue = 1.0; + else if (blue < 0.0) + blue = 0.0; + + hls_to_rgb (&red, &green, &blue); + + dst->red = red; + dst->green = green; + dst->blue = blue; + dst->alpha = rgba->alpha; +} + static void present_free (gpointer data) { @@ -275,7 +446,7 @@ sysprof_marks_aid_present_finish (SysprofAid *aid, if (!g_hash_table_contains (seen, GUINT_TO_POINTER (span->kind))) { - dzl_rgba_shade (&rgba, &kind_rgba, 1 + (ratio * span->kind)); + rgba_shade (&rgba, &kind_rgba, 1 + (ratio * span->kind)); g_hash_table_insert (seen, GUINT_TO_POINTER (span->kind), g_memdup2 (&kind_rgba, sizeof kind_rgba)); From 24c1cfe5bf3a9d4f8c4d90d3c9f49e0021940cf4 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 28 Sep 2021 13:19:32 -0700 Subject: [PATCH 008/127] memprofpage: remove dazzle usage We will need to use some replacements in GTK 4 though. --- src/libsysprof-ui/sysprof-memprof-page.c | 31 ++++++++++++++---------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/libsysprof-ui/sysprof-memprof-page.c b/src/libsysprof-ui/sysprof-memprof-page.c index d4764768..fb6133db 100644 --- a/src/libsysprof-ui/sysprof-memprof-page.c +++ b/src/libsysprof-ui/sysprof-memprof-page.c @@ -39,7 +39,6 @@ #include "config.h" -#include #include #include "../stackstash.h" @@ -237,7 +236,7 @@ update_summary (SysprofMemprofPage *self, gtk_label_set_label (GTK_LABEL (title), title_str); gtk_label_set_xalign (GTK_LABEL (title), 0); - dzl_gtk_widget_add_style_class (title, "dim-label"); + gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (title)), "dim-label"); gtk_widget_set_margin_start (box, 6); gtk_widget_set_margin_end (box, 6); @@ -900,6 +899,8 @@ copy_tree_view_selection (GtkTreeView *tree_view) gtk_clipboard_set_text (clipboard, str->str, str->len); } +#if 0 +/* use widget action */ static void sysprof_memprof_page_copy_cb (GtkWidget *widget, SysprofMemprofPage *self) @@ -923,6 +924,7 @@ sysprof_memprof_page_copy_cb (GtkWidget *widget, else if (focus == GTK_WIDGET (priv->functions_view)) copy_tree_view_selection (priv->functions_view); } +#endif static void sysprof_memprof_page_generate_cb (GObject *object, @@ -1157,13 +1159,26 @@ sysprof_memprof_page_class_init (SysprofMemprofPageClass *klass) gtk_binding_entry_add_signal (bindings, GDK_KEY_Left, GDK_MOD1_MASK, "go-previous", 0); g_type_ensure (SYSPROF_TYPE_CELL_RENDERER_PERCENT); + +#if 0 + /* Use class shortcut/actions */ + DzlShortcutController *controller; + controller = dzl_shortcut_controller_find (GTK_WIDGET (self)); + + dzl_shortcut_controller_add_command_callback (controller, + "org.gnome.sysprof3.capture.copy", + "c", + DZL_SHORTCUT_PHASE_BUBBLE, + (GtkCallback) sysprof_memprof_page_copy_cb, + self, + NULL); +#endif } static void sysprof_memprof_page_init (SysprofMemprofPage *self) { SysprofMemprofPagePrivate *priv = sysprof_memprof_page_get_instance_private (self); - DzlShortcutController *controller; GtkTreeSelection *selection; GtkCellRenderer *cell; @@ -1246,16 +1261,6 @@ sysprof_memprof_page_init (SysprofMemprofPage *self) gtk_tree_selection_set_mode (gtk_tree_view_get_selection (priv->descendants_view), GTK_SELECTION_MULTIPLE); - - controller = dzl_shortcut_controller_find (GTK_WIDGET (self)); - - dzl_shortcut_controller_add_command_callback (controller, - "org.gnome.sysprof3.capture.copy", - "c", - DZL_SHORTCUT_PHASE_BUBBLE, - (GtkCallback) sysprof_memprof_page_copy_cb, - self, - NULL); } typedef struct _Descendant Descendant; From 4e8b2ce9c5bb6e84b7dbc8978935116343244fa8 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 28 Sep 2021 13:19:38 -0700 Subject: [PATCH 009/127] sysprof-ui: remove dazzle header --- src/libsysprof-ui/sysprof-ui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsysprof-ui/sysprof-ui.h b/src/libsysprof-ui/sysprof-ui.h index c63a7129..02513d51 100644 --- a/src/libsysprof-ui/sysprof-ui.h +++ b/src/libsysprof-ui/sysprof-ui.h @@ -20,7 +20,7 @@ #pragma once -#include +#include #include G_BEGIN_DECLS From 0a83abe1e5ae6c83e3e3a59eb8bb156e67d6f2b2 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 28 Sep 2021 13:20:04 -0700 Subject: [PATCH 010/127] sysprof: add EggBindingGroup Until we have this in GLib, just embed it. --- src/sysprof/egg-binding-group.c | 639 ++++++++++++++++++++++++++++++++ src/sysprof/egg-binding-group.h | 57 +++ src/sysprof/meson.build | 1 + 3 files changed, 697 insertions(+) create mode 100644 src/sysprof/egg-binding-group.c create mode 100644 src/sysprof/egg-binding-group.h diff --git a/src/sysprof/egg-binding-group.c b/src/sysprof/egg-binding-group.c new file mode 100644 index 00000000..47cc230c --- /dev/null +++ b/src/sysprof/egg-binding-group.c @@ -0,0 +1,639 @@ +/* egg-binding-group.c + * + * Copyright (C) 2015 Christian Hergert + * Copyright (C) 2015 Garrett Regier + * + * This file is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "config.h" + +#include + +#include "egg-binding-group.h" + +/** + * SECTION:eggbindinggroup + * @title: EggBindingGroup + * @short_description: Manage a collection of #GBindings on + * a #GObject as a group. + * + * #EggBindingGroup manages to simplify the process of binding + * many properties from a #GObject as a group. As such there is no API + * to unbind a property from the group. + * + * In particular, this allows you to change the source instance for the + * bindings. This automatically causes the unbinding of the properties + * from the old instance and binding to the new instance. + * + * This should not be confused with #GtkBindingGroup. + */ + +struct _EggBindingGroup +{ + GObject parent_instance; + + GObject *source; + GPtrArray *lazy_bindings; +}; + +typedef struct +{ + EggBindingGroup *group; + const gchar *source_property; + const gchar *target_property; + GObject *target; + GBinding *binding; + gpointer user_data; + GDestroyNotify user_data_destroy; + gpointer transform_to; + gpointer transform_from; + GBindingFlags binding_flags; + guint using_closures : 1; +} LazyBinding; + +G_DEFINE_TYPE (EggBindingGroup, egg_binding_group, G_TYPE_OBJECT) + +enum { + PROP_0, + PROP_SOURCE, + LAST_PROP +}; + +static GParamSpec *properties [LAST_PROP]; + +/*#define DEBUG_BINDINGS 1*/ + +#ifdef DEBUG_BINDINGS +static gchar * +_g_flags_to_string (GFlagsClass *flags_class, + guint value) +{ + GString *str; + GFlagsValue *flags_value; + gboolean first = TRUE; + + str = g_string_new (NULL); + + while ((first || value != 0) && + (flags_value = g_flags_get_first_value (flags_class, value)) != NULL) + { + if (!first) + g_string_append (str, " | "); + + g_string_append (str, flags_value->value_name); + + first = FALSE; + value &= ~(flags_value->value); + } + + return g_string_free (str, FALSE); +} +#endif + +static void +egg_binding_group_connect (EggBindingGroup *self, + LazyBinding *lazy_binding) +{ + GBinding *binding; + + g_assert (EGG_IS_BINDING_GROUP (self)); + g_assert (self->source != NULL); + g_assert (lazy_binding != NULL); + g_assert (lazy_binding->binding == NULL); + g_assert (lazy_binding->target != NULL); + g_assert (lazy_binding->target_property != NULL); + g_assert (lazy_binding->source_property != NULL); + +#ifdef DEBUG_BINDINGS + { + GFlagsClass *flags_class; + g_autofree gchar *flags_str = NULL; + + flags_class = g_type_class_ref (G_TYPE_BINDING_FLAGS); + flags_str = _g_flags_to_string (flags_class, + lazy_binding->binding_flags); + + g_print ("Binding %s(%p):%s to %s(%p):%s (flags=%s)\n", + G_OBJECT_TYPE_NAME (self->source), + self->source, + lazy_binding->source_property, + G_OBJECT_TYPE_NAME (lazy_binding->target), + lazy_binding->target, + lazy_binding->target_property, + flags_str); + + g_type_class_unref (flags_class); + } +#endif + + if (!lazy_binding->using_closures) + { + binding = g_object_bind_property_full (self->source, + lazy_binding->source_property, + lazy_binding->target, + lazy_binding->target_property, + lazy_binding->binding_flags, + lazy_binding->transform_to, + lazy_binding->transform_from, + lazy_binding->user_data, + NULL); + } + else + { + binding = g_object_bind_property_with_closures (self->source, + lazy_binding->source_property, + lazy_binding->target, + lazy_binding->target_property, + lazy_binding->binding_flags, + lazy_binding->transform_to, + lazy_binding->transform_from); + } + + lazy_binding->binding = binding; +} + +static void +egg_binding_group_disconnect (LazyBinding *lazy_binding) +{ + g_assert (lazy_binding != NULL); + + if (lazy_binding->binding != NULL) + { + g_binding_unbind (lazy_binding->binding); + lazy_binding->binding = NULL; + } +} + +static void +egg_binding_group__source_weak_notify (gpointer data, + GObject *where_object_was) +{ + EggBindingGroup *self = data; + gsize i; + + g_assert (EGG_IS_BINDING_GROUP (self)); + + self->source = NULL; + + for (i = 0; i < self->lazy_bindings->len; i++) + { + LazyBinding *lazy_binding; + + lazy_binding = g_ptr_array_index (self->lazy_bindings, i); + lazy_binding->binding = NULL; + } +} + +static void +egg_binding_group__target_weak_notify (gpointer data, + GObject *where_object_was) +{ + EggBindingGroup *self = data; + gsize i; + + g_assert (EGG_IS_BINDING_GROUP (self)); + + for (i = 0; i < self->lazy_bindings->len; i++) + { + LazyBinding *lazy_binding; + + lazy_binding = g_ptr_array_index (self->lazy_bindings, i); + + if (lazy_binding->target == where_object_was) + { + lazy_binding->target = NULL; + lazy_binding->binding = NULL; + + g_ptr_array_remove_index_fast (self->lazy_bindings, i); + break; + } + } +} + +static void +lazy_binding_free (gpointer data) +{ + LazyBinding *lazy_binding = data; + + if (lazy_binding->target != NULL) + { + g_object_weak_unref (lazy_binding->target, + egg_binding_group__target_weak_notify, + lazy_binding->group); + lazy_binding->target = NULL; + } + + egg_binding_group_disconnect (lazy_binding); + + lazy_binding->group = NULL; + lazy_binding->source_property = NULL; + lazy_binding->target_property = NULL; + + if (lazy_binding->user_data_destroy) + lazy_binding->user_data_destroy (lazy_binding->user_data); + + if (lazy_binding->using_closures) + { + g_clear_pointer (&lazy_binding->transform_to, g_closure_unref); + g_clear_pointer (&lazy_binding->transform_from, g_closure_unref); + } + + g_slice_free (LazyBinding, lazy_binding); +} + +static void +egg_binding_group_dispose (GObject *object) +{ + EggBindingGroup *self = (EggBindingGroup *)object; + + g_assert (EGG_IS_BINDING_GROUP (self)); + + if (self->source != NULL) + { + g_object_weak_unref (self->source, + egg_binding_group__source_weak_notify, + self); + self->source = NULL; + } + + if (self->lazy_bindings->len != 0) + g_ptr_array_remove_range (self->lazy_bindings, 0, self->lazy_bindings->len); + + G_OBJECT_CLASS (egg_binding_group_parent_class)->dispose (object); +} + +static void +egg_binding_group_finalize (GObject *object) +{ + EggBindingGroup *self = (EggBindingGroup *)object; + + g_assert (self->lazy_bindings != NULL); + g_assert (self->lazy_bindings->len == 0); + + g_clear_pointer (&self->lazy_bindings, g_ptr_array_unref); + + G_OBJECT_CLASS (egg_binding_group_parent_class)->finalize (object); +} + +static void +egg_binding_group_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + EggBindingGroup *self = EGG_BINDING_GROUP (object); + + switch (prop_id) + { + case PROP_SOURCE: + g_value_set_object (value, egg_binding_group_get_source (self)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +egg_binding_group_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + EggBindingGroup *self = EGG_BINDING_GROUP (object); + + switch (prop_id) + { + case PROP_SOURCE: + egg_binding_group_set_source (self, g_value_get_object (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +egg_binding_group_class_init (EggBindingGroupClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = egg_binding_group_dispose; + object_class->finalize = egg_binding_group_finalize; + object_class->get_property = egg_binding_group_get_property; + object_class->set_property = egg_binding_group_set_property; + + /** + * EggBindingGroup:source + * + * The source object used for binding properties. + */ + properties [PROP_SOURCE] = + g_param_spec_object ("source", + "Source", + "The source GObject used for binding properties.", + G_TYPE_OBJECT, + (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + g_object_class_install_properties (object_class, LAST_PROP, properties); +} + +static void +egg_binding_group_init (EggBindingGroup *self) +{ + self->lazy_bindings = g_ptr_array_new_with_free_func (lazy_binding_free); +} + +/** + * egg_binding_group_new: + * + * Creates a new #EggBindingGroup. + * + * Returns: a new #EggBindingGroup + */ +EggBindingGroup * +egg_binding_group_new (void) +{ + return g_object_new (EGG_TYPE_BINDING_GROUP, NULL); +} + +/** + * egg_binding_group_get_source: + * @self: the #EggBindingGroup + * + * Gets the source object used for binding properties. + * + * Returns: (transfer none) (nullable): the source object. + */ +GObject * +egg_binding_group_get_source (EggBindingGroup *self) +{ + g_return_val_if_fail (EGG_IS_BINDING_GROUP (self), NULL); + + return self->source; +} + +static gboolean +egg_binding_group_check_source (EggBindingGroup *self, + gpointer source) +{ + gsize i; + + for (i = 0; i < self->lazy_bindings->len; i++) + { + LazyBinding *lazy_binding; + + lazy_binding = g_ptr_array_index (self->lazy_bindings, i); + + g_return_val_if_fail (g_object_class_find_property (G_OBJECT_GET_CLASS (source), + lazy_binding->source_property) != NULL, + FALSE); + } + + return TRUE; +} + +/** + * egg_binding_group_set_source: + * @self: the #EggBindingGroup + * @source: (type GObject) (nullable): the source #GObject + * + * Sets @source as the source object used for creating property + * bindings. If there is already a source object all bindings from it + * will be removed. + * + * Note: All properties that have been bound must exist on @source. + */ +void +egg_binding_group_set_source (EggBindingGroup *self, + gpointer source) +{ + g_return_if_fail (EGG_IS_BINDING_GROUP (self)); + g_return_if_fail (!source || G_IS_OBJECT (source)); + g_return_if_fail (source != (gpointer)self); + + if (source == (gpointer)self->source) + return; + + if (self->source != NULL) + { + gsize i; + + g_object_weak_unref (self->source, + egg_binding_group__source_weak_notify, + self); + self->source = NULL; + + for (i = 0; i < self->lazy_bindings->len; i++) + { + LazyBinding *lazy_binding; + + lazy_binding = g_ptr_array_index (self->lazy_bindings, i); + egg_binding_group_disconnect (lazy_binding); + } + } + + if (source != NULL && egg_binding_group_check_source (self, source)) + { + gsize i; + + self->source = source; + g_object_weak_ref (self->source, + egg_binding_group__source_weak_notify, + self); + + for (i = 0; i < self->lazy_bindings->len; i++) + { + LazyBinding *lazy_binding; + + lazy_binding = g_ptr_array_index (self->lazy_bindings, i); + egg_binding_group_connect (self, lazy_binding); + } + } + + g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SOURCE]); +} + +static void +egg_binding_group_bind_helper (EggBindingGroup *self, + const gchar *source_property, + gpointer target, + const gchar *target_property, + GBindingFlags flags, + gpointer transform_to, + gpointer transform_from, + gpointer user_data, + GDestroyNotify user_data_destroy, + gboolean using_closures) +{ + LazyBinding *lazy_binding; + + g_return_if_fail (EGG_IS_BINDING_GROUP (self)); + g_return_if_fail (source_property != NULL); + g_return_if_fail (self->source == NULL || + g_object_class_find_property (G_OBJECT_GET_CLASS (self->source), + source_property) != NULL); + g_return_if_fail (G_IS_OBJECT (target)); + g_return_if_fail (target_property != NULL); + g_return_if_fail (g_object_class_find_property (G_OBJECT_GET_CLASS (target), + target_property) != NULL); + g_return_if_fail (target != (gpointer)self || + strcmp (source_property, target_property) != 0); + + lazy_binding = g_slice_new0 (LazyBinding); + lazy_binding->group = self; + lazy_binding->source_property = g_intern_string (source_property); + lazy_binding->target_property = g_intern_string (target_property); + lazy_binding->target = target; + lazy_binding->binding_flags = flags | G_BINDING_SYNC_CREATE; + lazy_binding->user_data = user_data; + lazy_binding->user_data_destroy = user_data_destroy; + lazy_binding->transform_to = transform_to; + lazy_binding->transform_from = transform_from; + + if (using_closures) + { + lazy_binding->using_closures = TRUE; + + if (transform_to != NULL) + g_closure_sink (g_closure_ref (transform_to)); + + if (transform_from != NULL) + g_closure_sink (g_closure_ref (transform_from)); + } + + g_object_weak_ref (target, + egg_binding_group__target_weak_notify, + self); + + g_ptr_array_add (self->lazy_bindings, lazy_binding); + + if (self->source != NULL) + egg_binding_group_connect (self, lazy_binding); +} + +/** + * egg_binding_group_bind: + * @self: the #EggBindingGroup + * @source_property: the property on the source to bind + * @target: (type GObject): the target #GObject + * @target_property: the property on @target to bind + * @flags: the flags used to create the #GBinding + * + * Creates a binding between @source_property on the source object + * and @target_property on @target. Whenever the @source_property + * is changed the @target_property is updated using the same value. + * The binding flags #G_BINDING_SYNC_CREATE is automatically specified. + * + * See: g_object_bind_property(). + */ +void +egg_binding_group_bind (EggBindingGroup *self, + const gchar *source_property, + gpointer target, + const gchar *target_property, + GBindingFlags flags) +{ + egg_binding_group_bind_full (self, source_property, + target, target_property, + flags, + NULL, NULL, + NULL, NULL); +} + +/** + * egg_binding_group_bind_full: + * @self: the #EggBindingGroup + * @source_property: the property on the source to bind + * @target: (type GObject): the target #GObject + * @target_property: the property on @target to bind + * @flags: the flags used to create the #GBinding + * @transform_to: (scope notified) (nullable): the transformation function + * from the source object to the @target, or %NULL to use the default + * @transform_from: (scope notified) (nullable): the transformation function + * from the @target to the source object, or %NULL to use the default + * @user_data: custom data to be passed to the transformation + * functions, or %NULL + * @user_data_destroy: function to be called when disposing the binding, + * to free the resources used by the transformation functions + * + * Creates a binding between @source_property on the source object and + * @target_property on @target, allowing you to set the transformation + * functions to be used by the binding. The binding flags + * #G_BINDING_SYNC_CREATE is automatically specified. + * + * See: g_object_bind_property_full(). + */ +void +egg_binding_group_bind_full (EggBindingGroup *self, + const gchar *source_property, + gpointer target, + const gchar *target_property, + GBindingFlags flags, + GBindingTransformFunc transform_to, + GBindingTransformFunc transform_from, + gpointer user_data, + GDestroyNotify user_data_destroy) +{ + egg_binding_group_bind_helper (self, source_property, + target, target_property, + flags, + transform_to, transform_from, + user_data, user_data_destroy, + FALSE); +} + +/** + * egg_binding_group_bind_with_closures: (rename-to egg_binding_group_bind_full) + * @self: the #EggBindingGroup + * @source_property: the property on the source to bind + * @target: (type GObject): the target #GObject + * @target_property: the property on @target to bind + * @flags: the flags used to create the #GBinding + * @transform_to: (nullable): a #GClosure wrapping the + * transformation function from the source object to the @target, + * or %NULL to use the default + * @transform_from: (nullable): a #GClosure wrapping the + * transformation function from the @target to the source object, + * or %NULL to use the default + * + * Creates a binding between @source_property on the source object and + * @target_property on @target, allowing you to set the transformation + * functions to be used by the binding. The binding flags + * #G_BINDING_SYNC_CREATE is automatically specified. + * + * This function is the language bindings friendly version of + * egg_binding_group_bind_property_full(), using #GClosures + * instead of function pointers. + * + * See: g_object_bind_property_with_closures(). + */ +void +egg_binding_group_bind_with_closures (EggBindingGroup *self, + const gchar *source_property, + gpointer target, + const gchar *target_property, + GBindingFlags flags, + GClosure *transform_to, + GClosure *transform_from) +{ + egg_binding_group_bind_helper (self, source_property, + target, target_property, + flags, + transform_to, transform_from, + NULL, NULL, + TRUE); +} + diff --git a/src/sysprof/egg-binding-group.h b/src/sysprof/egg-binding-group.h new file mode 100644 index 00000000..c45e05b8 --- /dev/null +++ b/src/sysprof/egg-binding-group.h @@ -0,0 +1,57 @@ +/* egg-binding-group.h + * + * Copyright (C) 2015 Christian Hergert + * Copyright (C) 2015 Garrett Regier + * + * This file is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +#define EGG_TYPE_BINDING_GROUP (egg_binding_group_get_type()) + +G_DECLARE_FINAL_TYPE (EggBindingGroup, egg_binding_group, EGG, BINDING_GROUP, GObject) + +EggBindingGroup *egg_binding_group_new (void); +GObject *egg_binding_group_get_source (EggBindingGroup *self); +void egg_binding_group_set_source (EggBindingGroup *self, + gpointer source); +void egg_binding_group_bind (EggBindingGroup *self, + const gchar *source_property, + gpointer target, + const gchar *target_property, + GBindingFlags flags); +void egg_binding_group_bind_full (EggBindingGroup *self, + const gchar *source_property, + gpointer target, + const gchar *target_property, + GBindingFlags flags, + GBindingTransformFunc transform_to, + GBindingTransformFunc transform_from, + gpointer user_data, + GDestroyNotify user_data_destroy); +void egg_binding_group_bind_with_closures (EggBindingGroup *self, + const gchar *source_property, + gpointer target, + const gchar *target_property, + GBindingFlags flags, + GClosure *transform_to, + GClosure *transform_from); + +G_END_DECLS + diff --git a/src/sysprof/meson.build b/src/sysprof/meson.build index 1777b5b4..e58be710 100644 --- a/src/sysprof/meson.build +++ b/src/sysprof/meson.build @@ -1,6 +1,7 @@ if get_option('enable_gtk') and get_option('libsysprof') sysprof_sources = [ + 'egg-binding-group.c', 'sysprof.c', 'sysprof-application.c', 'sysprof-window.c', From 3b2c1115984f8968edd37030dcbe65924873a4e2 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 28 Sep 2021 13:20:27 -0700 Subject: [PATCH 011/127] visualizergroupheader: dedazzle --- src/libsysprof-ui/sysprof-visualizer-group-header.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsysprof-ui/sysprof-visualizer-group-header.c b/src/libsysprof-ui/sysprof-visualizer-group-header.c index 11d5fd4e..61ddbd2c 100644 --- a/src/libsysprof-ui/sysprof-visualizer-group-header.c +++ b/src/libsysprof-ui/sysprof-visualizer-group-header.c @@ -120,7 +120,7 @@ _sysprof_visualizer_group_header_add_row (SysprofVisualizerGroupHeader *self, "pixel-size", 16, "visible", TRUE, NULL); - dzl_gtk_widget_add_style_class (GTK_WIDGET (image), "dim-label"); + gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (image)), "dim-label"); gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (image)); } From f2aca5a81241965226a3bfc497cc61c66de71e35 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 28 Sep 2021 13:20:59 -0700 Subject: [PATCH 012/127] app: dedazzle We will have to find alternate means to load style sheets in the future, but we can rely on AdwApplication for that. --- src/sysprof/sysprof-application.c | 4 ++-- src/sysprof/sysprof-application.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sysprof/sysprof-application.c b/src/sysprof/sysprof-application.c index e7d3a80f..157d4d3f 100644 --- a/src/sysprof/sysprof-application.c +++ b/src/sysprof/sysprof-application.c @@ -27,10 +27,10 @@ struct _SysprofApplication { - DzlApplication parent_instance; + GtkApplication parent_instance; }; -G_DEFINE_TYPE (SysprofApplication, sysprof_application, DZL_TYPE_APPLICATION) +G_DEFINE_TYPE (SysprofApplication, sysprof_application, GTK_TYPE_APPLICATION) struct { const gchar *action_name; diff --git a/src/sysprof/sysprof-application.h b/src/sysprof/sysprof-application.h index d41c1325..dfcef56a 100644 --- a/src/sysprof/sysprof-application.h +++ b/src/sysprof/sysprof-application.h @@ -18,13 +18,13 @@ #pragma once -#include +#include G_BEGIN_DECLS #define SYSPROF_TYPE_APPLICATION (sysprof_application_get_type()) -G_DECLARE_FINAL_TYPE (SysprofApplication, sysprof_application, SYSPROF, APPLICATION, DzlApplication) +G_DECLARE_FINAL_TYPE (SysprofApplication, sysprof_application, SYSPROF, APPLICATION, GtkApplication) SysprofApplication *sysprof_application_new (void); From a383f4d78ad0b96db691c61b5043254a6e7beea8 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 28 Sep 2021 13:21:37 -0700 Subject: [PATCH 013/127] window: dedazzle This can move to AdwApplicationWindow at some point. --- src/sysprof/sysprof-window.c | 44 ++++++++++++++++++++++---------- src/sysprof/sysprof-window.h | 4 +-- src/sysprof/ui/sysprof-window.ui | 5 ++-- 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/src/sysprof/sysprof-window.c b/src/sysprof/sysprof-window.c index 7b59ff62..809137a7 100644 --- a/src/sysprof/sysprof-window.c +++ b/src/sysprof/sysprof-window.c @@ -25,20 +25,22 @@ #include #include +#include "egg-binding-group.h" + #include "sysprof-window.h" struct _SysprofWindow { - DzlApplicationWindow parent_instance; + GtkApplicationWindow parent_instance; - DzlBindingGroup *bindings; + EggBindingGroup *bindings; SysprofNotebook *notebook; GtkButton *open_button; GtkMenuButton *menu_button; }; -G_DEFINE_TYPE (SysprofWindow, sysprof_window, DZL_TYPE_APPLICATION_WINDOW) +G_DEFINE_TYPE (SysprofWindow, sysprof_window, GTK_TYPE_APPLICATION_WINDOW) /** * sysprof_window_new: @@ -63,9 +65,11 @@ sysprof_window_notify_can_replay_cb (SysprofWindow *self, g_assert (SYSPROF_IS_WINDOW (self)); g_assert (SYSPROF_IS_NOTEBOOK (notebook)); +#if 0 dzl_gtk_widget_action_set (GTK_WIDGET (self), "win", "replay-capture", "enabled", sysprof_notebook_get_can_replay (notebook), NULL); +#endif } static void @@ -76,9 +80,11 @@ sysprof_window_notify_can_save_cb (SysprofWindow *self, g_assert (SYSPROF_IS_WINDOW (self)); g_assert (SYSPROF_IS_NOTEBOOK (notebook)); +#if 0 dzl_gtk_widget_action_set (GTK_WIDGET (self), "win", "save-capture", "enabled", sysprof_notebook_get_can_save (notebook), NULL); +#endif } static void @@ -175,7 +181,7 @@ sysprof_window_finalize (GObject *object) { SysprofWindow *self = (SysprofWindow *)object; - dzl_binding_group_set_source (self->bindings, NULL); + egg_binding_group_set_source (self->bindings, NULL); g_clear_object (&self->bindings); G_OBJECT_CLASS (sysprof_window_parent_class)->finalize (object); @@ -194,6 +200,17 @@ sysprof_window_class_init (SysprofWindowClass *klass) gtk_widget_class_bind_template_child (widget_class, SysprofWindow, open_button); gtk_widget_class_bind_template_child (widget_class, SysprofWindow, notebook); +#if 0 + /* Switch to GtkShortcutController class bindings */ + DzlShortcutController *controller; + controller = dzl_shortcut_controller_find (GTK_WIDGET (self)); + dzl_shortcut_controller_add_command_action (controller, + "org.gnome.sysprof3.stop-recording", + "Escape", + DZL_SHORTCUT_PHASE_BUBBLE, + "win.stop-recording"); +#endif + g_type_ensure (SYSPROF_TYPE_NOTEBOOK); g_type_ensure (SYSPROF_TYPE_DISPLAY); } @@ -201,7 +218,6 @@ sysprof_window_class_init (SysprofWindowClass *klass) static void sysprof_window_init (SysprofWindow *self) { - DzlShortcutController *controller; static GActionEntry actions[] = { { "close-tab", close_tab_cb }, { "new-tab", new_tab_cb }, @@ -210,9 +226,13 @@ sysprof_window_init (SysprofWindow *self) { "save-capture", save_capture_cb }, { "stop-recording", stop_recording_cb }, }; + GMenu *menu; gtk_widget_init_template (GTK_WIDGET (self)); + menu = gtk_application_get_menu_by_id (GTK_APPLICATION (g_application_get_default ()), "win-menu"); + gtk_menu_button_set_menu_model (self->menu_button, G_MENU_MODEL (menu)); + g_action_map_add_action_entries (G_ACTION_MAP (self), actions, G_N_ELEMENTS (actions), @@ -230,24 +250,20 @@ sysprof_window_init (SysprofWindow *self) self, G_CONNECT_SWAPPED); - self->bindings = dzl_binding_group_new (); - dzl_binding_group_bind (self->bindings, "title", self, "title", G_BINDING_SYNC_CREATE); + self->bindings = egg_binding_group_new (); + egg_binding_group_bind (self->bindings, "title", self, "title", G_BINDING_SYNC_CREATE); g_object_bind_property (self->notebook, "current", self->bindings, "source", G_BINDING_SYNC_CREATE); - controller = dzl_shortcut_controller_find (GTK_WIDGET (self)); - dzl_shortcut_controller_add_command_action (controller, - "org.gnome.sysprof3.stop-recording", - "Escape", - DZL_SHORTCUT_PHASE_BUBBLE, - "win.stop-recording"); - +#if 0 + /* Switch to using gtk_widget_action_set_enabled() */ dzl_gtk_widget_action_set (GTK_WIDGET (self), "win", "save-capture", "enabled", FALSE, NULL); dzl_gtk_widget_action_set (GTK_WIDGET (self), "win", "replay-capture", "enabled", FALSE, NULL); +#endif } void diff --git a/src/sysprof/sysprof-window.h b/src/sysprof/sysprof-window.h index dacfb56e..1def9343 100644 --- a/src/sysprof/sysprof-window.h +++ b/src/sysprof/sysprof-window.h @@ -20,15 +20,13 @@ #pragma once -#include - #include "sysprof-application.h" G_BEGIN_DECLS #define SYSPROF_TYPE_WINDOW (sysprof_window_get_type()) -G_DECLARE_FINAL_TYPE (SysprofWindow, sysprof_window, SYSPROF, WINDOW, DzlApplicationWindow) +G_DECLARE_FINAL_TYPE (SysprofWindow, sysprof_window, SYSPROF, WINDOW, GtkApplicationWindow) GtkWidget *sysprof_window_new (SysprofApplication *application); void sysprof_window_new_tab (SysprofWindow *self); diff --git a/src/sysprof/ui/sysprof-window.ui b/src/sysprof/ui/sysprof-window.ui index ef30a63d..0e21f7ad 100644 --- a/src/sysprof/ui/sysprof-window.ui +++ b/src/sysprof/ui/sysprof-window.ui @@ -1,6 +1,6 @@ -