summaryrefslogtreecommitdiff
path: root/baobab/src/baobab-chart.c
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-11-22 15:49:16 +0300
committermonsta <[email protected]>2016-11-22 15:49:16 +0300
commitea481767c4e3ec19136a5b61ad46f244a9a5ffa7 (patch)
treebbcceb1d2a0be587e7127109f57e41e9e9b43f98 /baobab/src/baobab-chart.c
parent8f9a34f003061d7c5e6cfe8a8cb64ec6e98d7c4a (diff)
downloadmate-utils-ea481767c4e3ec19136a5b61ad46f244a9a5ffa7.tar.bz2
mate-utils-ea481767c4e3ec19136a5b61ad46f244a9a5ffa7.tar.xz
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require mate-panel >= 1.17
Diffstat (limited to 'baobab/src/baobab-chart.c')
-rw-r--r--baobab/src/baobab-chart.c64
1 files changed, 0 insertions, 64 deletions
diff --git a/baobab/src/baobab-chart.c b/baobab/src/baobab-chart.c
index 03c88338..d981c773 100644
--- a/baobab/src/baobab-chart.c
+++ b/baobab/src/baobab-chart.c
@@ -35,10 +35,8 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
/* needed for floor and ceil */
#include <math.h>
-#endif
#include "baobab-chart.h"
@@ -149,11 +147,7 @@ static void baobab_chart_rows_reordered (GtkTreeModel *model,
gint *new_order,
gpointer data);
static gboolean baobab_chart_expose (GtkWidget *chart,
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr);
-#else
- GdkEventExpose *event);
-#endif
static void baobab_chart_interpolate_colors (BaobabChartColor *color,
BaobabChartColor colora,
BaobabChartColor colorb,
@@ -195,11 +189,7 @@ baobab_chart_class_init (BaobabChartClass *class)
/* GtkWidget signals */
widget_class->realize = baobab_chart_realize;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->draw = baobab_chart_expose;
-#else
- widget_class->expose_event = baobab_chart_expose;
-#endif
widget_class->size_allocate = baobab_chart_size_allocate;
widget_class->scroll_event = baobab_chart_scroll;
@@ -314,9 +304,7 @@ baobab_chart_realize (GtkWidget *widget)
gint attributes_mask;
GtkAllocation allocation;
GdkWindow *window;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *context;
-#endif
g_return_if_fail (BAOBAB_IS_CHART (widget));
@@ -332,16 +320,9 @@ baobab_chart_realize (GtkWidget *widget)
attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- attributes.colormap = gtk_widget_get_colormap (widget);
-#endif
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
-#if GTK_CHECK_VERSION (3, 0, 0)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
-#else
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-#endif
window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes,
@@ -349,15 +330,8 @@ baobab_chart_realize (GtkWidget *widget)
gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, chart);
-#if GTK_CHECK_VERSION (3, 0, 0)
context = gtk_widget_get_style_context (widget);
gtk_style_context_set_background (context, window);
-#else
- gtk_widget_style_attach (widget);
- gtk_style_set_background (gtk_widget_get_style (widget),
- window,
- GTK_STATE_NORMAL);
-#endif
gtk_widget_add_events (widget,
GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
@@ -780,15 +754,8 @@ baobab_chart_rows_reordered (GtkTreeModel *model,
}
static gboolean
-#if GTK_CHECK_VERSION (3, 0, 0)
baobab_chart_expose (GtkWidget *chart, cairo_t *cr)
-#else
-baobab_chart_expose (GtkWidget *chart, GdkEventExpose *event)
-#endif
{
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_t *cr;
-#endif
BaobabChartPrivate *priv;
gint w, h;
gdouble p, sx, sy;
@@ -796,7 +763,6 @@ baobab_chart_expose (GtkWidget *chart, GdkEventExpose *event)
GtkTreePath *current_path = NULL;
GtkAllocation allocation;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRectangle area;
gdouble x1, y1, x2, y2;
cairo_clip_extents (cr, &x1, &y1, &x2, &y2);
@@ -804,7 +770,6 @@ baobab_chart_expose (GtkWidget *chart, GdkEventExpose *event)
area.y = floor (y1);
area.width = ceil (x2) - area.x;
area.height = ceil (y2) - area.y;
-#endif
priv = BAOBAB_CHART (chart)->priv;
@@ -816,13 +781,8 @@ baobab_chart_expose (GtkWidget *chart, GdkEventExpose *event)
cr = gdk_cairo_create (gtk_widget_get_window (chart));
cairo_rectangle (cr,
-#if GTK_CHECK_VERSION (3, 0, 0)
area.x, area.y,
area.width, area.height);
-#else
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-#endif
/* there is no model we can not paint */
if ((priv->is_frozen) || (priv->model == NULL))
@@ -888,17 +848,9 @@ baobab_chart_expose (GtkWidget *chart, GdkEventExpose *event)
gtk_tree_path_free (root_path);
-#if GTK_CHECK_VERSION (3, 0, 0)
baobab_chart_draw (chart, cr, area);
-#else
- baobab_chart_draw (chart, cr, event->area);
-#endif
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
- cairo_destroy (cr);
-#endif
-
return FALSE;
}
@@ -1229,16 +1181,8 @@ baobab_chart_get_pixbuf (GtkWidget *widget)
h = gdk_window_get_height(gtk_widget_get_window(widget));
-#if GTK_CHECK_VERSION(3, 0, 0)
pixbuf = gdk_pixbuf_get_from_window (
-#else
- pixbuf = gdk_pixbuf_get_from_drawable (NULL,
-#endif
gtk_widget_get_window (widget),
-#if !GTK_CHECK_VERSION(3, 0, 0)
- gdk_colormap_get_system (),
- 0, 0,
-#endif
0, 0,
w, h);
@@ -1794,19 +1738,11 @@ baobab_chart_save_snapshot (GtkWidget *chart)
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fs_dlg), TRUE);
/* extra widget */
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- vbox = gtk_vbox_new (FALSE, 0);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (fs_dlg), vbox);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
-#else
- hbox = gtk_hbox_new (FALSE, 12);
-#endif
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 6);
label = gtk_label_new_with_mnemonic (_("_Image type:"));