[gnome-disk-utility] Make Benchmark dialog work in GTK3



commit 6ed3f803219192ffb5038a726111eb4f23c991c6
Author: David Zeuthen <davidz redhat com>
Date:   Mon Jan 24 13:07:30 2011 -0500

    Make Benchmark dialog work in GTK3
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 src/gdu-gtk/gdu-drive-benchmark-dialog.c |   28 ++++++++--------------------
 1 files changed, 8 insertions(+), 20 deletions(-)
---
diff --git a/src/gdu-gtk/gdu-drive-benchmark-dialog.c b/src/gdu-gtk/gdu-drive-benchmark-dialog.c
index 9f86f50..dd6b9ff 100644
--- a/src/gdu-gtk/gdu-drive-benchmark-dialog.c
+++ b/src/gdu-gtk/gdu-drive-benchmark-dialog.c
@@ -480,9 +480,9 @@ G_DEFINE_TYPE (GduDriveBenchmarkDialog, gdu_drive_benchmark_dialog, GDU_TYPE_DIA
 static gdouble is_benchmarking (GduDriveBenchmarkDialog *dialog,
                                 gdouble                 *out_progress);
 
-static gboolean on_drawing_area_expose_event (GtkWidget      *widget,
-                                              GdkEventExpose *event,
-                                              gpointer        user_data);
+static gboolean on_drawing_area_draw (GtkWidget      *widget,
+                                      cairo_t        *cr,
+                                      gpointer        user_data);
 
 static void update_dialog (GduDriveBenchmarkDialog *dialog);
 static void on_device_changed (GduDevice *device, gpointer user_data);
@@ -705,8 +705,8 @@ gdu_drive_benchmark_dialog_constructed (GObject *object)
         gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
 
         g_signal_connect (drawing_area,
-                          "expose-event",
-                          G_CALLBACK (on_drawing_area_expose_event),
+                          "draw",
+                          G_CALLBACK (on_drawing_area_draw),
                           dialog);
 
         /* set minimum size for the graph */
@@ -863,13 +863,12 @@ measure_height (cairo_t     *cr,
 }
 
 static gboolean
-on_drawing_area_expose_event (GtkWidget      *widget,
-                              GdkEventExpose *event,
-                              gpointer        user_data)
+on_drawing_area_draw (GtkWidget      *widget,
+                      cairo_t        *cr,
+                      gpointer        user_data)
 {
         GduDriveBenchmarkDialog *dialog = GDU_DRIVE_BENCHMARK_DIALOG (user_data);
         GtkAllocation allocation;
-        cairo_t *cr;
         gdouble width, height;
         gdouble gx, gy, gw, gh;
         guint n;
@@ -967,18 +966,11 @@ on_drawing_area_expose_event (GtkWidget      *widget,
         width = allocation.width;
         height = allocation.height;
 
-        cr = gdk_cairo_create (gtk_widget_get_window (widget));
-
         cairo_select_font_face (cr, "sans",
                                 CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
         cairo_set_font_size (cr, 8.0);
         cairo_set_line_width (cr, 1.0);
 
-        cairo_rectangle (cr,
-                         event->area.x, event->area.y,
-                         event->area.width, event->area.height);
-        cairo_clip (cr);
-
 #if 0
         cairo_set_source_rgb (cr, 0.25, 0.25, 0.25);
         cairo_rectangle (cr, 0, 0, width, height);
@@ -1176,10 +1168,6 @@ on_drawing_area_expose_event (GtkWidget      *widget,
                 /* TODO: draw some text saying we don't have any data */
         }
 
-
-
-        cairo_destroy (cr);
-
         g_strfreev (y_left_markers);
         g_strfreev (y_right_markers);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]