[totem] backend: Remove dead code from OSD window
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] backend: Remove dead code from OSD window
- Date: Wed, 6 Mar 2013 22:29:32 +0000 (UTC)
commit 114ddd550bd95195e456928c8fb357212f7c042d
Author: Bastien Nocera <hadess hadess net>
Date: Wed Mar 6 22:41:56 2013 +0100
backend: Remove dead code from OSD window
Now that gnome-settings-daemon isn't shipping this code anymore,
let's remove the code that can't ever be called.
src/backend/gsd-osd-window.c | 201 ++----------------------------------------
1 files changed, 8 insertions(+), 193 deletions(-)
---
diff --git a/src/backend/gsd-osd-window.c b/src/backend/gsd-osd-window.c
index 9bcec42..6561a6f 100644
--- a/src/backend/gsd-osd-window.c
+++ b/src/backend/gsd-osd-window.c
@@ -319,137 +319,6 @@ load_pixbuf (GsdOsdDrawContext *ctx,
return pixbuf;
}
-static void
-draw_eject (cairo_t *cr,
- double _x0,
- double _y0,
- double width,
- double height)
-{
- int box_height;
- int tri_height;
- int separation;
-
- box_height = height * 0.2;
- separation = box_height / 3;
- tri_height = height - box_height - separation;
-
- cairo_rectangle (cr, _x0, _y0 + height - box_height, width, box_height);
-
- cairo_move_to (cr, _x0, _y0 + tri_height);
- cairo_rel_line_to (cr, width, 0);
- cairo_rel_line_to (cr, -width / 2, -tri_height);
- cairo_rel_line_to (cr, -width / 2, tri_height);
- cairo_close_path (cr);
- cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA);
- cairo_fill_preserve (cr);
-
- cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2);
- cairo_set_line_width (cr, 2);
- cairo_stroke (cr);
-}
-
-static void
-draw_waves (cairo_t *cr,
- double cx,
- double cy,
- double max_radius,
- int volume_level)
-{
- const int n_waves = 3;
- int last_wave;
- int i;
-
- last_wave = n_waves * volume_level / 100;
-
- for (i = 0; i < n_waves; i++) {
- double angle1;
- double angle2;
- double radius;
- double alpha;
-
- angle1 = -M_PI / 4;
- angle2 = M_PI / 4;
-
- if (i < last_wave)
- alpha = 1.0;
- else if (i > last_wave)
- alpha = 0.1;
- else alpha = 0.1 + 0.9 * (n_waves * volume_level % 100) / 100.0;
-
- radius = (i + 1) * (max_radius / n_waves);
- cairo_arc (cr, cx, cy, radius, angle1, angle2);
- cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, alpha / 2);
- cairo_set_line_width (cr, 14);
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
- cairo_stroke_preserve (cr);
-
- cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, alpha);
- cairo_set_line_width (cr, 10);
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
- cairo_stroke (cr);
- }
-}
-
-static void
-draw_cross (cairo_t *cr,
- double cx,
- double cy,
- double size)
-{
- cairo_move_to (cr, cx, cy - size/2.0);
- cairo_rel_line_to (cr, size, size);
-
- cairo_move_to (cr, cx, cy + size/2.0);
- cairo_rel_line_to (cr, size, -size);
-
- cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2);
- cairo_set_line_width (cr, 14);
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
- cairo_stroke_preserve (cr);
-
- cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA);
- cairo_set_line_width (cr, 10);
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
- cairo_stroke (cr);
-}
-
-static void
-draw_speaker (cairo_t *cr,
- double cx,
- double cy,
- double width,
- double height)
-{
- double box_width;
- double box_height;
- double _x0;
- double _y0;
-
- box_width = width / 3;
- box_height = height / 3;
-
- _x0 = cx - (width / 2) + box_width;
- _y0 = cy - box_height / 2;
-
- cairo_move_to (cr, _x0, _y0);
- cairo_rel_line_to (cr, - box_width, 0);
- cairo_rel_line_to (cr, 0, box_height);
- cairo_rel_line_to (cr, box_width, 0);
-
- cairo_line_to (cr, cx + box_width, cy + height / 2);
- cairo_rel_line_to (cr, 0, -height);
- cairo_line_to (cr, _x0, _y0);
- cairo_close_path (cr);
-
- cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA);
- cairo_fill_preserve (cr);
-
- cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2);
- cairo_set_line_width (cr, 2);
- cairo_stroke (cr);
-}
-
static gboolean
render_speaker (GsdOsdDrawContext *ctx,
cairo_t *cr,
@@ -536,7 +405,6 @@ draw_action_volume (GsdOsdDrawContext *ctx,
double volume_box_y0;
double volume_box_width;
double volume_box_height;
- gboolean res;
window_width = window_height = ctx->size;
@@ -563,56 +431,10 @@ draw_action_volume (GsdOsdDrawContext *ctx,
volume_box_y0);
#endif
- res = render_speaker (ctx,
- cr,
- icon_box_x0, icon_box_y0,
- icon_box_width, icon_box_height);
- if (! res) {
- double speaker_width;
- double speaker_height;
- double speaker_cx;
- double speaker_cy;
-
- speaker_width = icon_box_width * 0.5;
- speaker_height = icon_box_height * 0.75;
- speaker_cx = icon_box_x0 + speaker_width / 2;
- speaker_cy = icon_box_y0 + speaker_height / 2;
-
-#if 0
- g_message ("speaker box: w=%f h=%f cx=%f cy=%f",
- speaker_width,
- speaker_height,
- speaker_cx,
- speaker_cy);
-#endif
-
- /* draw speaker symbol */
- draw_speaker (cr, speaker_cx, speaker_cy, speaker_width, speaker_height);
-
- if (!ctx->volume_muted) {
- /* draw sound waves */
- double wave_x0;
- double wave_y0;
- double wave_radius;
-
- wave_x0 = window_width / 2;
- wave_y0 = speaker_cy;
- wave_radius = icon_box_width / 2;
-
- draw_waves (cr, wave_x0, wave_y0, wave_radius, ctx->volume_level);
- } else {
- /* draw 'mute' cross */
- double cross_x0;
- double cross_y0;
- double cross_size;
-
- cross_size = speaker_width * 3 / 4;
- cross_x0 = icon_box_x0 + icon_box_width - cross_size;
- cross_y0 = speaker_cy;
-
- draw_cross (cr, cross_x0, cross_y0, cross_size);
- }
- }
+ render_speaker (ctx,
+ cr,
+ icon_box_x0, icon_box_y0,
+ icon_box_width, icon_box_height);
/* draw volume meter */
draw_volume_boxes (ctx,
@@ -673,7 +495,6 @@ draw_action_custom (GsdOsdDrawContext *ctx,
double bright_box_y0;
double bright_box_width;
double bright_box_height;
- gboolean res;
window_width = window_height = ctx->size;
@@ -706,16 +527,10 @@ draw_action_custom (GsdOsdDrawContext *ctx,
bright_box_y0);
#endif
- res = render_custom (ctx,
- cr,
- icon_box_x0, icon_box_y0,
- icon_box_width, icon_box_height);
- if (!res && g_str_has_prefix (ctx->icon_name, "media-eject")) {
- /* draw eject symbol */
- draw_eject (cr,
- icon_box_x0, icon_box_y0,
- icon_box_width, icon_box_height);
- }
+ render_custom (ctx,
+ cr,
+ icon_box_x0, icon_box_y0,
+ icon_box_width, icon_box_height);
if (ctx->show_level != FALSE) {
/* draw volume meter */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]