diff options
author | waker <wakeroid@gmail.com> | 2011-10-08 13:30:01 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2011-10-08 13:30:01 +0200 |
commit | cb1c025f945fe46dab39b70712cbe4378ae24970 (patch) | |
tree | 05d617aa620119d6c424abd23fd2c0da3ab54ed5 /plugins/gtkui/plcommon.c | |
parent | 1f411a09c45a3dec70162b916688a8d7e6c16b75 (diff) |
port to GTK3 (WIP)
Diffstat (limited to 'plugins/gtkui/plcommon.c')
-rw-r--r-- | plugins/gtkui/plcommon.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/plugins/gtkui/plcommon.c b/plugins/gtkui/plcommon.c index c7b04e6d..7ba89804 100644 --- a/plugins/gtkui/plcommon.c +++ b/plugins/gtkui/plcommon.c @@ -74,7 +74,7 @@ rewrite_column_config (DdbListview *listview, const char *name) { #define ART_PADDING_HORZ 8 #define ART_PADDING_VERT 0 -void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListviewIter it, DdbListviewIter group_it, int column, int group_y, int x, int y, int width, int height) { +void draw_column_data (DdbListview *listview, cairo_t *cr, DdbListviewIter it, DdbListviewIter group_it, int column, int group_y, int x, int y, int width, int height) { const char *ctitle; int cwidth; int calign_right; @@ -89,20 +89,27 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview if (cinf->id == DB_COLUMN_ALBUM_ART) { if (theming) { +#if GTK_CHECK_VERSION(3,0,0) + cairo_rectangle (cr, x, y, width, height); + cairo_clip (cr); + gtk_paint_flat_box (gtk_widget_get_style (theme_treeview), cr, GTK_STATE_NORMAL, GTK_SHADOW_NONE, theme_treeview, "cell_even_ruled", x-1, y, width+2, height); + cairo_reset_clip (cr); +#else GdkRectangle clip = { .x = x, .y = y, .width = width, .height = height, }; - gtk_paint_flat_box (theme_treeview->style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, &clip, theme_treeview, "cell_even_ruled", x-1, y, width+2, height); + gtk_paint_flat_box (gtk_widget_get_style (theme_treeview), cr, GTK_STATE_NORMAL, GTK_SHADOW_NONE, &clip, theme_treeview, "cell_even_ruled", x-1, y, width+2, height); +#endif } else { - GdkGC *gc = gdk_gc_new (drawable); GdkColor clr; - gdk_gc_set_rgb_fg_color (gc, (gtkui_get_listview_even_row_color (&clr), &clr)); - gdk_draw_rectangle (drawable, gc, TRUE, x, y, width, height); - g_object_unref (gc); + gtkui_get_listview_even_row_color (&clr); + cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.f); + cairo_rectangle (cr, x, y, width, height); + cairo_fill (cr); } int art_width = width - ART_PADDING_HORZ * 2; int art_y = y; // dest y @@ -135,8 +142,7 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview pw = min (art_width, pw); ph -= sy; ph = min (ph, h); - gdk_draw_pixbuf (drawable, GTK_WIDGET (listview)->style->white_gc, pixbuf, 0, sy, x + ART_PADDING_HORZ, art_y, pw, ph, GDK_RGB_DITHER_NONE, 0, 0); -// gdk_draw_rectangle (drawable, GTK_WIDGET (listview)->style->black_gc, FALSE, x + ART_PADDING_HORZ, art_y, pw, ph); + // FIXME gdk_draw_pixbuf (drawable, GTK_WIDGET (listview)->style->white_gc, pixbuf, 0, sy, x + ART_PADDING_HORZ, art_y, pw, ph, GDK_RGB_DITHER_NONE, 0, 0); } g_object_unref (pixbuf); } @@ -156,7 +162,7 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview else { pixbuf = buffering16_pixbuf; } - gdk_draw_pixbuf (drawable, GTK_WIDGET (listview)->style->black_gc, pixbuf, 0, 0, x + cwidth/2 - 8, y + height/2 - 8, 16, 16, GDK_RGB_DITHER_NONE, 0, 0); + // FIXME gdk_draw_pixbuf (drawable, GTK_WIDGET (listview)->style->black_gc, pixbuf, 0, 0, x + cwidth/2 - 8, y + height/2 - 8, 16, 16, GDK_RGB_DITHER_NONE, 0, 0); } else if (it) { char text[1024]; @@ -164,10 +170,10 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview GdkColor *color = NULL; if (theming) { if (deadbeef->pl_is_selected (it)) { - color = &theme_treeview->style->text[GTK_STATE_SELECTED]; + color = >k_widget_get_style (theme_treeview)->text[GTK_STATE_SELECTED]; } else { - color = &theme_treeview->style->text[GTK_STATE_NORMAL]; + color = >k_widget_get_style (theme_treeview)->text[GTK_STATE_NORMAL]; } } else { @@ -182,7 +188,7 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview float fg[3] = {(float)color->red/0xffff, (float)color->green/0xffff, (float)color->blue/0xffff}; draw_set_fg_color (fg); - draw_init_font (GTK_WIDGET (listview)->style); + draw_init_font (gtk_widget_get_style (GTK_WIDGET (listview))); if (gtkui_embolden_current_track && it && it == playing_track) { draw_init_font_bold (); } @@ -390,7 +396,7 @@ actionitem_activate (GtkMenuItem *menuitem, #define HOOKUP_OBJECT(component,widget,name) \ g_object_set_data_full (G_OBJECT (component), name, \ - gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) + g_object_ref (widget), (GDestroyNotify) g_object_unref) static GtkWidget* @@ -404,7 +410,7 @@ find_popup (GtkWidget *widget, if (GTK_IS_MENU (widget)) parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); else - parent = widget->parent; + parent = gtk_widget_get_parent (widget); if (!parent) parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey"); if (parent == NULL) |