diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/metadata-widget.c | 33 | ||||
-rw-r--r-- | src/mpris2-controller.vala | 6 | ||||
-rw-r--r-- | src/player-controller.vala | 5 | ||||
-rw-r--r-- | src/transport-menu-item.vala | 3 | ||||
-rw-r--r-- | src/transport-widget.c | 8 |
5 files changed, 42 insertions, 13 deletions
diff --git a/src/metadata-widget.c b/src/metadata-widget.c index cbbaeff..0e8aa3b 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -511,10 +511,35 @@ static void metadata_widget_set_twin_item(MetadataWidget* self, DbusmenuMenuitem* twin_item) { - MetadataWidgetPrivate* priv = METADATA_WIDGET_GET_PRIVATE(self); - priv->twin_item = twin_item; - g_signal_connect(G_OBJECT(priv->twin_item), "property-changed", - G_CALLBACK(metadata_widget_property_update), self); + MetadataWidgetPrivate* priv = METADATA_WIDGET_GET_PRIVATE(self); + priv->twin_item = twin_item; + g_signal_connect( G_OBJECT(priv->twin_item), "property-changed", + G_CALLBACK(metadata_widget_property_update), self); + gtk_label_set_text( GTK_LABEL(priv->container_label), + dbusmenu_menuitem_property_get( priv->twin_item, + DBUSMENU_METADATA_MENUITEM_ALBUM)); + metadata_widget_style_labels( self, GTK_LABEL(priv->container_label)); + + gtk_label_set_text( GTK_LABEL(priv->piece_label), + dbusmenu_menuitem_property_get( priv->twin_item, + DBUSMENU_METADATA_MENUITEM_TITLE)); + metadata_widget_style_labels( self, GTK_LABEL(priv->piece_label)); + gtk_label_set_text( GTK_LABEL(priv->artist_label), + dbusmenu_menuitem_property_get( priv->twin_item, + DBUSMENU_METADATA_MENUITEM_ARTIST)); + metadata_widget_style_labels( self, GTK_LABEL(priv->artist_label)); + + g_string_erase(priv->image_path, 0, -1); + g_string_overwrite( priv->image_path, + 0, + dbusmenu_menuitem_property_get( priv->twin_item, + DBUSMENU_METADATA_MENUITEM_ARTURL )); + + // if its a remote image queue a redraw incase the download took too long + if (g_str_has_prefix (dbusmenu_menuitem_property_get (priv->twin_item, DBUSMENU_METADATA_MENUITEM_ARTURL ), + g_get_user_cache_dir())){ + gtk_widget_queue_draw(GTK_WIDGET(self)); + } } diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index f355d28..f440c13 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -84,7 +84,7 @@ public class Mpris2Controller : GLib.Object this.properties_interface = (FreeDesktopProperties) connection.get_object("org.freedesktop.Properties.PropertiesChanged", "/org/mpris/MediaPlayer2"); this.properties_interface.PropertiesChanged += property_changed_cb; - + } catch (DBus.Error e) { error("Problems connecting to the session bus - %s", e.message); } @@ -150,8 +150,8 @@ public class Mpris2Controller : GLib.Object } else{ update = determine_play_state(this.player.PlaybackStatus); - } - (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(update); + } + (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(update); GLib.HashTable<string, Value?> cleaned_metadata = this.clean_metadata(); this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata, MetadataMenuitem.attributes_format()); diff --git a/src/player-controller.vala b/src/player-controller.vala index ad8e989..f9cbe71 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -178,9 +178,8 @@ public class PlayerController : GLib.Object if(this.mpris_bridge.connected() == true){ this.update_state(state.CONNECTED); TitleMenuitem title = this.custom_items[widget_order.TITLE] as TitleMenuitem; - title.toggle_active_triangle(true); - TransportMenuitem transport = this.custom_items[widget_order.TRANSPORT] as TransportMenuitem; - transport.change_play_state(TransportMenuitem.state.PAUSED); + title.toggle_active_triangle(true); + this.mpris_bridge.initial_update(); } else{ this.update_state(state.DISCONNECTED); diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index 7faadb5..36429e8 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -42,6 +42,8 @@ public class TransportMenuitem : PlayerItem public void change_play_state(state update) { + debug("UPDATING THE TRANSPORT DBUSMENUITEM PLAY STATE WITH VALUE %i", + (int)update); this.property_set_int(MENUITEM_PLAY_STATE, update); } @@ -60,5 +62,4 @@ public class TransportMenuitem : PlayerItem return attrs; } - }
\ No newline at end of file diff --git a/src/transport-widget.c b/src/transport-widget.c index e7f0b4d..c16e791 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -1272,6 +1272,11 @@ transport_widget_set_twin_item(TransportWidget* self, priv->twin_item = twin_item; g_signal_connect(G_OBJECT(priv->twin_item), "property-changed", G_CALLBACK(transport_widget_property_update), self); + gint initial_state = dbusmenu_menuitem_property_get_int( twin_item, + DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE ); + g_debug("TRANSPORT WIDGET - INITIAL UPDATE = %i", initial_state); + transport_widget_toggle_play_pause( self, + (TransportWidgetState)initial_state); } /** @@ -1290,8 +1295,7 @@ transport_widget_property_update(DbusmenuMenuitem* item, gchar* property, { int update_value = g_value_get_int(value); //g_debug("transport_widget_update_state - with value %i", update_value); - transport_widget_toggle_play_pause(bar, - (TransportWidgetState)update_value); + transport_widget_toggle_play_pause(bar, (TransportWidgetState)update_value); } } |