diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-07-01 18:30:00 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-07-01 18:30:00 +0100 |
commit | b1d159ec617f067753cd3a012697e94c592e2b88 (patch) | |
tree | 3a263f6570db1ffc408050b88541f7a01ab23158 | |
parent | 40a1f7e531f1a8d841fc855f2ba16b9370a272be (diff) | |
download | ayatana-indicator-sound-b1d159ec617f067753cd3a012697e94c592e2b88.tar.gz ayatana-indicator-sound-b1d159ec617f067753cd3a012697e94c592e2b88.tar.bz2 ayatana-indicator-sound-b1d159ec617f067753cd3a012697e94c592e2b88.zip |
background working correctly
-rw-r--r-- | src/metadata-widget.c | 6 | ||||
-rw-r--r-- | src/play-button.c | 52 | ||||
-rw-r--r-- | src/transport-widget.c | 1 |
3 files changed, 42 insertions, 17 deletions
diff --git a/src/metadata-widget.c b/src/metadata-widget.c index 28a3839..bb9c8a8 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -113,7 +113,7 @@ metadata_widget_init (MetadataWidget *self) gtk_misc_set_alignment(GTK_MISC(artist), (gfloat)0, (gfloat)0); gtk_label_set_width_chars(GTK_LABEL(artist), 20); - gtk_label_set_ellipsize(GTK_LABEL(artist), PANGO_ELLIPSIZE_END); + gtk_label_set_ellipsize(GTK_LABEL(artist), PANGO_ELLIPSIZE_MIDDLE); priv->artist_label = artist; // Style it up. style_artist_text(self); @@ -124,7 +124,7 @@ metadata_widget_init (MetadataWidget *self) DBUSMENU_METADATA_MENUITEM_TEXT_TITLE)); gtk_misc_set_alignment(GTK_MISC(piece), (gfloat)0, (gfloat)0); gtk_label_set_width_chars(GTK_LABEL(piece), 16); - gtk_label_set_ellipsize(GTK_LABEL(piece), PANGO_ELLIPSIZE_END); + gtk_label_set_ellipsize(GTK_LABEL(piece), PANGO_ELLIPSIZE_MIDDLE); priv->piece_label = piece; // Style it up. style_title_text(self); @@ -135,7 +135,7 @@ metadata_widget_init (MetadataWidget *self) DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM)); gtk_misc_set_alignment(GTK_MISC(container), (gfloat)0, (gfloat)0); gtk_label_set_width_chars(GTK_LABEL(container), 20); - gtk_label_set_ellipsize(GTK_LABEL(container), PANGO_ELLIPSIZE_END); + gtk_label_set_ellipsize(GTK_LABEL(container), PANGO_ELLIPSIZE_MIDDLE); priv->container_label = container; // Style it up. style_album_text(self); diff --git a/src/play-button.c b/src/play-button.c index 7db2a38..24eea0d 100644 --- a/src/play-button.c +++ b/src/play-button.c @@ -42,6 +42,8 @@ static void play_button_finalize (GObject *object); static gboolean play_button_expose (GtkWidget *button, GdkEventExpose *event); static void draw (GtkWidget* button, cairo_t *cr); +static void play_button_draw_background(cairo_t* cr, double x, double y, int width, int height, double radius); + G_DEFINE_TYPE (PlayButton, play_button, GTK_TYPE_DRAWING_AREA); @@ -104,14 +106,47 @@ play_button_expose (GtkWidget *button, GdkEventExpose *event) static void draw (GtkWidget* button, cairo_t *cr) { + int rect_width = 150; int rect_height = 30; - + double radius=40; double x= button->allocation.width/2 - rect_width/2; double y= button->allocation.height/2 -rect_height/2; - double radius=60; + + //cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); + //cairo_paint(cr); + + play_button_draw_background(cr, x, y, rect_width, rect_height, radius); + cairo_pattern_t *pat; + pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, 256.0); + cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 0, 256.0); + cairo_pattern_add_color_stop_rgba (pat, 0.4, 256, 256, 256, 160.0); + cairo_pattern_add_color_stop_rgba (pat, 0.6, 256, 256, 256, 256.0); + + cairo_set_source (cr, pat); + cairo_fill (cr); + + //int factor = 10; + //cairo_reset_clip(cr); + play_button_draw_background(cr, x+2.5, y+2.5, rect_width-5, rect_height-5, radius-5); + //cairo_translate(cr, 50, 50); + cairo_set_source_rgba (cr, 256,256,256, 15); + cairo_fill(cr); + //cairo_reset_clip(cr); + cairo_pattern_destroy (pat); + + // cr.fill() + // cr.stroke() + //cairo_set_source_rgb (cr, 1, 1, 1); + //cairo_stroke (cr); + cairo_surface_write_to_png(cairo_get_target (cr), "/tmp/foobar.png"); +} + +static void +play_button_draw_background(cairo_t* cr, double x, double y, int rect_width, int rect_height, double radius) +{ cairo_move_to(cr, x+radius, y); cairo_line_to(cr, x+rect_width-radius, y); cairo_curve_to(cr, x+rect_width, y, x+rect_width, y, x+rect_width, y+radius); @@ -125,20 +160,11 @@ draw (GtkWidget* button, cairo_t *cr) cairo_line_to(cr, x, y + radius); cairo_curve_to(cr, x, y, x, y, x + radius, y); - cairo_arc(cr, x+(rect_width/2), y+(rect_height/2), radius/2, 0, 2 * M_PI); - - cairo_set_source_rgb (cr, 1, 1, 1); - cairo_fill_preserve (cr); - - // cr.fill() - // cr.stroke() - //cairo_set_source_rgb (cr, 1, 1, 1); - //cairo_stroke (cr); - //cairo_surface_write_to_png(cairo_get_target (cr), "/tmp/foobar.png"); + cairo_arc(cr, x+(rect_width/2), y+(rect_height/2), radius/1.7, 0, 2 * M_PI); + cairo_close_path(cr); } - /** * play_button_new: * @returns: a new #PlayButton. diff --git a/src/transport-widget.c b/src/transport-widget.c index ae01c0f..648370f 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -92,7 +92,6 @@ transport_widget_init (TransportWidget *self) priv->hbox = hbox; priv->play_button = play_button_new(); - gtk_box_pack_start (GTK_BOX (priv->hbox), priv->play_button, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(twin_item), "property-changed", G_CALLBACK(transport_widget_property_update), self); |