179
165
UserWidgetPrivate * priv = USER_WIDGET_GET_PRIVATE(meta);
181
167
// Draw dot only when user is the current user.
182
if (!dbusmenu_menuitem_property_get_bool (priv->twin_item,
183
USER_ITEM_PROP_IS_CURRENT_USER)){
189
style = gtk_widget_get_style (widget);
191
GtkAllocation allocation;
192
gtk_widget_get_allocation (widget, &allocation);
193
x = allocation.x + 13;
194
y = allocation.height / 2;
196
cairo_arc (cr, x, y, 3.0, 0.0, 2 * G_PI);
198
cairo_set_source_rgb (cr, style->fg[gtk_widget_get_state(widget)].red/65535.0,
199
style->fg[gtk_widget_get_state(widget)].green/65535.0,
200
style->fg[gtk_widget_get_state(widget)].blue/65535.0);
207
user_widget_draw_usericon_gtk_3 (GtkWidget *widget,
211
g_return_val_if_fail(IS_USER_WIDGET(user_data), FALSE);
212
UserWidget* meta = USER_WIDGET(user_data);
213
UserWidgetPrivate * priv = USER_WIDGET_GET_PRIVATE(meta);
215
if (priv->using_personal_icon)
168
if (dbusmenu_menuitem_property_get_bool (priv->twin_item, USER_ITEM_PROP_IS_CURRENT_USER))
217
draw_album_border (widget, FALSE);
171
GtkStyle * style = gtk_widget_get_style (widget);
173
GtkAllocation allocation;
174
gtk_widget_get_allocation (widget, &allocation);
175
x = allocation.x + 13;
176
y = allocation.height / 2;
178
cairo_arc (cr, x, y, 3.0, 0.0, 2 * G_PI);
180
cairo_set_source_rgb (cr, style->fg[gtk_widget_get_state(widget)].red/65535.0,
181
style->fg[gtk_widget_get_state(widget)].green/65535.0,
182
style->fg[gtk_widget_get_state(widget)].blue/65535.0);
224
draw_album_border(GtkWidget *widg, gboolean selected)
227
cr = gdk_cairo_create (gtk_widget_get_window (widg));
228
gtk_style_context_add_class (gtk_widget_get_style_context (widg),
232
style = gtk_widget_get_style (widg);
235
gtk_widget_get_allocation (widg, &alloc);
239
alloc.width = alloc.width + (offset * 2);
240
alloc.height = alloc.height - v_offset - 2;
241
alloc.x = alloc.x - offset;
242
alloc.y = alloc.y + v_offset/2 +1;
244
CairoColorRGB bg_normal, fg_normal;
246
bg_normal.r = style->bg[0].red/65535.0;
247
bg_normal.g = style->bg[0].green/65535.0;
248
bg_normal.b = style->bg[0].blue/65535.0;
250
gint state = selected ? 5 : 0;
252
fg_normal.r = style->fg[state].red/65535.0;
253
fg_normal.g = style->fg[state].green/65535.0;
254
fg_normal.b = style->fg[state].blue/65535.0;
256
CairoColorRGB dark_top_color;
257
CairoColorRGB light_bottom_color;
258
CairoColorRGB background_color;
260
_color_shade ( &bg_normal, 0.93, &background_color );
261
_color_shade ( &bg_normal, 0.23, &dark_top_color );
262
_color_shade ( &fg_normal, 0.55, &light_bottom_color );
266
alloc.width, alloc.height);
268
cairo_set_line_width (cr, 1.0);
272
cairo_move_to (cr, alloc.x, alloc.y );
273
cairo_line_to (cr, alloc.x + alloc.width,
275
cairo_line_to ( cr, alloc.x + alloc.width,
276
alloc.y + alloc.height );
277
cairo_line_to ( cr, alloc.x, alloc.y + alloc.height );
278
cairo_line_to ( cr, alloc.x, alloc.y);
279
cairo_close_path (cr);
281
cairo_set_source_rgba ( cr,
289
cairo_move_to (cr, alloc.x, alloc.y );
290
cairo_line_to (cr, alloc.x + alloc.width,
293
cairo_close_path (cr);
294
cairo_set_source_rgba ( cr,
302
cairo_move_to ( cr, alloc.x + alloc.width,
303
alloc.y + alloc.height );
304
cairo_line_to ( cr, alloc.x, alloc.y + alloc.height );
306
cairo_close_path (cr);
307
cairo_set_source_rgba ( cr,
308
light_bottom_color.r,
309
light_bottom_color.g,
310
light_bottom_color.b,
318
_color_rgb_to_hls (gdouble *r,
361
if (fabs (max-min) < 0.0001)
369
s = (max-min)/(max+min);
371
s = (max-min)/(2-max-min);
373
delta = (max -min) != 0 ? (max -min) : 1;
378
h = (green-blue)/delta;
379
else if (green == max)
380
h = 2+(blue-red)/delta;
381
else if (blue == max)
382
h = 4+(red-green)/delta;
395
_color_hls_to_rgb (gdouble *h,
408
if (lightness <= 0.5)
409
m2 = lightness*(1+saturation);
411
m2 = lightness+saturation-lightness*saturation;
430
r = m1+(m2-m1)*hue/60;
434
r = m1+(m2-m1)*(240-hue)/60;
445
g = m1+(m2-m1)*hue/60;
449
g = m1+(m2-m1)*(240-hue)/60;
460
b = m1+(m2-m1)*hue/60;
464
b = m1+(m2-m1)*(240-hue)/60;
475
_color_shade (const CairoColorRGB *a, float k, CairoColorRGB *b)
493
_color_rgb_to_hls (&red, &green, &blue);
498
else if (green < 0.0)
507
_color_hls_to_rgb (&red, &green, &blue);