2004-05-12 16:07:44 +00:00
|
|
|
|
/* gtkcellrendererprogress.c
|
|
|
|
|
* Copyright (C) 2002 Naba Kumar <kh_naba@users.sourceforge.net>
|
|
|
|
|
* heavily modified by Jörgen Scheibengruber <mfcn@gmx.de>
|
|
|
|
|
* heavily modified by Marco Pesenti Gritti <marco@gnome.org>
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library 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
|
|
|
|
|
* Library General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2004-05-12 16:07:44 +00:00
|
|
|
|
*/
|
|
|
|
|
/*
|
2007-01-02 04:11:15 +00:00
|
|
|
|
* Modified by the GTK+ Team and others 1997-2007. See the AUTHORS
|
2004-05-12 16:07:44 +00:00
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
|
* files for a list of changes. These files are distributed with
|
2020-11-28 18:48:58 +00:00
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
2004-05-12 16:07:44 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include <stdlib.h>
|
2004-08-09 16:59:53 +00:00
|
|
|
|
|
2004-05-12 16:07:44 +00:00
|
|
|
|
#include "gtkcellrendererprogress.h"
|
2014-06-15 15:57:59 +00:00
|
|
|
|
#include "gtkintl.h"
|
2010-09-02 03:27:00 +00:00
|
|
|
|
#include "gtkorientable.h"
|
2005-03-22 02:14:55 +00:00
|
|
|
|
#include "gtkprivate.h"
|
2016-12-23 09:44:49 +00:00
|
|
|
|
#include "gtksnapshot.h"
|
2019-03-16 03:48:26 +00:00
|
|
|
|
#include "gtkstylecontext.h"
|
2004-05-12 16:07:44 +00:00
|
|
|
|
|
|
|
|
|
|
2011-04-11 01:18:13 +00:00
|
|
|
|
/**
|
2021-03-02 03:38:20 +00:00
|
|
|
|
* GtkCellRendererProgress:
|
|
|
|
|
*
|
|
|
|
|
* Renders numbers as progress bars
|
2011-04-11 01:18:13 +00:00
|
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* `GtkCellRendererProgress` renders a numeric value as a progress par in a cell.
|
2011-04-11 01:18:13 +00:00
|
|
|
|
* Additionally, it can display a text on top of the progress bar.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2004-05-12 16:07:44 +00:00
|
|
|
|
enum
|
|
|
|
|
{
|
2006-12-06 21:40:02 +00:00
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_VALUE,
|
2007-01-02 04:11:15 +00:00
|
|
|
|
PROP_TEXT,
|
2007-06-06 20:27:15 +00:00
|
|
|
|
PROP_PULSE,
|
|
|
|
|
PROP_TEXT_XALIGN,
|
2007-06-13 12:41:24 +00:00
|
|
|
|
PROP_TEXT_YALIGN,
|
2010-09-02 03:27:00 +00:00
|
|
|
|
PROP_ORIENTATION,
|
|
|
|
|
PROP_INVERTED
|
|
|
|
|
};
|
2004-05-12 16:07:44 +00:00
|
|
|
|
|
2019-05-27 00:40:15 +00:00
|
|
|
|
typedef struct _GtkCellRendererProgressClass GtkCellRendererProgressClass;
|
|
|
|
|
typedef struct _GtkCellRendererProgressPrivate GtkCellRendererProgressPrivate;
|
|
|
|
|
|
|
|
|
|
struct _GtkCellRendererProgress
|
|
|
|
|
{
|
|
|
|
|
GtkCellRenderer parent_instance;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _GtkCellRendererProgressClass
|
|
|
|
|
{
|
|
|
|
|
GtkCellRendererClass parent_class;
|
|
|
|
|
};
|
|
|
|
|
|
2004-05-12 16:07:44 +00:00
|
|
|
|
struct _GtkCellRendererProgressPrivate
|
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int value;
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *text;
|
|
|
|
|
char *label;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int min_h;
|
|
|
|
|
int min_w;
|
|
|
|
|
int pulse;
|
|
|
|
|
int offset;
|
2020-07-24 20:25:56 +00:00
|
|
|
|
float text_xalign;
|
|
|
|
|
float text_yalign;
|
2010-09-02 03:27:00 +00:00
|
|
|
|
GtkOrientation orientation;
|
|
|
|
|
gboolean inverted;
|
2004-05-12 16:07:44 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void gtk_cell_renderer_progress_finalize (GObject *object);
|
|
|
|
|
static void gtk_cell_renderer_progress_get_property (GObject *object,
|
|
|
|
|
guint param_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
static void gtk_cell_renderer_progress_set_property (GObject *object,
|
|
|
|
|
guint param_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
static void gtk_cell_renderer_progress_set_value (GtkCellRendererProgress *cellprogress,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int value);
|
2004-05-12 16:07:44 +00:00
|
|
|
|
static void gtk_cell_renderer_progress_set_text (GtkCellRendererProgress *cellprogress,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *text);
|
2007-01-02 04:11:15 +00:00
|
|
|
|
static void gtk_cell_renderer_progress_set_pulse (GtkCellRendererProgress *cellprogress,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int pulse);
|
2004-05-17 02:33:18 +00:00
|
|
|
|
static void compute_dimensions (GtkCellRenderer *cell,
|
|
|
|
|
GtkWidget *widget,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *text,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int *width,
|
|
|
|
|
int *height);
|
2016-12-23 09:44:49 +00:00
|
|
|
|
static void gtk_cell_renderer_progress_snapshot (GtkCellRenderer *cell,
|
|
|
|
|
GtkSnapshot *snapshot,
|
2004-05-12 16:07:44 +00:00
|
|
|
|
GtkWidget *widget,
|
2010-08-21 11:18:14 +00:00
|
|
|
|
const GdkRectangle *background_area,
|
|
|
|
|
const GdkRectangle *cell_area,
|
2010-12-23 03:58:40 +00:00
|
|
|
|
GtkCellRendererState flags);
|
2004-05-12 16:07:44 +00:00
|
|
|
|
|
2020-11-28 18:48:58 +00:00
|
|
|
|
|
2010-09-02 03:27:00 +00:00
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GtkCellRendererProgress, gtk_cell_renderer_progress, GTK_TYPE_CELL_RENDERER,
|
2013-06-27 19:02:52 +00:00
|
|
|
|
G_ADD_PRIVATE (GtkCellRendererProgress)
|
2010-09-02 03:27:00 +00:00
|
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL))
|
2004-05-12 16:07:44 +00:00
|
|
|
|
|
|
|
|
|
static void
|
2020-11-28 18:48:58 +00:00
|
|
|
|
recompute_label (GtkCellRendererProgress *cellprogress)
|
2004-05-12 16:07:44 +00:00
|
|
|
|
{
|
2020-11-28 18:48:58 +00:00
|
|
|
|
GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress);
|
|
|
|
|
char *label;
|
2007-06-06 20:27:15 +00:00
|
|
|
|
|
2020-11-28 18:48:58 +00:00
|
|
|
|
if (priv->text)
|
|
|
|
|
label = g_strdup (priv->text);
|
|
|
|
|
else if (priv->pulse < 0)
|
|
|
|
|
label = g_strdup_printf (C_("progress bar label", "%d %%"), priv->value);
|
|
|
|
|
else
|
|
|
|
|
label = NULL;
|
2007-06-13 12:41:24 +00:00
|
|
|
|
|
2020-11-28 18:48:58 +00:00
|
|
|
|
g_free (priv->label);
|
|
|
|
|
priv->label = label;
|
2004-05-12 16:07:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2020-11-28 18:48:58 +00:00
|
|
|
|
gtk_cell_renderer_progress_set_value (GtkCellRendererProgress *cellprogress,
|
|
|
|
|
int value)
|
2004-05-12 16:07:44 +00:00
|
|
|
|
{
|
2019-05-27 00:42:08 +00:00
|
|
|
|
GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress);
|
2007-01-02 04:11:15 +00:00
|
|
|
|
|
2020-11-28 18:48:58 +00:00
|
|
|
|
if (priv->value != value)
|
|
|
|
|
{
|
|
|
|
|
priv->value = value;
|
|
|
|
|
recompute_label (cellprogress);
|
|
|
|
|
g_object_notify (G_OBJECT (cellprogress), "value");
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-01-02 04:11:15 +00:00
|
|
|
|
|
2020-11-28 18:48:58 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_cell_renderer_progress_set_text (GtkCellRendererProgress *cellprogress,
|
|
|
|
|
const char *text)
|
|
|
|
|
{
|
|
|
|
|
GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress);
|
|
|
|
|
char *new_text;
|
2007-06-06 20:27:15 +00:00
|
|
|
|
|
2020-11-28 18:48:58 +00:00
|
|
|
|
new_text = g_strdup (text);
|
|
|
|
|
g_free (priv->text);
|
|
|
|
|
priv->text = new_text;
|
|
|
|
|
recompute_label (cellprogress);
|
|
|
|
|
g_object_notify (G_OBJECT (cellprogress), "text");
|
2004-05-12 16:07:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-28 18:48:58 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_cell_renderer_progress_set_pulse (GtkCellRendererProgress *cellprogress,
|
|
|
|
|
int pulse)
|
2004-05-12 16:07:44 +00:00
|
|
|
|
{
|
2020-11-28 18:48:58 +00:00
|
|
|
|
GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress);
|
|
|
|
|
|
|
|
|
|
if (pulse != priv->pulse)
|
|
|
|
|
{
|
|
|
|
|
if (pulse <= 0)
|
|
|
|
|
priv->offset = 0;
|
|
|
|
|
else
|
|
|
|
|
priv->offset = pulse;
|
|
|
|
|
g_object_notify (G_OBJECT (cellprogress), "pulse");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
priv->pulse = pulse;
|
|
|
|
|
recompute_label (cellprogress);
|
2004-05-12 16:07:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_cell_renderer_progress_finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
GtkCellRendererProgress *cellprogress = GTK_CELL_RENDERER_PROGRESS (object);
|
2019-05-27 00:42:08 +00:00
|
|
|
|
GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress);
|
2020-11-28 18:48:58 +00:00
|
|
|
|
|
2007-01-02 04:11:15 +00:00
|
|
|
|
g_free (priv->text);
|
|
|
|
|
g_free (priv->label);
|
2020-11-28 18:48:58 +00:00
|
|
|
|
|
2004-05-12 16:07:44 +00:00
|
|
|
|
G_OBJECT_CLASS (gtk_cell_renderer_progress_parent_class)->finalize (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2014-06-08 15:27:00 +00:00
|
|
|
|
gtk_cell_renderer_progress_get_property (GObject *object,
|
|
|
|
|
guint param_id,
|
|
|
|
|
GValue *value,
|
2004-05-12 16:07:44 +00:00
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
GtkCellRendererProgress *cellprogress = GTK_CELL_RENDERER_PROGRESS (object);
|
2019-05-27 00:42:08 +00:00
|
|
|
|
GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress);
|
2020-11-28 18:48:58 +00:00
|
|
|
|
|
2004-05-12 16:07:44 +00:00
|
|
|
|
switch (param_id)
|
|
|
|
|
{
|
|
|
|
|
case PROP_VALUE:
|
2007-01-02 04:11:15 +00:00
|
|
|
|
g_value_set_int (value, priv->value);
|
2004-05-12 16:07:44 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_TEXT:
|
2007-01-02 04:11:15 +00:00
|
|
|
|
g_value_set_string (value, priv->text);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_PULSE:
|
|
|
|
|
g_value_set_int (value, priv->pulse);
|
2004-05-12 16:07:44 +00:00
|
|
|
|
break;
|
2007-06-06 20:27:15 +00:00
|
|
|
|
case PROP_TEXT_XALIGN:
|
|
|
|
|
g_value_set_float (value, priv->text_xalign);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_TEXT_YALIGN:
|
|
|
|
|
g_value_set_float (value, priv->text_yalign);
|
|
|
|
|
break;
|
2007-06-13 12:41:24 +00:00
|
|
|
|
case PROP_ORIENTATION:
|
|
|
|
|
g_value_set_enum (value, priv->orientation);
|
|
|
|
|
break;
|
2010-09-02 03:27:00 +00:00
|
|
|
|
case PROP_INVERTED:
|
|
|
|
|
g_value_set_boolean (value, priv->inverted);
|
|
|
|
|
break;
|
2004-05-12 16:07:44 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2014-06-08 15:27:00 +00:00
|
|
|
|
gtk_cell_renderer_progress_set_property (GObject *object,
|
|
|
|
|
guint param_id,
|
2004-05-12 16:07:44 +00:00
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
GtkCellRendererProgress *cellprogress = GTK_CELL_RENDERER_PROGRESS (object);
|
2019-05-27 00:42:08 +00:00
|
|
|
|
GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress);
|
2020-11-28 18:48:58 +00:00
|
|
|
|
|
2004-05-12 16:07:44 +00:00
|
|
|
|
switch (param_id)
|
|
|
|
|
{
|
|
|
|
|
case PROP_VALUE:
|
2020-11-28 18:48:58 +00:00
|
|
|
|
gtk_cell_renderer_progress_set_value (cellprogress,
|
2004-05-12 16:07:44 +00:00
|
|
|
|
g_value_get_int (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_TEXT:
|
|
|
|
|
gtk_cell_renderer_progress_set_text (cellprogress,
|
|
|
|
|
g_value_get_string (value));
|
|
|
|
|
break;
|
2007-01-02 04:11:15 +00:00
|
|
|
|
case PROP_PULSE:
|
2020-11-28 18:48:58 +00:00
|
|
|
|
gtk_cell_renderer_progress_set_pulse (cellprogress,
|
2007-01-02 04:11:15 +00:00
|
|
|
|
g_value_get_int (value));
|
|
|
|
|
break;
|
2007-06-06 20:27:15 +00:00
|
|
|
|
case PROP_TEXT_XALIGN:
|
|
|
|
|
priv->text_xalign = g_value_get_float (value);
|
|
|
|
|
break;
|
|
|
|
|
case PROP_TEXT_YALIGN:
|
|
|
|
|
priv->text_yalign = g_value_get_float (value);
|
|
|
|
|
break;
|
2007-06-13 12:41:24 +00:00
|
|
|
|
case PROP_ORIENTATION:
|
2014-06-08 15:27:00 +00:00
|
|
|
|
if (priv->orientation != g_value_get_enum (value))
|
|
|
|
|
{
|
|
|
|
|
priv->orientation = g_value_get_enum (value);
|
|
|
|
|
g_object_notify_by_pspec (object, pspec);
|
|
|
|
|
}
|
2007-06-13 12:41:24 +00:00
|
|
|
|
break;
|
2010-09-02 03:27:00 +00:00
|
|
|
|
case PROP_INVERTED:
|
2014-06-08 15:27:00 +00:00
|
|
|
|
if (priv->inverted != g_value_get_boolean (value))
|
|
|
|
|
{
|
|
|
|
|
priv->inverted = g_value_get_boolean (value);
|
|
|
|
|
g_object_notify_by_pspec (object, pspec);
|
|
|
|
|
}
|
2010-09-02 03:27:00 +00:00
|
|
|
|
break;
|
2004-05-12 16:07:44 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2004-05-17 02:33:18 +00:00
|
|
|
|
compute_dimensions (GtkCellRenderer *cell,
|
2020-11-28 18:48:58 +00:00
|
|
|
|
GtkWidget *widget,
|
|
|
|
|
const char *text,
|
|
|
|
|
int *width,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int *height)
|
2004-05-12 16:07:44 +00:00
|
|
|
|
{
|
|
|
|
|
PangoRectangle logical_rect;
|
|
|
|
|
PangoLayout *layout;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int xpad, ypad;
|
2020-11-28 18:48:58 +00:00
|
|
|
|
|
2004-05-12 16:07:44 +00:00
|
|
|
|
layout = gtk_widget_create_pango_layout (widget, text);
|
|
|
|
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
2010-05-30 20:38:33 +00:00
|
|
|
|
|
|
|
|
|
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
2020-11-28 18:48:58 +00:00
|
|
|
|
|
2004-05-12 16:07:44 +00:00
|
|
|
|
if (width)
|
2010-05-30 20:38:33 +00:00
|
|
|
|
*width = logical_rect.width + xpad * 2;
|
2020-11-28 18:48:58 +00:00
|
|
|
|
|
2004-05-12 16:07:44 +00:00
|
|
|
|
if (height)
|
2010-05-30 20:38:33 +00:00
|
|
|
|
*height = logical_rect.height + ypad * 2;
|
2006-12-07 15:56:03 +00:00
|
|
|
|
|
2004-11-19 23:18:38 +00:00
|
|
|
|
g_object_unref (layout);
|
2004-05-12 16:07:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2020-11-28 18:48:58 +00:00
|
|
|
|
gtk_cell_renderer_progress_get_preferred_width (GtkCellRenderer *cell,
|
|
|
|
|
GtkWidget *widget,
|
|
|
|
|
int *minimum,
|
|
|
|
|
int *natural)
|
2004-05-12 16:07:44 +00:00
|
|
|
|
{
|
2020-11-28 18:48:58 +00:00
|
|
|
|
GtkCellRendererProgress *self = GTK_CELL_RENDERER_PROGRESS (cell);
|
|
|
|
|
GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (self);
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int w, h;
|
2020-11-28 18:48:58 +00:00
|
|
|
|
int size;
|
2004-05-17 02:33:18 +00:00
|
|
|
|
|
2007-01-02 04:11:15 +00:00
|
|
|
|
if (priv->min_w < 0)
|
2004-05-17 02:33:18 +00:00
|
|
|
|
{
|
2020-11-28 18:48:58 +00:00
|
|
|
|
char *text = g_strdup_printf (C_("progress bar label", "%d %%"), 100);
|
2004-05-17 02:33:18 +00:00
|
|
|
|
compute_dimensions (cell, widget, text,
|
2007-01-02 04:11:15 +00:00
|
|
|
|
&priv->min_w,
|
|
|
|
|
&priv->min_h);
|
2004-05-17 02:33:18 +00:00
|
|
|
|
g_free (text);
|
|
|
|
|
}
|
2020-11-28 18:48:58 +00:00
|
|
|
|
|
2007-01-02 04:11:15 +00:00
|
|
|
|
compute_dimensions (cell, widget, priv->label, &w, &h);
|
2005-06-19 12:44:12 +00:00
|
|
|
|
|
2020-11-28 18:48:58 +00:00
|
|
|
|
size = MAX (priv->min_w, w);
|
|
|
|
|
|
|
|
|
|
if (minimum != NULL)
|
|
|
|
|
*minimum = size;
|
|
|
|
|
if (natural != NULL)
|
|
|
|
|
*natural = size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_cell_renderer_progress_get_preferred_height (GtkCellRenderer *cell,
|
|
|
|
|
GtkWidget *widget,
|
|
|
|
|
int *minimum,
|
|
|
|
|
int *natural)
|
|
|
|
|
{
|
|
|
|
|
GtkCellRendererProgress *self = GTK_CELL_RENDERER_PROGRESS (cell);
|
|
|
|
|
GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (self);
|
|
|
|
|
int w, h;
|
|
|
|
|
int size;
|
|
|
|
|
|
|
|
|
|
if (priv->min_w < 0)
|
2005-06-19 12:44:12 +00:00
|
|
|
|
{
|
2020-11-28 18:48:58 +00:00
|
|
|
|
char *text = g_strdup_printf (C_("progress bar label", "%d %%"), 100);
|
|
|
|
|
compute_dimensions (cell, widget, text,
|
|
|
|
|
&priv->min_w,
|
|
|
|
|
&priv->min_h);
|
|
|
|
|
g_free (text);
|
2005-06-19 12:44:12 +00:00
|
|
|
|
}
|
2006-12-03 20:02:04 +00:00
|
|
|
|
|
2020-11-28 18:48:58 +00:00
|
|
|
|
compute_dimensions (cell, widget, priv->label, &w, &h);
|
|
|
|
|
|
|
|
|
|
size = MIN (priv->min_h, h);
|
|
|
|
|
|
|
|
|
|
if (minimum != NULL)
|
|
|
|
|
*minimum = size;
|
|
|
|
|
if (natural != NULL)
|
|
|
|
|
*natural = size;
|
2004-05-12 16:07:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-24 13:54:49 +00:00
|
|
|
|
static inline int
|
|
|
|
|
get_bar_size (int pulse,
|
|
|
|
|
int value,
|
|
|
|
|
int full_size)
|
2007-06-13 12:41:24 +00:00
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int bar_size;
|
2007-06-13 12:41:24 +00:00
|
|
|
|
|
|
|
|
|
if (pulse < 0)
|
|
|
|
|
bar_size = full_size * MAX (0, value) / 100;
|
|
|
|
|
else if (pulse == 0)
|
|
|
|
|
bar_size = 0;
|
|
|
|
|
else if (pulse == G_MAXINT)
|
|
|
|
|
bar_size = full_size;
|
|
|
|
|
else
|
|
|
|
|
bar_size = MAX (2, full_size / 5);
|
|
|
|
|
|
|
|
|
|
return bar_size;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-24 13:54:49 +00:00
|
|
|
|
static inline int
|
|
|
|
|
get_bar_position (int start,
|
|
|
|
|
int full_size,
|
|
|
|
|
int bar_size,
|
|
|
|
|
int pulse,
|
|
|
|
|
int offset,
|
2007-06-13 12:41:24 +00:00
|
|
|
|
gboolean is_rtl)
|
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int position;
|
2007-06-13 12:41:24 +00:00
|
|
|
|
|
|
|
|
|
if (pulse < 0 || pulse == 0 || pulse == G_MAXINT)
|
|
|
|
|
{
|
|
|
|
|
position = is_rtl ? (start + full_size - bar_size) : start;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
position = (is_rtl ? offset + 12 : offset) % 24;
|
|
|
|
|
if (position > 12)
|
|
|
|
|
position = 24 - position;
|
|
|
|
|
position = start + full_size * position / 15;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return position;
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-12 16:07:44 +00:00
|
|
|
|
static void
|
2016-12-23 09:44:49 +00:00
|
|
|
|
gtk_cell_renderer_progress_snapshot (GtkCellRenderer *cell,
|
|
|
|
|
GtkSnapshot *snapshot,
|
|
|
|
|
GtkWidget *widget,
|
|
|
|
|
const GdkRectangle *background_area,
|
|
|
|
|
const GdkRectangle *cell_area,
|
|
|
|
|
GtkCellRendererState flags)
|
2004-05-12 16:07:44 +00:00
|
|
|
|
{
|
|
|
|
|
GtkCellRendererProgress *cellprogress = GTK_CELL_RENDERER_PROGRESS (cell);
|
2019-05-27 00:42:08 +00:00
|
|
|
|
GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress);
|
2011-01-12 20:28:44 +00:00
|
|
|
|
GtkStyleContext *context;
|
2011-05-06 18:33:00 +00:00
|
|
|
|
GtkBorder padding;
|
2004-05-12 16:07:44 +00:00
|
|
|
|
PangoLayout *layout;
|
|
|
|
|
PangoRectangle logical_rect;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int x, y, w, h, x_pos, y_pos, bar_position, bar_size, start, full_size;
|
|
|
|
|
int xpad, ypad;
|
2004-05-12 16:07:44 +00:00
|
|
|
|
GdkRectangle clip;
|
|
|
|
|
gboolean is_rtl;
|
|
|
|
|
|
2011-01-12 20:28:44 +00:00
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
2004-05-12 16:07:44 +00:00
|
|
|
|
is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
|
2010-05-30 20:38:33 +00:00
|
|
|
|
|
|
|
|
|
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
|
|
|
|
x = cell_area->x + xpad;
|
|
|
|
|
y = cell_area->y + ypad;
|
|
|
|
|
w = cell_area->width - xpad * 2;
|
|
|
|
|
h = cell_area->height - ypad * 2;
|
2005-05-11 19:16:19 +00:00
|
|
|
|
|
2011-01-12 20:28:44 +00:00
|
|
|
|
gtk_style_context_save (context);
|
2020-08-13 23:49:02 +00:00
|
|
|
|
gtk_style_context_add_class (context, "trough");
|
2011-01-12 20:28:44 +00:00
|
|
|
|
|
2016-12-23 09:44:49 +00:00
|
|
|
|
gtk_snapshot_render_background (snapshot, context, x, y, w, h);
|
|
|
|
|
gtk_snapshot_render_frame (snapshot, context, x, y, w, h);
|
2011-01-12 20:28:44 +00:00
|
|
|
|
|
2016-10-08 03:07:23 +00:00
|
|
|
|
gtk_style_context_get_padding (context, &padding);
|
2011-01-12 20:28:44 +00:00
|
|
|
|
|
2011-05-06 18:33:00 +00:00
|
|
|
|
x += padding.left;
|
|
|
|
|
y += padding.top;
|
|
|
|
|
w -= padding.left + padding.right;
|
|
|
|
|
h -= padding.top + padding.bottom;
|
2011-01-12 20:28:44 +00:00
|
|
|
|
|
|
|
|
|
gtk_style_context_restore (context);
|
2006-12-06 21:40:02 +00:00
|
|
|
|
|
2010-09-02 03:27:00 +00:00
|
|
|
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
2007-01-02 04:11:15 +00:00
|
|
|
|
{
|
2007-06-13 12:41:24 +00:00
|
|
|
|
clip.y = y;
|
|
|
|
|
clip.height = h;
|
|
|
|
|
|
|
|
|
|
start = x;
|
|
|
|
|
full_size = w;
|
|
|
|
|
|
|
|
|
|
bar_size = get_bar_size (priv->pulse, priv->value, full_size);
|
|
|
|
|
|
2010-09-02 03:27:00 +00:00
|
|
|
|
if (!priv->inverted)
|
2007-06-13 12:41:24 +00:00
|
|
|
|
bar_position = get_bar_position (start, full_size, bar_size,
|
|
|
|
|
priv->pulse, priv->offset, is_rtl);
|
|
|
|
|
else
|
|
|
|
|
bar_position = get_bar_position (start, full_size, bar_size,
|
|
|
|
|
priv->pulse, priv->offset, !is_rtl);
|
|
|
|
|
|
|
|
|
|
clip.width = bar_size;
|
|
|
|
|
clip.x = bar_position;
|
2007-01-02 04:11:15 +00:00
|
|
|
|
}
|
2007-06-13 12:41:24 +00:00
|
|
|
|
else
|
2007-01-02 04:11:15 +00:00
|
|
|
|
{
|
|
|
|
|
clip.x = x;
|
|
|
|
|
clip.width = w;
|
2007-06-13 12:41:24 +00:00
|
|
|
|
|
|
|
|
|
start = y;
|
|
|
|
|
full_size = h;
|
|
|
|
|
|
|
|
|
|
bar_size = get_bar_size (priv->pulse, priv->value, full_size);
|
|
|
|
|
|
2010-09-02 03:27:00 +00:00
|
|
|
|
if (priv->inverted)
|
2007-06-13 12:41:24 +00:00
|
|
|
|
bar_position = get_bar_position (start, full_size, bar_size,
|
|
|
|
|
priv->pulse, priv->offset, TRUE);
|
|
|
|
|
else
|
|
|
|
|
bar_position = get_bar_position (start, full_size, bar_size,
|
|
|
|
|
priv->pulse, priv->offset, FALSE);
|
|
|
|
|
|
|
|
|
|
clip.height = bar_size;
|
|
|
|
|
clip.y = bar_position;
|
2007-01-02 04:11:15 +00:00
|
|
|
|
}
|
2006-12-06 21:40:02 +00:00
|
|
|
|
|
2010-12-05 12:56:24 +00:00
|
|
|
|
if (bar_size > 0)
|
2014-08-14 23:58:49 +00:00
|
|
|
|
{
|
|
|
|
|
gtk_style_context_save (context);
|
2020-08-13 23:49:02 +00:00
|
|
|
|
gtk_style_context_add_class (context, "progressbar");
|
2011-01-12 20:28:44 +00:00
|
|
|
|
|
2016-12-23 09:44:49 +00:00
|
|
|
|
gtk_snapshot_render_background (snapshot, context, clip.x, clip.y, clip.width, clip.height);
|
|
|
|
|
gtk_snapshot_render_frame (snapshot, context, clip.x, clip.y, clip.width, clip.height);
|
2014-08-14 23:58:49 +00:00
|
|
|
|
|
|
|
|
|
gtk_style_context_restore (context);
|
|
|
|
|
}
|
2006-12-06 21:40:02 +00:00
|
|
|
|
|
2007-01-02 04:11:15 +00:00
|
|
|
|
if (priv->label)
|
|
|
|
|
{
|
2020-07-24 20:25:56 +00:00
|
|
|
|
float text_xalign;
|
2007-06-06 20:27:15 +00:00
|
|
|
|
|
2007-01-02 04:11:15 +00:00
|
|
|
|
layout = gtk_widget_create_pango_layout (widget, priv->label);
|
|
|
|
|
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
|
2007-06-06 20:27:15 +00:00
|
|
|
|
|
|
|
|
|
if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
|
|
|
|
|
text_xalign = 1.0 - priv->text_xalign;
|
|
|
|
|
else
|
|
|
|
|
text_xalign = priv->text_xalign;
|
|
|
|
|
|
2011-01-12 20:28:44 +00:00
|
|
|
|
x_pos = x + padding.left + text_xalign *
|
|
|
|
|
(w - padding.left - padding.right - logical_rect.width);
|
2007-06-06 20:27:15 +00:00
|
|
|
|
|
2011-01-12 20:28:44 +00:00
|
|
|
|
y_pos = y + padding.top + priv->text_yalign *
|
|
|
|
|
(h - padding.top - padding.bottom - logical_rect.height);
|
2010-08-11 21:16:40 +00:00
|
|
|
|
|
2016-12-23 09:44:49 +00:00
|
|
|
|
gtk_snapshot_push_clip (snapshot,
|
|
|
|
|
&GRAPHENE_RECT_INIT(
|
|
|
|
|
clip.x, clip.y,
|
|
|
|
|
clip.width, clip.height
|
2018-04-24 01:17:23 +00:00
|
|
|
|
));
|
2010-08-21 11:18:14 +00:00
|
|
|
|
|
2011-01-12 20:28:44 +00:00
|
|
|
|
gtk_style_context_save (context);
|
2020-08-13 23:49:02 +00:00
|
|
|
|
gtk_style_context_add_class (context, "progressbar");
|
2011-01-12 20:28:44 +00:00
|
|
|
|
|
2016-12-23 09:44:49 +00:00
|
|
|
|
gtk_snapshot_render_layout (snapshot, context,
|
|
|
|
|
x_pos, y_pos,
|
|
|
|
|
layout);
|
2010-08-21 11:18:14 +00:00
|
|
|
|
|
2011-01-12 20:28:44 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
2017-01-12 23:39:59 +00:00
|
|
|
|
gtk_snapshot_pop (snapshot);
|
2007-01-02 04:11:15 +00:00
|
|
|
|
|
2011-01-12 20:28:44 +00:00
|
|
|
|
gtk_style_context_save (context);
|
2020-08-13 23:49:02 +00:00
|
|
|
|
gtk_style_context_add_class (context, "trough");
|
2011-01-12 20:28:44 +00:00
|
|
|
|
|
2007-06-13 12:41:24 +00:00
|
|
|
|
if (bar_position > start)
|
2007-01-02 04:11:15 +00:00
|
|
|
|
{
|
2010-09-02 03:27:00 +00:00
|
|
|
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
2007-06-13 12:41:24 +00:00
|
|
|
|
{
|
|
|
|
|
clip.x = x;
|
|
|
|
|
clip.width = bar_position - x;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
clip.y = y;
|
|
|
|
|
clip.height = bar_position - y;
|
|
|
|
|
}
|
2007-01-02 04:11:15 +00:00
|
|
|
|
|
2016-12-23 09:44:49 +00:00
|
|
|
|
gtk_snapshot_push_clip (snapshot,
|
|
|
|
|
&GRAPHENE_RECT_INIT(
|
|
|
|
|
clip.x, clip.y,
|
|
|
|
|
clip.width, clip.height
|
2018-04-24 01:17:23 +00:00
|
|
|
|
));
|
2010-08-21 11:18:14 +00:00
|
|
|
|
|
2016-12-23 09:44:49 +00:00
|
|
|
|
gtk_snapshot_render_layout (snapshot, context,
|
|
|
|
|
x_pos, y_pos,
|
|
|
|
|
layout);
|
2010-08-21 11:18:14 +00:00
|
|
|
|
|
2017-01-12 23:39:59 +00:00
|
|
|
|
gtk_snapshot_pop (snapshot);
|
2007-01-02 04:11:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-06-13 12:41:24 +00:00
|
|
|
|
if (bar_position + bar_size < start + full_size)
|
2007-01-02 04:11:15 +00:00
|
|
|
|
{
|
2010-09-02 03:27:00 +00:00
|
|
|
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
2007-06-13 12:41:24 +00:00
|
|
|
|
{
|
|
|
|
|
clip.x = bar_position + bar_size;
|
|
|
|
|
clip.width = x + w - (bar_position + bar_size);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
clip.y = bar_position + bar_size;
|
|
|
|
|
clip.height = y + h - (bar_position + bar_size);
|
|
|
|
|
}
|
2007-01-02 04:11:15 +00:00
|
|
|
|
|
2016-12-23 09:44:49 +00:00
|
|
|
|
gtk_snapshot_push_clip (snapshot,
|
|
|
|
|
&GRAPHENE_RECT_INIT(
|
|
|
|
|
clip.x, clip.y,
|
|
|
|
|
clip.width, clip.height
|
2018-04-24 01:17:23 +00:00
|
|
|
|
));
|
2010-08-21 11:18:14 +00:00
|
|
|
|
|
2016-12-23 09:44:49 +00:00
|
|
|
|
gtk_snapshot_render_layout (snapshot, context,
|
|
|
|
|
x_pos, y_pos,
|
|
|
|
|
layout);
|
2011-01-12 20:28:44 +00:00
|
|
|
|
|
2017-01-12 23:39:59 +00:00
|
|
|
|
gtk_snapshot_pop (snapshot);
|
2007-01-02 04:11:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-01-12 20:28:44 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
2007-01-02 04:11:15 +00:00
|
|
|
|
g_object_unref (layout);
|
|
|
|
|
}
|
2004-05-12 16:07:44 +00:00
|
|
|
|
}
|
2020-11-28 18:48:58 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_cell_renderer_progress_class_init (GtkCellRendererProgressClass *klass)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
|
|
|
|
|
|
|
|
|
|
object_class->finalize = gtk_cell_renderer_progress_finalize;
|
|
|
|
|
object_class->get_property = gtk_cell_renderer_progress_get_property;
|
|
|
|
|
object_class->set_property = gtk_cell_renderer_progress_set_property;
|
|
|
|
|
|
|
|
|
|
cell_class->get_preferred_width = gtk_cell_renderer_progress_get_preferred_width;
|
|
|
|
|
cell_class->get_preferred_height = gtk_cell_renderer_progress_get_preferred_height;
|
|
|
|
|
cell_class->snapshot = gtk_cell_renderer_progress_snapshot;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCellRendererProgress:value:
|
|
|
|
|
*
|
|
|
|
|
* The "value" property determines the percentage to which the
|
|
|
|
|
* progress bar will be "filled in".
|
|
|
|
|
**/
|
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
|
PROP_VALUE,
|
|
|
|
|
g_param_spec_int ("value",
|
|
|
|
|
P_("Value"),
|
|
|
|
|
P_("Value of the progress bar"),
|
|
|
|
|
0, 100, 0,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCellRendererProgress:text:
|
|
|
|
|
*
|
|
|
|
|
* The "text" property determines the label which will be drawn
|
|
|
|
|
* over the progress bar. Setting this property to %NULL causes the default
|
|
|
|
|
* label to be displayed. Setting this property to an empty string causes
|
|
|
|
|
* no label to be displayed.
|
|
|
|
|
**/
|
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
|
PROP_TEXT,
|
|
|
|
|
g_param_spec_string ("text",
|
|
|
|
|
P_("Text"),
|
|
|
|
|
P_("Text on the progress bar"),
|
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCellRendererProgress:pulse:
|
|
|
|
|
*
|
|
|
|
|
* Setting this to a non-negative value causes the cell renderer to
|
|
|
|
|
* enter "activity mode", where a block bounces back and forth to
|
|
|
|
|
* indicate that some progress is made, without specifying exactly how
|
|
|
|
|
* much.
|
|
|
|
|
*
|
|
|
|
|
* Each increment of the property causes the block to move by a little
|
|
|
|
|
* bit.
|
|
|
|
|
*
|
|
|
|
|
* To indicate that the activity has not started yet, set the property
|
|
|
|
|
* to zero. To indicate completion, set the property to %G_MAXINT.
|
|
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
|
PROP_PULSE,
|
|
|
|
|
g_param_spec_int ("pulse",
|
|
|
|
|
P_("Pulse"),
|
|
|
|
|
P_("Set this to positive values to indicate that some progress is made, but you don’t know how much."),
|
|
|
|
|
-1, G_MAXINT, -1,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCellRendererProgress:text-xalign:
|
|
|
|
|
*
|
|
|
|
|
* The "text-xalign" property controls the horizontal alignment of the
|
|
|
|
|
* text in the progress bar. Valid values range from 0 (left) to 1
|
|
|
|
|
* (right). Reserved for RTL layouts.
|
|
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
|
PROP_TEXT_XALIGN,
|
|
|
|
|
g_param_spec_float ("text-xalign",
|
|
|
|
|
P_("Text x alignment"),
|
|
|
|
|
P_("The horizontal text alignment, from 0 (left) to 1 (right). Reversed for RTL layouts."),
|
|
|
|
|
0.0, 1.0, 0.5,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCellRendererProgress:text-yalign:
|
|
|
|
|
*
|
|
|
|
|
* The "text-yalign" property controls the vertical alignment of the
|
|
|
|
|
* text in the progress bar. Valid values range from 0 (top) to 1
|
|
|
|
|
* (bottom).
|
|
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
|
PROP_TEXT_YALIGN,
|
|
|
|
|
g_param_spec_float ("text-yalign",
|
|
|
|
|
P_("Text y alignment"),
|
|
|
|
|
P_("The vertical text alignment, from 0 (top) to 1 (bottom)."),
|
|
|
|
|
0.0, 1.0, 0.5,
|
|
|
|
|
GTK_PARAM_READWRITE));
|
|
|
|
|
|
|
|
|
|
g_object_class_override_property (object_class,
|
|
|
|
|
PROP_ORIENTATION,
|
|
|
|
|
"orientation");
|
|
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
|
PROP_INVERTED,
|
|
|
|
|
g_param_spec_boolean ("inverted",
|
|
|
|
|
P_("Inverted"),
|
|
|
|
|
P_("Invert the direction in which the progress bar grows"),
|
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_cell_renderer_progress_init (GtkCellRendererProgress *cellprogress)
|
|
|
|
|
{
|
|
|
|
|
GtkCellRendererProgressPrivate *priv = gtk_cell_renderer_progress_get_instance_private (cellprogress);
|
|
|
|
|
|
|
|
|
|
priv->value = 0;
|
|
|
|
|
priv->text = NULL;
|
|
|
|
|
priv->label = NULL;
|
|
|
|
|
priv->min_w = -1;
|
|
|
|
|
priv->min_h = -1;
|
|
|
|
|
priv->pulse = -1;
|
|
|
|
|
priv->offset = 0;
|
|
|
|
|
|
|
|
|
|
priv->text_xalign = 0.5;
|
|
|
|
|
priv->text_yalign = 0.5;
|
|
|
|
|
|
|
|
|
|
priv->orientation = GTK_ORIENTATION_HORIZONTAL,
|
|
|
|
|
priv->inverted = FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_cell_renderer_progress_new:
|
|
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* Creates a new `GtkCellRendererProgress`.
|
2020-11-28 18:48:58 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: the new cell renderer
|
|
|
|
|
**/
|
|
|
|
|
GtkCellRenderer*
|
|
|
|
|
gtk_cell_renderer_progress_new (void)
|
|
|
|
|
{
|
|
|
|
|
return g_object_new (GTK_TYPE_CELL_RENDERER_PROGRESS, NULL);
|
|
|
|
|
}
|