diff options
author | Conor Curran <conor.curran@canonical.com> | 2010-08-26 01:16:36 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2010-08-26 01:16:36 +0100 |
commit | b4b0e43803896c11f73da6ab83bd4504c19b98a7 (patch) | |
tree | 56bba8bacdd766ca79614fbda3679cda19b1f1b2 | |
parent | 5c225cc9608267ce25d599c279271eb5b7ee7a19 (diff) | |
parent | 99755b257b5a7ed2676065cb8f4759e750c4f1ad (diff) | |
download | ayatana-indicator-sound-b4b0e43803896c11f73da6ab83bd4504c19b98a7.tar.gz ayatana-indicator-sound-b4b0e43803896c11f73da6ab83bd4504c19b98a7.tar.bz2 ayatana-indicator-sound-b4b0e43803896c11f73da6ab83bd4504c19b98a7.zip |
merge with transport bar colour updates, rounded rectangles on album art and metadata key names updates
-rw-r--r-- | src/dbus-menu-manager.c | 6 | ||||
-rw-r--r-- | src/metadata-widget.c | 215 | ||||
-rw-r--r-- | src/mpris-controller.vala | 15 | ||||
-rw-r--r-- | src/mpris2-controller.vala | 21 | ||||
-rw-r--r-- | src/play-button.c | 64 | ||||
-rw-r--r-- | src/player-controller.vala | 15 | ||||
-rw-r--r-- | src/title-widget.c | 4 |
7 files changed, 218 insertions, 122 deletions
diff --git a/src/dbus-menu-manager.c b/src/dbus-menu-manager.c index 6f0af9e..5ea561f 100644 --- a/src/dbus-menu-manager.c +++ b/src/dbus-menu-manager.c @@ -119,7 +119,7 @@ void dbus_menu_manager_update_mute_ui(gboolean incoming_mute_value) b_all_muted = incoming_mute_value; dbusmenu_menuitem_property_set(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, - b_all_muted == FALSE ? _("Mute All") : _("Unmute")); + b_all_muted == FALSE ? _("Mute") : _("Unmute")); } @@ -190,7 +190,7 @@ static void rebuild_sound_menu(DbusmenuMenuitem *root, SoundServiceDbus *service { // Mute button mute_all_menuitem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, b_all_muted == FALSE ? _("Mute All") : _("Unmute")); + dbusmenu_menuitem_property_set(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, b_all_muted == FALSE ? _("Mute") : _("Unmute")); g_signal_connect(G_OBJECT(mute_all_menuitem), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(set_global_mute_from_ui), NULL); dbusmenu_menuitem_property_set_bool(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_ENABLED, b_sink_available); @@ -229,7 +229,7 @@ static void set_global_mute_from_ui() toggle_global_mute(b_all_muted); dbusmenu_menuitem_property_set(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, - b_all_muted == FALSE ? _("Mute All") : _("Unmute")); + b_all_muted == FALSE ? _("Mute") : _("Unmute")); } diff --git a/src/metadata-widget.c b/src/metadata-widget.c index aeef670..f600238 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -35,6 +35,7 @@ struct _MetadataWidgetPrivate GtkWidget* hbox; GtkWidget* album_art; GString* image_path; + GString* old_image_path; GtkWidget* artist_label; GtkWidget* piece_label; GtkWidget* container_label; @@ -60,12 +61,14 @@ static void metadata_widget_property_update (DbusmenuMenuitem* item, GValue* value, gpointer userdata); -static void metadata_widget_update_album_art(MetadataWidget* self); -static void metadata_widget_style_title_text(MetadataWidget* self); -static void metadata_widget_style_artist_and_album_label(MetadataWidget* self, - GtkLabel* label); +static void metadata_widget_style_labels(MetadataWidget* self, + GtkLabel* label); void metadata_widget_set_style(GtkWidget* button, GtkStyle* style); +static void image_set_from_pixbuf (GtkWidget *widget, + MetadataWidget* metadata, + GdkPixbuf *source); + G_DEFINE_TYPE (MetadataWidget, metadata_widget, GTK_TYPE_MENU_ITEM); @@ -83,7 +86,6 @@ metadata_widget_class_init (MetadataWidgetClass *klass) gobject_class->dispose = metadata_widget_dispose; gobject_class->finalize = metadata_widget_finalize; - } static void @@ -101,11 +103,12 @@ metadata_widget_init (MetadataWidget *self) // image priv->album_art = gtk_image_new(); priv->image_path = g_string_new(dbusmenu_menuitem_property_get(twin_item, DBUSMENU_METADATA_MENUITEM_ARTURL)); - + priv->old_image_path = g_string_new(""); g_debug("Metadata::At startup and image path = %s", priv->image_path->str); - metadata_widget_update_album_art(self); - g_signal_connect(priv->album_art, "expose-event", G_CALLBACK(metadata_image_expose), GTK_WIDGET(self)); + g_signal_connect(priv->album_art, "expose-event", + G_CALLBACK(metadata_image_expose), + GTK_WIDGET(self)); gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60); gtk_box_pack_start (GTK_BOX (priv->hbox), priv->album_art, FALSE, FALSE, 0); @@ -120,7 +123,7 @@ metadata_widget_init (MetadataWidget *self) gtk_misc_set_padding (GTK_MISC(artist), (gfloat)10, (gfloat)0); gtk_label_set_width_chars(GTK_LABEL(artist), 15); gtk_label_set_ellipsize(GTK_LABEL(artist), PANGO_ELLIPSIZE_MIDDLE); - metadata_widget_style_artist_and_album_label(self, GTK_LABEL(artist)); + metadata_widget_style_labels(self, GTK_LABEL(artist)); priv->artist_label = artist; // title @@ -131,8 +134,8 @@ metadata_widget_init (MetadataWidget *self) gtk_misc_set_padding (GTK_MISC(piece), (gfloat)10, (gfloat)0); gtk_label_set_width_chars(GTK_LABEL(piece), 15); gtk_label_set_ellipsize(GTK_LABEL(piece), PANGO_ELLIPSIZE_MIDDLE); + metadata_widget_style_labels(self, GTK_LABEL(piece)); priv->piece_label = piece; - metadata_widget_style_title_text(self); // container GtkWidget* container; @@ -142,7 +145,7 @@ metadata_widget_init (MetadataWidget *self) gtk_misc_set_padding (GTK_MISC(container), (gfloat)10, (gfloat)0); gtk_label_set_width_chars(GTK_LABEL(container), 15); gtk_label_set_ellipsize(GTK_LABEL(container), PANGO_ELLIPSIZE_MIDDLE); - metadata_widget_style_artist_and_album_label(self, GTK_LABEL(container)); + metadata_widget_style_labels(self, GTK_LABEL(container)); priv->container_label = container; gtk_box_pack_start (GTK_BOX (vbox), priv->piece_label, FALSE, FALSE, 0); @@ -183,9 +186,22 @@ metadata_image_expose (GtkWidget *metadata, GdkEventExpose *event, gpointer user g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE); MetadataWidget* widget = METADATA_WIDGET(user_data); MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widget); - + if(priv->image_path->len > 0){ - return FALSE; + + if(g_string_equal(priv->image_path, priv->old_image_path) == FALSE){ + GdkPixbuf* pixbuf; + pixbuf = gdk_pixbuf_new_from_file(priv->image_path->str, NULL); + g_debug("metadata_widget_expose, album art update -> pixbuf from %s", + priv->image_path->str); + pixbuf = gdk_pixbuf_scale_simple(pixbuf,60, 60, GDK_INTERP_BILINEAR); + image_set_from_pixbuf (metadata, widget, pixbuf); + g_string_erase(priv->old_image_path, 0, -1); + g_string_overwrite(priv->old_image_path, 0, priv->image_path->str); + + g_object_unref(pixbuf); + } + return FALSE; } cairo_t *cr; @@ -286,56 +302,175 @@ metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property, if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTIST, property) == 0){ gtk_label_set_text(GTK_LABEL(priv->artist_label), g_value_get_string(value)); - metadata_widget_style_artist_and_album_label(mitem, GTK_LABEL(priv->artist_label)); + metadata_widget_style_labels(mitem, GTK_LABEL(priv->artist_label)); } else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TITLE, property) == 0){ gtk_label_set_text(GTK_LABEL(priv->piece_label), g_value_get_string(value)); - metadata_widget_style_title_text(mitem); + metadata_widget_style_labels(mitem, GTK_LABEL(priv->piece_label)); } else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ALBUM, property) == 0){ gtk_label_set_text(GTK_LABEL(priv->container_label), g_value_get_string(value)); - metadata_widget_style_artist_and_album_label(mitem, GTK_LABEL(priv->container_label)); + metadata_widget_style_labels(mitem, GTK_LABEL(priv->container_label)); } else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTURL, property) == 0){ g_string_erase(priv->image_path, 0, -1); g_string_overwrite(priv->image_path, 0, g_value_get_string (value)); - metadata_widget_update_album_art(mitem); } } -static void -metadata_widget_update_album_art(MetadataWidget* self){ - MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self); - GdkPixbuf* pixbuf; - pixbuf = gdk_pixbuf_new_from_file(priv->image_path->str, NULL); - g_debug("metadata_widget_update_album_art -> pixbuf from %s", - priv->image_path->str); - pixbuf = gdk_pixbuf_scale_simple(pixbuf,60, 60, GDK_INTERP_BILINEAR); - gtk_image_set_from_pixbuf(GTK_IMAGE(priv->album_art), pixbuf); - g_object_unref(pixbuf); + +static cairo_surface_t * +surface_from_pixbuf (GdkPixbuf *pixbuf) +{ + cairo_surface_t *surface; + cairo_t *cr; + + surface = cairo_image_surface_create (gdk_pixbuf_get_has_alpha (pixbuf) ? + CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24, + gdk_pixbuf_get_width (pixbuf), + gdk_pixbuf_get_height (pixbuf)); + cr = cairo_create (surface); + gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); + cairo_paint (cr); + cairo_destroy (cr); + + return surface; } -// TODO refactor next 3 methods into one once the style has been static void -metadata_widget_style_artist_and_album_label(MetadataWidget* self, GtkLabel* label) +rounded_rectangle (cairo_t *cr, + gdouble aspect, + gdouble x, + gdouble y, + gdouble corner_radius, + gdouble width, + gdouble height) { - char* markup; - markup = g_markup_printf_escaped ("<span size=\"small\">%s</span>", - gtk_label_get_text(GTK_LABEL(label))); - gtk_label_set_markup (GTK_LABEL (label), markup); - g_free(markup); + gdouble radius; + gdouble degrees; + + radius = corner_radius / aspect; + degrees = G_PI / 180.0; + + cairo_new_sub_path (cr); + cairo_arc (cr, + x + width - radius, + y + radius, + radius, + -90 * degrees, + 0 * degrees); + cairo_arc (cr, + x + width - radius, + y + height - radius, + radius, + 0 * degrees, + 90 * degrees); + cairo_arc (cr, + x + radius, + y + height - radius, + radius, + 90 * degrees, + 180 * degrees); + cairo_arc (cr, + x + radius, + y + radius, + radius, + 180 * degrees, + 270 * degrees); + cairo_close_path (cr); } static void -metadata_widget_style_title_text(MetadataWidget* self) +image_set_from_pixbuf (GtkWidget *widget, + MetadataWidget* metadata, + GdkPixbuf *source) { - MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(self); + cairo_t *cr; + cairo_t *cr_mask; + cairo_surface_t *surface; + GdkPixmap *pixmap; + GdkPixmap *bitmask; + int w; + int h; + int frame_width; + double radius; + GdkColor color; + double r; + double g; + double b; + + MetadataWidgetPrivate* priv = METADATA_WIDGET_GET_PRIVATE(metadata); + GtkImage* image = GTK_IMAGE(priv->album_art); + frame_width = 5; + + w = gdk_pixbuf_get_width (source) + frame_width * 2; + h = gdk_pixbuf_get_height (source) + frame_width * 2; + + radius = w / 10; + + pixmap = gdk_pixmap_new (gtk_widget_get_window (widget), w, h, -1); + bitmask = gdk_pixmap_new (gtk_widget_get_window (widget), w, h, 1); + + if (gtk_widget_get_window (widget) == NULL) + return; + + cr = gdk_cairo_create (pixmap); + cr_mask = gdk_cairo_create (bitmask); + + /* setup mask */ + cairo_rectangle (cr_mask, 0, 0, w, h); + cairo_set_operator (cr_mask, CAIRO_OPERATOR_CLEAR); + cairo_fill (cr_mask); + + rounded_rectangle (cr_mask, 1.0, 0.5, 0.5, radius, w - 1, h - 1); + cairo_set_operator (cr_mask, CAIRO_OPERATOR_OVER); + cairo_set_source_rgb (cr_mask, 1, 1, 1); + cairo_fill (cr_mask); + + color = gtk_widget_get_style (GTK_WIDGET (image))->bg [GTK_STATE_NORMAL]; + r = (float)color.red / 65535.0; + g = (float)color.green / 65535.0; + b = (float)color.blue / 65535.0; + + /* set up image */ + cairo_rectangle (cr, 0, 0, w, h); + cairo_set_source_rgb (cr, r, g, b); + cairo_fill (cr); + + rounded_rectangle (cr, + 1.0, + frame_width + 0.5, + frame_width + 0.5, + radius, + w - frame_width * 2 - 1, + h - frame_width * 2 - 1); + cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 0.3); + cairo_fill_preserve (cr); + + surface = surface_from_pixbuf (source); + cairo_set_source_surface (cr, surface, frame_width, frame_width); + cairo_fill (cr); + + gtk_image_set_from_pixmap (image, pixmap, bitmask); + + cairo_surface_destroy (surface); + g_object_unref (bitmask); + g_object_unref (pixmap); + + cairo_destroy (cr_mask); + cairo_destroy (cr); +} + +// TODO refactor next 3 methods into one once the style has been +static void +metadata_widget_style_labels(MetadataWidget* self, GtkLabel* label) +{ char* markup; - markup = g_markup_printf_escaped ("<span weight=\"bold\" size=\"small\">%s</span>", - gtk_label_get_text(GTK_LABEL(priv->piece_label))); - gtk_label_set_markup (GTK_LABEL (priv->piece_label), markup); - g_free(markup); + markup = g_markup_printf_escaped ("<span size=\"smaller\">%s</span>", + gtk_label_get_text(GTK_LABEL(label))); + gtk_label_set_markup (GTK_LABEL (label), markup); + g_free(markup); } void diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index 1e1e00a..fc9eee0 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -61,10 +61,6 @@ public class MprisController : GLib.Object (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(play_state); this.owner.custom_items[PlayerController.widget_order.METADATA].update(this.mpris_player.GetMetadata(), MetadataMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.mpris_player.GetMetadata(), - ScrubMenuitem.attributes_format()); - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - scrub.update_position(this.mpris_player.PositionGet()); } public void transport_event(TransportMenuitem.action command) @@ -96,8 +92,6 @@ public class MprisController : GLib.Object double new_time_position = total_time * position/100.0; debug("new position = %f", (new_time_position * 1000)); this.mpris_player.PositionSet((int32)(new_time_position)); - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - scrub.update_position(this.mpris_player.PositionGet()); } public bool connected() @@ -117,7 +111,6 @@ public class MprisController : GLib.Object v.set_int(play_state); ht.insert("state", v); this.owner.custom_items[PlayerController.widget_order.TRANSPORT].update(ht, TransportMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(ht, ScrubMenuitem.attributes_format()); } private void onTrackChange(dynamic DBus.Object mpris_client, HashTable<string,Value?> ht) @@ -125,21 +118,13 @@ public class MprisController : GLib.Object debug("onTrackChange"); this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].reset(ScrubMenuitem.attributes_format()); - //HashTable<string, Value?> status_hash = new HashTable<string, Value?>(str_hash, str_equal); status st = this.mpris_player.GetStatus(); int play_state = st.playback; debug("GetStatusChange, about to update scrub with play state - %i", play_state); - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - scrub.update_playstate(play_state); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.mpris_player.GetMetadata(), - ScrubMenuitem.attributes_format()); this.owner.custom_items[PlayerController.widget_order.METADATA].update(ht, MetadataMenuitem.attributes_format()); debug("about to update the duration on the scrub bar"); - // temporary fix - scrub.update_position(this.mpris_player.PositionGet()); } } diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 166d7f4..df2bbd3 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -107,31 +107,20 @@ public class Mpris2Controller : GLib.Object debug("new playback state = %s", state); int p = this.determine_play_state(state); (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p); - (this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem).update_playstate(p); } Value? pos_v = changed_properties.lookup("Position"); if(pos_v != null){ int64 pos = pos_v.get_int64(); debug("new position = %i", (int)pos); - (this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem).update_position((int32)pos); } Value? meta_v = changed_properties.lookup("Metadata"); if(meta_v != null){ GLib.HashTable<string, Value?> changed_updates = clean_metadata(); - - //MetadataMenuitem meta = this.owner.custom_items[PlayerController.widget_order.METADATA] as MetadataMenuitem; - //meta.reset(MetadataMenuitem.attributes_format()); this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); this.owner.custom_items[PlayerController.widget_order.METADATA].update(changed_updates, MetadataMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].reset(ScrubMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(changed_updates, - ScrubMenuitem.attributes_format()); - - (this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem).update_playstate(this.determine_play_state(this.player.PlaybackStatus)); - } } @@ -180,8 +169,6 @@ public class Mpris2Controller : GLib.Object GLib.HashTable<string, Value?> cleaned_metadata = this.clean_metadata(); this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata, MetadataMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(cleaned_metadata, - ScrubMenuitem.attributes_format()); } public void transport_event(TransportMenuitem.action command) @@ -240,8 +227,8 @@ public class Mpris2Controller : GLib.Object DBus.ObjectPath path = new ObjectPath(v.get_string()); try{ this.player.SetPosition(path, (int64)(new_time_position)); - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - scrub.update_position(((int32)new_time_position) / 1000); + //ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; + //scrub.update_position(((int32)new_time_position) / 1000); } catch(DBus.Error e){ error("DBus Error calling the player objects SetPosition method %s", @@ -253,8 +240,8 @@ public class Mpris2Controller : GLib.Object public void onSeeked(int64 position){ debug("Seeked signal callback with pos = %i", (int)position/1000); - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - scrub.update_position((int32)position/1000); + //ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; + //scrub.update_position((int32)position/1000); } public bool connected() diff --git a/src/play-button.c b/src/play-button.c index 2f3a553..a2eaf2e 100644 --- a/src/play-button.c +++ b/src/play-button.c @@ -750,9 +750,9 @@ draw (GtkWidget* button, cairo_t *cr) X, Y + 2, RECT_WIDTH - 4, - INNER_RADIUS, - INNER_START, - INNER_END); + MIDDLE_RADIUS, + MIDDLE_START, + MIDDLE_END); if(priv->current_command == TRANSPORT_PREVIOUS){ draw_gradient (cr, @@ -774,35 +774,35 @@ draw (GtkWidget* button, cairo_t *cr) } // play/pause-background - draw_circle (cr, - X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f, - Y - ((CIRCLE_RADIUS - OUTER_RADIUS)), - CIRCLE_RADIUS, - OUTER_START, - OUTER_END); - draw_circle (cr, - X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 0.5f, - Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 0.5f, - CIRCLE_RADIUS - 0.75f, - MIDDLE_START, - MIDDLE_END); - - if(priv->current_command == TRANSPORT_PLAY_PAUSE){ - draw_circle (cr, - X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 1.5f, - Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 1.5f, - CIRCLE_RADIUS - 1.5f, - INNER_COMPRESSED_START, - INNER_COMPRESSED_END); - } - else{ - draw_circle (cr, - X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 1.5f, - Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 1.5f, - CIRCLE_RADIUS - 1.5f, - INNER_START, - INNER_END); - } + draw_circle (cr, + X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f, + Y - ((CIRCLE_RADIUS - OUTER_RADIUS)), + CIRCLE_RADIUS, + OUTER_START, + OUTER_END); + draw_circle (cr, + X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 0.5f, + Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 0.5f, + CIRCLE_RADIUS - 0.75f, + MIDDLE_START, + MIDDLE_END); + + if(priv->current_command == TRANSPORT_PLAY_PAUSE){ + draw_circle (cr, + X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 1.5f, + Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 1.5f, + CIRCLE_RADIUS - 1.5f, + INNER_COMPRESSED_START, + INNER_COMPRESSED_END); + } + else{ + draw_circle (cr, + X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f + 1.5f, + Y - ((CIRCLE_RADIUS - OUTER_RADIUS)) + 1.5f, + CIRCLE_RADIUS - 1.5f, + MIDDLE_START, + MIDDLE_END); + } // draw previous-button drop-shadow _setup (&cr_surf, &surf, PREV_WIDTH, PREV_HEIGHT); _mask_prev (cr_surf, diff --git a/src/player-controller.vala b/src/player-controller.vala index 2aa4382..3e12dce 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -23,13 +23,12 @@ using Gee; public class PlayerController : GLib.Object { - public const int WIDGET_QUANTITY = 5; + public const int WIDGET_QUANTITY = 4; public static enum widget_order{ SEPARATOR, TITLE, METADATA, - SCRUB, TRANSPORT, } @@ -114,25 +113,19 @@ public class PlayerController : GLib.Object update_state(PlayerController.state.OFFLINE); this.custom_items[widget_order.TRANSPORT].reset(TransportMenuitem.attributes_format()); this.custom_items[widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); - this.custom_items[widget_order.SCRUB].reset(ScrubMenuitem.attributes_format()); } public void update_layout() - { - + { if(this.current_state != state.CONNECTED){ this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, false); - this.custom_items[widget_order.SCRUB].property_set_bool(MENUITEM_PROP_VISIBLE, - false); this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, false); return; } this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format())); - this.custom_items[widget_order.SCRUB].property_set_bool(MENUITEM_PROP_VISIBLE, - this.custom_items[widget_order.SCRUB].populated(ScrubMenuitem.attributes_format())); this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, true); } @@ -150,10 +143,6 @@ public class PlayerController : GLib.Object MetadataMenuitem metadata_item = new MetadataMenuitem(); this.custom_items.add(metadata_item); - // Scrub item - ScrubMenuitem scrub_item = new ScrubMenuitem(this); - this.custom_items.add(scrub_item); - // Transport item TransportMenuitem transport_item = new TransportMenuitem(this); this.custom_items.add(transport_item); diff --git a/src/title-widget.c b/src/title-widget.c index 7e73f7e..e9f34d6 100644 --- a/src/title-widget.c +++ b/src/title-widget.c @@ -160,12 +160,12 @@ title_widget_style_name_text(TitleWidget* self) TitleWidgetPrivate * priv = TITLE_WIDGET_GET_PRIVATE(self); char* markup; - markup = g_markup_printf_escaped ("<span weight=\"bold\">%s</span>", + markup = g_markup_printf_escaped ("<span size=\"medium\">%s</span>", gtk_label_get_text(GTK_LABEL(priv->name))); gtk_label_set_markup (GTK_LABEL (priv->name), markup); g_free(markup); } - + /** * transport_new: * @returns: a new #TitleWidget. |