[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r18553 - gnunet-gtk/src/statistics
From: |
gnunet |
Subject: |
[GNUnet-SVN] r18553 - gnunet-gtk/src/statistics |
Date: |
Sun, 11 Dec 2011 12:23:02 +0100 |
Author: grothoff
Date: 2011-12-11 12:23:02 +0100 (Sun, 11 Dec 2011)
New Revision: 18553
Modified:
gnunet-gtk/src/statistics/gtk_statistics.c
Log:
-making code work with gtk2.x as well as gtk3.x
Modified: gnunet-gtk/src/statistics/gtk_statistics.c
===================================================================
--- gnunet-gtk/src/statistics/gtk_statistics.c 2011-12-11 11:05:29 UTC (rev
18552)
+++ gnunet-gtk/src/statistics/gtk_statistics.c 2011-12-11 11:23:02 UTC (rev
18553)
@@ -124,6 +124,21 @@
G_DEFINE_TYPE (GtkStatistics, gtk_statistics, GTK_TYPE_WIDGET)
+#if GTK_MAJOR_VERSION < 3
+static gboolean
+statistics_expose (GtkWidget *statistics,
+ GdkEventExpose *event)
+{
+ cairo_t *cr;
+
+ cr = gdk_cairo_create (statistics->window);
+ gtk_statistics_draw (statistics, cr);
+ cairo_destroy (cr);
+ return FALSE;
+}
+#endif
+
+
static void
gtk_statistics_class_init (GtkStatisticsClass *class)
{
@@ -134,7 +149,9 @@
widget_class = (GtkWidgetClass*) class;
gobject_class->finalize = gtk_statistics_finalize;
+#if GTK_MAJOR_VERSION >= 3
widget_class->draw = gtk_statistics_draw;
+#endif
g_type_class_add_private (class, sizeof (GtkStatisticsPrivate));
}
@@ -149,7 +166,9 @@
GTK_TYPE_STATISTICS,
GtkStatisticsPrivate);
priv = statistics->priv;
-
+#if GTK_MAJOR_VERSION < 3
+ g_signal_connect (statistics, "expose-event", G_CALLBACK
(statistics_expose), statistics);
+#endif
gtk_widget_set_has_window (GTK_WIDGET (statistics), FALSE);
priv->values = NULL;
priv->num_values = 0;
@@ -302,6 +321,7 @@
double rx;
double ry;
unsigned int h;
+ GtkAllocation alloc;
/* collect basic data */
xmin = UINT64_MAX;
@@ -323,8 +343,9 @@
while (0 != (xmax % 10)) xmax++;
while (0 != (xmin % 10)) xmin--;
- width = gtk_widget_get_allocated_width (widget);
- height = gtk_widget_get_allocated_height (widget);
+ gtk_widget_get_allocation (widget, &alloc);
+ width = alloc.width;
+ height = alloc.height;
/* fill with black background */
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r18553 - gnunet-gtk/src/statistics,
gnunet <=