gfio: use appropriate gtk signal for draw/expose of graphs
authorJens Axboe <axboe@kernel.dk>
Mon, 26 Mar 2012 17:34:15 +0000 (19:34 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 26 Mar 2012 17:34:15 +0000 (19:34 +0200)
draw on gtk3, expose_event on gtk2.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
gclient.c
gcompat.h
gfio.c

index ec12d70..c77ef14 100644 (file)
--- a/gclient.c
+++ b/gclient.c
@@ -969,7 +969,7 @@ static void gfio_show_latency_buckets(struct gfio_client *gc, GtkWidget *vbox,
        gtk_widget_set_size_request(GTK_WIDGET(drawing_area), 700, 300);
        gtk_widget_modify_bg(drawing_area, GTK_STATE_NORMAL, &gfio_color_white);
        gtk_container_add(GTK_CONTAINER(completion_vbox), drawing_area);
-       g_signal_connect(G_OBJECT(drawing_area), "expose_event", G_CALLBACK(on_expose_lat_drawing_area), ge->lat_bucket_graph);
+       g_signal_connect(G_OBJECT(drawing_area), GFIO_DRAW_EVENT, G_CALLBACK(on_expose_lat_drawing_area), ge->lat_bucket_graph);
         g_signal_connect(G_OBJECT(drawing_area), "configure_event", G_CALLBACK(on_config_lat_drawing_area), ge->lat_bucket_graph);
 
        gtk_box_pack_start(GTK_BOX(hbox), tree_view, TRUE, TRUE, 3);
@@ -1125,7 +1125,7 @@ static void gfio_show_clat_percentiles(struct gfio_client *gc,
        gtk_widget_set_size_request(GTK_WIDGET(drawing_area), 700, 300);
        gtk_widget_modify_bg(drawing_area, GTK_STATE_NORMAL, &gfio_color_white);
        gtk_container_add(GTK_CONTAINER(completion_vbox), drawing_area);
-       g_signal_connect(G_OBJECT(drawing_area), "expose_event", G_CALLBACK(on_expose_lat_drawing_area), ge->clat_graph);
+       g_signal_connect(G_OBJECT(drawing_area), GFIO_DRAW_EVENT, G_CALLBACK(on_expose_lat_drawing_area), ge->clat_graph);
        g_signal_connect(G_OBJECT(drawing_area), "configure_event", G_CALLBACK(on_config_lat_drawing_area), ge->clat_graph);
 
        gtk_box_pack_start(GTK_BOX(hbox), tree_view, TRUE, TRUE, 3);
index 66fb781..cd9602f 100644 (file)
--- a/gcompat.h
+++ b/gcompat.h
@@ -29,4 +29,10 @@ guint gtk_widget_get_allocated_width(GtkWidget *w);
 guint gtk_widget_get_allocated_height(GtkWidget *w);
 #endif
 
+#if GTK_MAJOR_VERSION == 3
+#define GFIO_DRAW_EVENT                "draw"
+#elif GTK_MAJOR_VERSION == 2
+#define GFIO_DRAW_EVENT                "expose_event"
+#endif
+
 #endif
diff --git a/gfio.c b/gfio.c
index 24783b2..559c7bd 100644 (file)
--- a/gfio.c
+++ b/gfio.c
@@ -1086,7 +1086,7 @@ static void ge_update_settings_fn(gpointer key, gpointer value, gpointer data)
        __update_graph_settings(&ge->graphs);
 
        ev = gdk_event_new(GDK_EXPOSE);
-       g_signal_emit_by_name(G_OBJECT(ge->graphs.drawing_area), "expose_event", GTK_WIDGET(ge->graphs.drawing_area), ev, &ge->graphs);
+       g_signal_emit_by_name(G_OBJECT(ge->graphs.drawing_area), GFIO_DRAW_EVENT, GTK_WIDGET(ge->graphs.drawing_area), ev, &ge->graphs);
        gdk_event_free(ev);
 }
 
@@ -1098,7 +1098,7 @@ static void update_graph_limits(void)
        __update_graph_settings(&ui->graphs);
 
        ev = gdk_event_new(GDK_EXPOSE);
-       g_signal_emit_by_name(G_OBJECT(ui->graphs.drawing_area), "expose_event", GTK_WIDGET(ui->graphs.drawing_area), ev, &ui->graphs);
+       g_signal_emit_by_name(G_OBJECT(ui->graphs.drawing_area), GFIO_DRAW_EVENT, GTK_WIDGET(ui->graphs.drawing_area), ev, &ui->graphs);
        gdk_event_free(ev);
 
        g_hash_table_foreach(ui->ge_hash, ge_update_settings_fn, NULL);
@@ -1406,7 +1406,7 @@ static GtkWidget *new_client_page(struct gui_entry *ge)
        gtk_widget_set_size_request(GTK_WIDGET(ge->graphs.drawing_area),
                DRAWING_AREA_XDIM, DRAWING_AREA_YDIM);
        gtk_widget_modify_bg(ge->graphs.drawing_area, GTK_STATE_NORMAL, &gfio_color_white);
-       g_signal_connect(G_OBJECT(ge->graphs.drawing_area), "expose_event",
+       g_signal_connect(G_OBJECT(ge->graphs.drawing_area), GFIO_DRAW_EVENT,
                                G_CALLBACK(on_expose_drawing_area), &ge->graphs);
        g_signal_connect(G_OBJECT(ge->graphs.drawing_area), "configure_event",
                                G_CALLBACK(on_config_drawing_area), &ge->graphs);
@@ -1492,7 +1492,7 @@ static GtkWidget *new_main_page(struct gui *ui)
        gtk_widget_set_size_request(GTK_WIDGET(ui->graphs.drawing_area),
                DRAWING_AREA_XDIM, DRAWING_AREA_YDIM);
        gtk_widget_modify_bg(ui->graphs.drawing_area, GTK_STATE_NORMAL, &gfio_color_white);
-       g_signal_connect(G_OBJECT(ui->graphs.drawing_area), "expose_event",
+       g_signal_connect(G_OBJECT(ui->graphs.drawing_area), GFIO_DRAW_EVENT,
                        G_CALLBACK(on_expose_drawing_area), &ui->graphs);
        g_signal_connect(G_OBJECT(ui->graphs.drawing_area), "configure_event",
                        G_CALLBACK(on_config_drawing_area), &ui->graphs);