summaryrefslogtreecommitdiff
path: root/src/gpm-graph-widget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpm-graph-widget.c')
-rw-r--r--src/gpm-graph-widget.c81
1 files changed, 1 insertions, 80 deletions
diff --git a/src/gpm-graph-widget.c b/src/gpm-graph-widget.c
index af74ba7..a8acf46 100644
--- a/src/gpm-graph-widget.c
+++ b/src/gpm-graph-widget.c
@@ -24,6 +24,7 @@
#include <pango/pangocairo.h>
#include <glib/gi18n.h>
#include <stdlib.h>
+#include <math.h>
#include "gpm-common.h"
#include "gpm-point-obj.h"
@@ -33,10 +34,6 @@
#include "egg-color.h"
#include "egg-precision.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#include <math.h>
-#endif
-
G_DEFINE_TYPE (GpmGraphWidget, gpm_graph_widget, GTK_TYPE_DRAWING_AREA);
#define GPM_GRAPH_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_GRAPH_WIDGET, GpmGraphWidgetPrivate))
#define GPM_GRAPH_WIDGET_FONT "Sans 8"
@@ -73,11 +70,7 @@ struct GpmGraphWidgetPrivate
GPtrArray *plot_list;
};
-#if GTK_CHECK_VERSION (3, 0, 0)
static gboolean gpm_graph_widget_draw (GtkWidget *graph, cairo_t *cr);
-#else
-static gboolean gpm_graph_widget_expose (GtkWidget *graph, GdkEventExpose *event);
-#endif
static void gpm_graph_widget_finalize (GObject *object);
enum
@@ -241,11 +234,7 @@ gpm_graph_widget_class_init (GpmGraphWidgetClass *class)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
GObjectClass *object_class = G_OBJECT_CLASS (class);
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->draw = gpm_graph_widget_draw;
-#else
- widget_class->expose_event = gpm_graph_widget_expose;
-#endif
object_class->get_property = up_graph_get_property;
object_class->set_property = up_graph_set_property;
object_class->finalize = gpm_graph_widget_finalize;
@@ -1075,7 +1064,6 @@ gpm_graph_widget_legend_calculate_size (GpmGraphWidget *graph, cairo_t *cr,
return TRUE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
/**
* gpm_graph_widget_draw:
* @graph: This class instance
@@ -1111,43 +1099,6 @@ gpm_graph_widget_draw (GtkWidget *widget, cairo_t *cr)
graph->priv->box_y = 5;
gtk_widget_get_allocation (widget, &allocation);
-#else
-/**
- * gpm_graph_widget_draw_graph:
- * @graph: This class instance
- * @cr: Cairo drawing context
- *
- * Draw the complete graph, with the box, the grid, the labels and the line.
- **/
-static void
-gpm_graph_widget_draw_graph (GtkWidget *graph_widget, cairo_t *cr)
-{
- GtkAllocation allocation;
- gint legend_x = 0;
- gint legend_y = 0;
- guint legend_height = 0;
- guint legend_width = 0;
- gfloat data_x;
- gfloat data_y;
-
- GpmGraphWidget *graph = (GpmGraphWidget*) graph_widget;
- g_return_if_fail (graph != NULL);
- g_return_if_fail (GPM_IS_GRAPH_WIDGET (graph));
-
- gpm_graph_widget_legend_calculate_size (graph, cr, &legend_width, &legend_height);
- cairo_save (cr);
-
- /* we need this so we know the y text */
- if (graph->priv->autorange_x)
- gpm_graph_widget_autorange_x (graph);
- if (graph->priv->autorange_y)
- gpm_graph_widget_autorange_y (graph);
-
- graph->priv->box_x = gpm_graph_widget_get_y_label_max_width (graph, cr) + 10;
- graph->priv->box_y = 5;
-
- gtk_widget_get_allocation (graph_widget, &allocation);
-#endif
graph->priv->box_height = allocation.height - (20 + graph->priv->box_y);
/* make size adjustment for legend */
@@ -1180,38 +1131,8 @@ gpm_graph_widget_draw_graph (GtkWidget *graph_widget, cairo_t *cr)
gpm_graph_widget_draw_legend (graph, legend_x, legend_y, legend_width, legend_height);
cairo_restore (cr);
-#if GTK_CHECK_VERSION (3, 0, 0)
- return FALSE;
-#endif
-}
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
-/**
- * gpm_graph_widget_expose:
- * @graph: This class instance
- * @event: The expose event
- *
- * Just repaint the entire graph widget on expose.
- **/
-static gboolean
-gpm_graph_widget_expose (GtkWidget *graph, GdkEventExpose *event)
-{
- cairo_t *cr;
-
- /* get a cairo_t */
- cr = gdk_cairo_create (gtk_widget_get_window (graph));
- cairo_rectangle (cr,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
- cairo_clip (cr);
- ((GpmGraphWidget *)graph)->priv->cr = cr;
-
- gpm_graph_widget_draw_graph (graph, cr);
-
- cairo_destroy (cr);
return FALSE;
}
-#endif
/**
* gpm_graph_widget_new: