diff options
author | Alan Fitton <alan@eth0.org.uk> | 2012-07-09 13:34:16 +0200 |
---|---|---|
committer | Alan Fitton <alan@eth0.org.uk> | 2012-07-09 13:34:16 +0200 |
commit | 87026711882826d6b67c561712bd86412585020c (patch) | |
tree | 57bd19af65f97a67ca849c1d3c875dae27259b9f | |
parent | e83f587d095bb49c494e429fcfa43d4ee3b7e047 (diff) |
Revert "make the gtk3 graph build (this was supposed to be a branch but I forgot to checkout...). some more fixes needed here."
This reverts commit e83f587d095bb49c494e429fcfa43d4ee3b7e047.
-rw-r--r-- | src/trg-main-window.c | 4 | ||||
-rw-r--r-- | src/trg-torrent-graph3.c | 28 | ||||
-rw-r--r-- | src/trg-torrent-graph3.h | 2 |
3 files changed, 16 insertions, 18 deletions
diff --git a/src/trg-main-window.c b/src/trg-main-window.c index 74ae002..ea3e342 100644 --- a/src/trg-main-window.c +++ b/src/trg-main-window.c @@ -66,11 +66,7 @@ #include "trg-trackers-tree-view.h" #include "trg-trackers-model.h" #include "trg-state-selector.h" -#if GTK_CHECK_VERSION( 3, 0, 0 ) -#include "trg-torrent-graph3.h" -#else #include "trg-torrent-graph.h" -#endif #include "trg-torrent-move-dialog.h" #include "trg-torrent-props-dialog.h" #include "trg-torrent-add-url-dialog.h" diff --git a/src/trg-torrent-graph3.c b/src/trg-torrent-graph3.c index 29b4c8e..85269bc 100644 --- a/src/trg-torrent-graph3.c +++ b/src/trg-torrent-graph3.c @@ -137,8 +137,10 @@ void trg_torrent_graph_draw_background(TrgTorrentGraph * g) (int) (1.5 * priv->graph_delx) + GRAPH_FRAME_WIDTH; gtk_widget_get_allocation(priv->disp, &allocation); - - cr = cairo_create(priv->background); + priv->background = + gdk_pixmap_new(GDK_DRAWABLE(gtk_widget_get_window(priv->disp)), + allocation.width, allocation.height, -1); + cr = gdk_cairo_create(priv->background); gdk_cairo_set_source_color(cr, &priv->style->bg[GTK_STATE_NORMAL]); cairo_paint(cr); @@ -240,20 +242,20 @@ trg_torrent_graph_configure(GtkWidget * widget, trg_torrent_graph_clear_background(g); - trg_torrent_graph_queue_draw(g); + trg_torrent_graph_draw(g); return TRUE; } static gboolean -trg_torrent_graph_draw(GtkWidget * widget, - cairo_t *context, gpointer data_ptr) +trg_torrent_graph_expose(GtkWidget * widget, + GdkEventExpose * event, gpointer data_ptr) { TrgTorrentGraph *g = TRG_TORRENT_GRAPH(data_ptr); TrgTorrentGraphPrivate *priv = TRG_TORRENT_GRAPH_GET_PRIVATE(data_ptr); - GdkWindow *window = gtk_widget_get_window(priv->disp); GtkAllocation allocation; + GdkWindow *window; cairo_t *cr; guint i, j; @@ -261,13 +263,13 @@ trg_torrent_graph_draw(GtkWidget * widget, gdouble sample_width, x_offset; if (priv->background == NULL) { - cairo_pattern_t * pattern = NULL; trg_torrent_graph_draw_background(g); - pattern = cairo_pattern_create_for_surface(priv->background); + cairo_pattern_t * pattern = cairo_pattern_create_for_surface(priv->background); gdk_window_set_background_pattern (window, pattern); cairo_pattern_destroy (pattern); } + window = gtk_widget_get_window(priv->disp); gtk_widget_get_allocation(priv->disp, &allocation); /*gdk_draw_drawable(window, priv->gc, @@ -505,7 +507,7 @@ static GObject *trg_torrent_graph_constructor(GType type, priv->speed = 1000; priv->max = 1024; - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + hbox = gtk_hbox_new(FALSE, 0); priv->label_in = gtk_label_new(NULL); priv->label_out = gtk_label_new(NULL); @@ -525,8 +527,8 @@ static GObject *trg_torrent_graph_constructor(GType type, gtk_box_set_homogeneous(GTK_BOX(object), FALSE); priv->disp = gtk_drawing_area_new(); - g_signal_connect(G_OBJECT(priv->disp), "draw", - G_CALLBACK(trg_torrent_graph_draw), object); + g_signal_connect(G_OBJECT(priv->disp), "expose_event", + G_CALLBACK(trg_torrent_graph_expose), object); g_signal_connect(G_OBJECT(priv->disp), "configure_event", G_CALLBACK(trg_torrent_graph_configure), object); @@ -571,7 +573,7 @@ TrgTorrentGraph *trg_torrent_graph_new(GtkStyle * style) return TRG_TORRENT_GRAPH(obj); } -void trg_torrent_graph_queue_draw(TrgTorrentGraph * g) +void trg_torrent_graph_draw(TrgTorrentGraph * g) { TrgTorrentGraphPrivate *priv = TRG_TORRENT_GRAPH_GET_PRIVATE(g); @@ -599,7 +601,7 @@ static gboolean trg_torrent_graph_update(gpointer user_data) trg_torrent_graph_update_net(g); if (priv->draw) - trg_torrent_graph_queue_draw(g); + trg_torrent_graph_draw(g); priv->render_counter++; diff --git a/src/trg-torrent-graph3.h b/src/trg-torrent-graph3.h index 404b29a..35eef2d 100644 --- a/src/trg-torrent-graph3.h +++ b/src/trg-torrent-graph3.h @@ -38,7 +38,7 @@ unsigned trg_torrent_graph_get_num_bars(TrgTorrentGraph * g); void trg_torrent_graph_clear_background(); -void trg_torrent_graph_queue_draw(TrgTorrentGraph * g); +void trg_torrent_graph_draw(TrgTorrentGraph * g); void trg_torrent_graph_start(TrgTorrentGraph * g); |