From 8dba12e1c5cab5f48dbf8e5a400e8748ad7aac79 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 26 May 2019 20:42:08 -0400 Subject: [PATCH] cell renderer progress: Drop the priv pointer --- gtk/gtkcellrendererprogress.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/gtk/gtkcellrendererprogress.c b/gtk/gtkcellrendererprogress.c index 62a2563d00..bd2ae8bb01 100644 --- a/gtk/gtkcellrendererprogress.c +++ b/gtk/gtkcellrendererprogress.c @@ -64,9 +64,6 @@ typedef struct _GtkCellRendererProgressPrivate GtkCellRendererProgressPrivate; struct _GtkCellRendererProgress { GtkCellRenderer parent_instance; - - /*< private >*/ - GtkCellRendererProgressPrivate *priv; }; struct _GtkCellRendererProgressClass @@ -239,10 +236,7 @@ gtk_cell_renderer_progress_class_init (GtkCellRendererProgressClass *klass) static void gtk_cell_renderer_progress_init (GtkCellRendererProgress *cellprogress) { - GtkCellRendererProgressPrivate *priv; - - cellprogress->priv = gtk_cell_renderer_progress_get_instance_private (cellprogress); - priv = cellprogress->priv; + GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress); priv->value = 0; priv->text = NULL; @@ -277,7 +271,7 @@ static void gtk_cell_renderer_progress_finalize (GObject *object) { GtkCellRendererProgress *cellprogress = GTK_CELL_RENDERER_PROGRESS (object); - GtkCellRendererProgressPrivate *priv = cellprogress->priv; + GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress); g_free (priv->text); g_free (priv->label); @@ -292,7 +286,7 @@ gtk_cell_renderer_progress_get_property (GObject *object, GParamSpec *pspec) { GtkCellRendererProgress *cellprogress = GTK_CELL_RENDERER_PROGRESS (object); - GtkCellRendererProgressPrivate *priv = cellprogress->priv; + GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress); switch (param_id) { @@ -329,7 +323,7 @@ gtk_cell_renderer_progress_set_property (GObject *object, GParamSpec *pspec) { GtkCellRendererProgress *cellprogress = GTK_CELL_RENDERER_PROGRESS (object); - GtkCellRendererProgressPrivate *priv = cellprogress->priv; + GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress); switch (param_id) { @@ -373,7 +367,7 @@ gtk_cell_renderer_progress_set_property (GObject *object, static void recompute_label (GtkCellRendererProgress *cellprogress) { - GtkCellRendererProgressPrivate *priv = cellprogress->priv; + GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress); gchar *label; if (priv->text) @@ -391,9 +385,11 @@ static void gtk_cell_renderer_progress_set_value (GtkCellRendererProgress *cellprogress, gint value) { - if (cellprogress->priv->value != value) + GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress); + + if (priv->value != value) { - cellprogress->priv->value = value; + priv->value = value; recompute_label (cellprogress); g_object_notify (G_OBJECT (cellprogress), "value"); } @@ -403,11 +399,12 @@ static void gtk_cell_renderer_progress_set_text (GtkCellRendererProgress *cellprogress, const gchar *text) { + GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress); gchar *new_text; new_text = g_strdup (text); - g_free (cellprogress->priv->text); - cellprogress->priv->text = new_text; + g_free (priv->text); + priv->text = new_text; recompute_label (cellprogress); g_object_notify (G_OBJECT (cellprogress), "text"); } @@ -416,7 +413,7 @@ static void gtk_cell_renderer_progress_set_pulse (GtkCellRendererProgress *cellprogress, gint pulse) { - GtkCellRendererProgressPrivate *priv = cellprogress->priv; + GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress); if (pulse != priv->pulse) { @@ -466,7 +463,7 @@ gtk_cell_renderer_progress_get_size (GtkCellRenderer *cell, gint *height) { GtkCellRendererProgress *cellprogress = GTK_CELL_RENDERER_PROGRESS (cell); - GtkCellRendererProgressPrivate *priv = cellprogress->priv; + GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress); gint w, h; gchar *text; @@ -557,7 +554,7 @@ gtk_cell_renderer_progress_snapshot (GtkCellRenderer *cell, GtkCellRendererState flags) { GtkCellRendererProgress *cellprogress = GTK_CELL_RENDERER_PROGRESS (cell); - GtkCellRendererProgressPrivate *priv= cellprogress->priv; + GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress); GtkStyleContext *context; GtkBorder padding; PangoLayout *layout;