diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/metadata-widget.c | 134 | ||||
-rw-r--r-- | src/player-item.vala | 6 |
2 files changed, 74 insertions, 66 deletions
diff --git a/src/metadata-widget.c b/src/metadata-widget.c index a1aa860..ac8355c 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -216,60 +216,6 @@ metadata_image_expose (GtkWidget *metadata, GdkEventExpose *event, gpointer user return TRUE; } - - -static void -draw_gradient (cairo_t* cr, - GtkAllocation alloc, - CairoColorRGB rgba_start, - CairoColorRGB rgba_end) -{ - cairo_pattern_t* pattern = NULL; - cairo_rectangle (cr, - alloc.x, alloc.y, - alloc.width, alloc.height); - - cairo_clip(cr); - - cairo_move_to (cr, alloc.x , alloc.y); - cairo_line_to(cr, alloc.x + alloc.width, - alloc.y); - cairo_line_to(cr, alloc.x + alloc.width, - alloc.y + alloc.height); - cairo_line_to(cr, alloc.x, alloc.y + alloc.height); - cairo_line_to(cr, alloc.x, alloc.y); - - cairo_close_path (cr); - - cairo_set_line_width (cr, 3.0); - CairoColorRGB darkened_top_color; - CairoColorRGB light_bottom_color; - - _color_shade (&rgba_start, 0.6, &darkened_top_color); - _color_shade (&rgba_end, 0.7, &light_bottom_color); - - pattern = cairo_pattern_create_linear (alloc.x, - alloc.y, - alloc.x, - alloc.y + alloc.height); - - cairo_pattern_add_color_stop_rgba (pattern, - 0.4f, - darkened_top_color.r, - darkened_top_color.g, - darkened_top_color.b, - 1.0f); - cairo_pattern_add_color_stop_rgba (pattern, - 1.0f, - light_bottom_color.r, - light_bottom_color.g, - light_bottom_color.b, - 1.0f); - cairo_set_source (cr, pattern); - cairo_stroke (cr); - cairo_pattern_destroy (pattern); -} - static void draw_album_border(GtkWidget *metadata, gboolean selected) { @@ -299,10 +245,65 @@ draw_album_border(GtkWidget *metadata, gboolean selected) fg_normal.g = style->fg[state].green/65535.0; fg_normal.b = style->fg[state].blue/65535.0; - draw_gradient(cr, - alloc, - bg_normal, - fg_normal); + CairoColorRGB dark_top_color; + CairoColorRGB light_bottom_color; + CairoColorRGB background_color; + + _color_shade ( &bg_normal, 0.93, &background_color ); + _color_shade ( &bg_normal, 0.23, &dark_top_color ); + _color_shade ( &fg_normal, 0.55, &light_bottom_color ); + + cairo_rectangle (cr, + alloc.x, alloc.y, + alloc.width, alloc.height); + + cairo_set_line_width (cr, 1.0); + + cairo_clip ( cr ); + + cairo_move_to (cr, alloc.x, alloc.y ); + cairo_line_to (cr, alloc.x + alloc.width, + alloc.y ); + cairo_line_to ( cr, alloc.x + alloc.width, + alloc.y + alloc.height ); + cairo_line_to ( cr, alloc.x, alloc.y + alloc.height ); + cairo_line_to ( cr, alloc.x, alloc.y); + cairo_close_path (cr); + + cairo_set_source_rgba ( cr, + background_color.r, + background_color.g, + background_color.b, + 1.0 ); + + cairo_fill ( cr ); + + cairo_move_to (cr, alloc.x, alloc.y ); + cairo_line_to (cr, alloc.x + alloc.width, + alloc.y ); + + cairo_close_path (cr); + cairo_set_source_rgba ( cr, + dark_top_color.r, + dark_top_color.g, + dark_top_color.b, + 1.0 ); + + cairo_stroke ( cr ); + + cairo_move_to ( cr, alloc.x + alloc.width, + alloc.y + alloc.height ); + cairo_line_to ( cr, alloc.x, alloc.y + alloc.height ); + + cairo_close_path (cr); + cairo_set_source_rgba ( cr, + light_bottom_color.r, + light_bottom_color.g, + light_bottom_color.b, + 1.0); + + cairo_stroke ( cr ); + cairo_destroy (cr); } static void @@ -332,11 +333,20 @@ draw_album_art_placeholder(GtkWidget *metadata) pango_layout_set_font_description(layout, desc); pango_font_description_free(desc); + CairoColorRGB fg_normal, light_bottom_color; + + fg_normal.r = style->fg[0].red/65535.0; + fg_normal.g = style->fg[0].green/65535.0; + fg_normal.b = style->fg[0].blue/65535.0; + + _color_shade ( &fg_normal, 0.78, &light_bottom_color ); + + cairo_set_source_rgba (cr, - style->fg[0].red/65535.0, - style->fg[0].green/65535.0, - style->fg[0].blue/65535.0, - 0.8); + light_bottom_color.r, + light_bottom_color.g, + light_bottom_color.b, + 1.0); pango_cairo_update_layout(cr, layout); cairo_move_to (cr, alloc.x + alloc.width/6, alloc.y + alloc.height/8); diff --git a/src/player-item.vala b/src/player-item.vala index 68ae6ef..51471d1 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -87,9 +87,7 @@ public class PlayerItem : Dbusmenu.Menuitem this.property_set_bool(property, v.get_boolean()); } } - if(this.property_get_bool(MENUITEM_PROP_VISIBLE) == false){ - this.property_set_bool(MENUITEM_PROP_VISIBLE, true); - } + this.property_set_bool(MENUITEM_PROP_VISIBLE, populated(attributes)); } public bool populated(HashSet<string> attrs) @@ -97,8 +95,8 @@ public class PlayerItem : Dbusmenu.Menuitem foreach(string prop in attrs){ debug("populated ? - prop: %s", prop); int value_int = property_get_int(prop); - debug("populated ? - prop %s and value %i", prop, value_int); if(property_get_int(prop) != EMPTY){ + debug("populated - prop %s and value %i", prop, value_int); return true; } } |