summaryrefslogtreecommitdiff
path: root/baobab/src/baobab-ringschart.c
diff options
context:
space:
mode:
Diffstat (limited to 'baobab/src/baobab-ringschart.c')
-rw-r--r--baobab/src/baobab-ringschart.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/baobab/src/baobab-ringschart.c b/baobab/src/baobab-ringschart.c
index cdb18a52..7b568673 100644
--- a/baobab/src/baobab-ringschart.c
+++ b/baobab/src/baobab-ringschart.c
@@ -1,22 +1,20 @@
-/*
- * baobab-ringschart.c
+/* Copyright (C) 2008 Igalia
+ * Copyright (C) 2012-2021 MATE Developers
*
- * Copyright (C) 2008 Igalia
+ * This file is part of MATE Utils.
*
- * This program is free software; you can redistribute it and/or modify
+ * MATE Utils is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * MATE Utils 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301 USA
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*
* Authors:
* Felipe Erias <[email protected]>
@@ -69,7 +67,7 @@ struct _BaobabRingschartPrivate
guint tips_timeout_event;
GList *subtip_items;
gboolean drawing_subtips;
- gint subtip_timeout;
+ guint subtip_timeout;
};
G_DEFINE_TYPE_WITH_PRIVATE (BaobabRingschart, baobab_ringschart, BAOBAB_CHART_TYPE);
@@ -98,7 +96,6 @@ static void baobab_ringschart_get_item_rectangle (GtkWidget *chart,
static void baobab_ringschart_pre_draw (GtkWidget *chart, cairo_t *cr);
static void baobab_ringschart_post_draw (GtkWidget *chart, cairo_t *cr);
-
static void
baobab_ringschart_class_init (BaobabRingschartClass *class)
{
@@ -132,7 +129,7 @@ baobab_ringschart_init (BaobabRingschart *chart)
settings = gtk_settings_get_default ();
g_object_get (G_OBJECT (settings), "gtk-tooltip-timeout", &timeout, NULL);
- priv->subtip_timeout = 2 * timeout;
+ priv->subtip_timeout = 2 * (guint)timeout;
}
static void
@@ -308,10 +305,10 @@ baobab_ringschart_get_point_min_rect (gdouble cx,
gdouble angle,
GdkRectangle *rect)
{
- gdouble x, y;
+ int x, y;
- x = cx + cos (angle) * radius;
- y = cy + sin (angle) * radius;
+ x = (int) (cx + cos (angle) * radius);
+ y = (int) (cy + sin (angle) * radius);
rect->x = MIN (rect->x, x);
rect->y = MIN (rect->y, y);
@@ -349,16 +346,16 @@ baobab_ringschart_get_item_rectangle (GtkWidget *chart,
baobab_ringschart_get_point_min_rect (cx, cy, r2, a2, &rect);
if ( (a1 <= M_PI/2) && (a2 >= M_PI/2) )
- rect.height = MAX (rect.height, cy + sin (M_PI/2) * r2);
+ rect.height = MAX (rect.height, (int) (cy + sin (M_PI/2) * r2));
if ( (a1 <= M_PI) && (a2 >= M_PI) )
- rect.x = MIN (rect.x, cx + cos (M_PI) * r2);
+ rect.x = MIN (rect.x, (int) (cx + cos (M_PI) * r2));
if ( (a1 <= M_PI*1.5) && (a2 >= M_PI*1.5) )
- rect.y = MIN (rect.y, cy + sin (M_PI*1.5) * r2);
+ rect.y = MIN (rect.y, (int) (cy + sin (M_PI*1.5) * r2));
if ( (a1 <= M_PI*2) && (a2 >= M_PI*2) )
- rect.width = MAX (rect.width, cx + cos (M_PI*2) * r2);
+ rect.width = MAX (rect.width, (int) (cx + cos (M_PI*2) * r2));
rect.width -= rect.x;
rect.height -= rect.y;
@@ -366,7 +363,7 @@ baobab_ringschart_get_item_rectangle (GtkWidget *chart,
item->rect = rect;
}
-gboolean
+static gboolean
baobab_ringschart_subfolder_tips_timeout (gpointer data)
{
BaobabRingschartPrivate *priv;
@@ -380,7 +377,7 @@ baobab_ringschart_subfolder_tips_timeout (gpointer data)
return FALSE;
}
-void
+static void
baobab_ringschart_clean_subforlder_tips_state (GtkWidget *chart)
{
BaobabRingschartPrivate *priv;
@@ -518,10 +515,10 @@ baobab_ringschart_draw_subfolder_tips (GtkWidget *chart, cairo_t *cr)
}
/* get the GdkRectangle of the tooltip (with a little padding) */
- _rect.x = tooltip_rect.x - 1;
- _rect.y = tooltip_rect.y - 1;
- _rect.width = tooltip_rect.width + 2;
- _rect.height = tooltip_rect.height + 2;
+ _rect.x = (int) (tooltip_rect.x - 1.0);
+ _rect.y = (int) (tooltip_rect.y - 1.0);
+ _rect.width = (int) (tooltip_rect.width + 2.0);
+ _rect.height = (int) (tooltip_rect.height + 2.0);
/* Check if tooltip overlaps */
if (! gdk_rectangle_intersect (&_rect, &last_rect, NULL))