diff options
Diffstat (limited to 'baobab/src/baobab-chart.c')
-rw-r--r-- | baobab/src/baobab-chart.c | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/baobab/src/baobab-chart.c b/baobab/src/baobab-chart.c index e484f146..d8350511 100644 --- a/baobab/src/baobab-chart.c +++ b/baobab/src/baobab-chart.c @@ -1,22 +1,20 @@ -/* - * baobab-chart.c +/* Copyright (C) 2006, 2007, 2008 Igalia + * Copyright (C) 2012-2021 MATE Developers * - * Copyright (C) 2006, 2007, 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]> @@ -31,7 +29,10 @@ * Alejandro Garcia <[email protected]> */ +#ifdef HAVE_CONFIG_H #include <config.h> +#endif + #include <gtk/gtk.h> #include <glib/gi18n.h> @@ -166,7 +167,6 @@ static gboolean baobab_chart_query_tooltip (GtkWidget *widget, GtkTooltip *tooltip, gpointer user_data); - static void baobab_chart_class_init (BaobabChartClass *class) { @@ -377,7 +377,7 @@ baobab_chart_set_property (GObject *object, switch (prop_id) { case PROP_MAX_DEPTH: - baobab_chart_set_max_depth (GTK_WIDGET (chart), g_value_get_int (value)); + baobab_chart_set_max_depth (GTK_WIDGET (chart), g_value_get_uint (value)); break; case PROP_MODEL: baobab_chart_set_model (GTK_WIDGET (chart), g_value_get_object (value)); @@ -404,7 +404,7 @@ baobab_chart_get_property (GObject *object, switch (prop_id) { case PROP_MAX_DEPTH: - g_value_set_int (value, priv->max_depth); + g_value_set_uint (value, priv->max_depth); break; case PROP_MODEL: g_value_set_object (value, priv->model); @@ -522,8 +522,6 @@ baobab_chart_get_items (GtkWidget *chart, GtkTreePath *root) return; } - - model_root_path = gtk_tree_path_new_first (); gtk_tree_model_get_iter (priv->model, &model_root_iter, model_root_path); gtk_tree_path_free (model_root_path); @@ -656,7 +654,6 @@ baobab_chart_update_draw (BaobabChart* chart, if (priv->root == NULL) root_path = gtk_tree_path_new_first (); - root_depth = gtk_tree_path_get_depth (root_path); node_depth = gtk_tree_path_get_depth (path); @@ -747,7 +744,7 @@ baobab_chart_expose (GtkWidget *chart, cairo_t *cr) { BaobabChartPrivate *priv; gint w, h; - gdouble p, sx, sy; + gdouble p, sx, sy, aux; GtkTreePath *root_path = NULL; GtkTreePath *current_path = NULL; GtkAllocation allocation; @@ -755,10 +752,18 @@ baobab_chart_expose (GtkWidget *chart, cairo_t *cr) GdkRectangle area; gdouble x1, y1, x2, y2; cairo_clip_extents (cr, &x1, &y1, &x2, &y2); - area.x = floor (x1); - area.y = floor (y1); - area.width = ceil (x2) - area.x; - area.height = ceil (y2) - area.y; + + aux = floor (x1); + area.x = (int)aux; + + aux = floor (y1); + area.y = (int)aux; + + aux = ceil (x2); + area.width = (int)aux - area.x; + + aux = ceil (y2); + area.height = (int)aux - area.y; priv = BAOBAB_CHART (chart)->priv; @@ -864,7 +869,7 @@ baobab_chart_interpolate_colors (BaobabChartColor *color, void baobab_chart_get_item_color (BaobabChartColor *color, gdouble rel_position, - gint depth, + guint depth, gboolean highlighted) { gdouble intensity; @@ -880,7 +885,7 @@ baobab_chart_get_item_color (BaobabChartColor *color, *color = level_color; else { - color_number = rel_position / (100/3); + color_number = (int) (rel_position / (100.0/3.0)); next_color_number = (color_number + 1) % 6; baobab_chart_interpolate_colors (color, @@ -1162,7 +1167,7 @@ baobab_chart_query_tooltip (GtkWidget *widget, return TRUE; } -GdkPixbuf* +static GdkPixbuf* baobab_chart_get_pixbuf (GtkWidget *widget) { gint w, h; @@ -1173,7 +1178,6 @@ baobab_chart_get_pixbuf (GtkWidget *widget) w = gdk_window_get_width(gtk_widget_get_window(widget)); h = gdk_window_get_height(gtk_widget_get_window(widget)); - pixbuf = gdk_pixbuf_get_from_window ( gtk_widget_get_window (widget), 0, 0, |