diff options
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/mon-gnome.c | 22 | ||||
-rw-r--r-- | src/renderer.c | 41 | ||||
-rw-r--r-- | src/renderer.h | 3 |
4 files changed, 51 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac index f8e3b75..a65b572 100644 --- a/configure.ac +++ b/configure.ac @@ -132,10 +132,10 @@ AC_ARG_ENABLE(Werror, # we need. It's faster to just do it once during configuration. if test "x${with_gnome}" = xyes then - GNOME_PACKAGES="gtk+-2.0 libgnome-2.0 libgnomeui-2.0 pango" + GNOME_PACKAGES="gtk+-3.0 libgnome-3.0 libgnomeui-3.0 pango" elif test "x${with_gtk}" = xyes then - GNOME_PACKAGES="gtk+-2.0" + GNOME_PACKAGES="gtk+-3.0" else GNOME_PACKAGES="" fi diff --git a/src/mon-gnome.c b/src/mon-gnome.c index bfc286d..c09140c 100644 --- a/src/mon-gnome.c +++ b/src/mon-gnome.c @@ -101,7 +101,9 @@ enum { * Graphics contexts to be used to draw each particular state into the * model. **/ -GdkGC *dcc_phase_gc[DCC_PHASE_DONE]; +//GdkGC *dcc_phase_gc[DCC_PHASE_DONE]; +//TODO rename _gc to _cr +cairo_t *dcc_phase_gc[DCC_PHASE_DONE]; #if 0 @@ -453,7 +455,7 @@ static void dcc_create_state_gcs (GtkWidget *widget) { enum dcc_phase i_state; - +#if 0 for (i_state = 0; i_state < DCC_PHASE_DONE; i_state++) { dcc_phase_gc[i_state] = gdk_gc_new (widget->window); @@ -461,6 +463,16 @@ dcc_create_state_gcs (GtkWidget *widget) (GdkColor *) &task_color[i_state]); } +#else + for (i_state = 0; i_state < DCC_PHASE_DONE; i_state++) + { + GdkWindow * gdk_window = gtk_widget_get_window (widget); + dcc_phase_gc[i_state] = gdk_cairo_create(gdk_window); + gdk_cairo_set_source_color (dcc_phase_gc[i_state], + (GdkColor *) &task_color[i_state]); + + } +#endif } @@ -477,7 +489,7 @@ static void dcc_gnome_make_proc_view (GtkTreeModel *proc_model, GtkWidget *align, *proc_scroll; chart_treeview = gtk_tree_view_new_with_model (proc_model); - gtk_object_set (GTK_OBJECT (chart_treeview), + g_object_set (G_OBJECT (chart_treeview), "headers-visible", TRUE, NULL); @@ -592,9 +604,9 @@ static GtkWidget * dcc_gnome_make_mainwin (void) gtk_window_set_default_size (GTK_WINDOW (mainwin), 500, 300); /* Quit when it's closed */ - g_signal_connect (GTK_OBJECT(mainwin), "delete-event", + g_signal_connect (G_OBJECT(mainwin), "delete-event", G_CALLBACK (gtk_main_quit), NULL); - g_signal_connect (GTK_OBJECT(mainwin), "destroy", + g_signal_connect (G_OBJECT(mainwin), "destroy", G_CALLBACK (gtk_main_quit), NULL); #if GTK_CHECK_VERSION(2,2,0) diff --git a/src/renderer.c b/src/renderer.c index ca329fa..a73c8de 100644 --- a/src/renderer.c +++ b/src/renderer.c @@ -160,18 +160,17 @@ dcc_cell_renderer_chart_get_property (GObject *object, **/ static void dcc_cell_renderer_chart_render (GtkCellRenderer *cell, - GdkWindow *window, + cairo_t *cr, GtkWidget *UNUSED(widget), - GdkRectangle *UNUSED(background_area), - GdkRectangle *cell_area, - GdkRectangle *UNUSED(expose_area), + const GdkRectangle *UNUSED(background_area), + const GdkRectangle *cell_area, GtkCellRendererState UNUSED(flags)) { const struct dcc_history *history; enum dcc_phase state; int x1, y1; - int bar_height; - int bar_width; + int bar_height, bar_width; + int xpad, ypad; int i; const enum dcc_phase *phases; @@ -179,10 +178,23 @@ dcc_cell_renderer_chart_render (GtkCellRenderer *cell, history = cellchart->history; g_return_if_fail (history); /* Perhaps we should just ignore this.. */ + gtk_cell_renderer_get_padding(cell, &xpad, &ypad); + x1 = cell_area->x + xpad; + y1 = cell_area->y + ypad; + bar_height = cell_area->height - (2 * ypad); + + const GdkColor task_color[] = { + { 0, 0x9999, 0, 0 }, /* DCC_PHASE_STARTUP, accent red dark */ + { 0, 0x9999, 0, 0 }, /* DCC_PHASE_BLOCKED, accent red dark */ + { 0, 0xc1c1, 0x6666, 0x5a5a }, /* DCC_PHASE_CONNECT, red medium */ + { 0, 0x8888, 0x7f7f, 0xa3a3 }, /* DCC_PHASE_CPP, purple medium*/ + { 0, 0xe0e0, 0xc3c3, 0x9e9e }, /* DCC_PHASE_SEND, face skin medium*/ + { 0, 0x8383, 0xa6a6, 0x7f7f }, /* DCC_PHASE_COMPILE, green medium */ + { 0, 0x7575, 0x9090, 0xaeae }, /* DCC_PHASE_RECEIVE, blue medium*/ + { 0, 0, 0, 0 }, /* DCC_PHASE_DONE */ +}; + - x1 = cell_area->x + cell->xpad; - y1 = cell_area->y + cell->ypad; - bar_height = cell_area->height - (2 * cell->ypad); /* bar width is chosen such that the history roughly fills the cell (but it must be at least 1). We use the full history, not just @@ -200,10 +212,17 @@ dcc_cell_renderer_chart_render (GtkCellRenderer *cell, if (state != DCC_PHASE_DONE) { +#if 0 gdk_draw_rectangle (window, dcc_phase_gc[state], TRUE, /* fill */ x1, y1, bar_width, bar_height); +#else +gdk_cairo_set_source_color (cr, (GdkColor *) &task_color[state]); +cairo_rectangle (cr, x1, y1, bar_width, bar_height); +cairo_fill (cr); +//cairo_destroy (cr); +#endif } x1 += bar_width; @@ -216,9 +235,9 @@ dcc_cell_renderer_chart_render (GtkCellRenderer *cell, * Measure the size that we want to have allocated for this cell. */ static void -dcc_cell_renderer_chart_get_size (GtkCellRenderer *UNUSED(cell), +dcc_cell_renderer_chart_get_size (GtkCellRenderer *UNUSED (cell), GtkWidget *UNUSED (widget), - GdkRectangle *UNUSED (cell_area), + const GdkRectangle *UNUSED (cell_area), gint *UNUSED (x_offset), gint *UNUSED (y_offset), gint *UNUSED (width), diff --git a/src/renderer.h b/src/renderer.h index 8246040..4f46eef 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -43,6 +43,7 @@ GType dcc_cell_renderer_chart_get_type (void); GtkCellRenderer *dcc_cell_renderer_chart_new (void); -extern GdkGC *dcc_phase_gc[DCC_PHASE_DONE]; +//extern GdkGC *dcc_phase_gc[DCC_PHASE_DONE]; +extern cairo_t *dcc_phase_gc[DCC_PHASE_DONE]; extern const guint dcc_max_history_queue; |