aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/metadata-menu-item.vala2
-rw-r--r--src/metadata-widget.c12
-rw-r--r--src/transport-widget.c2
3 files changed, 12 insertions, 4 deletions
diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala
index be078bd..82926b1 100644
--- a/src/metadata-menu-item.vala
+++ b/src/metadata-menu-item.vala
@@ -26,7 +26,7 @@ public class MetadataMenuitem : Dbusmenu.Menuitem
public static string sanitize_image_path(string path)
{
string result = path.strip();
- if(result.contains("file:///")){
+ if(result.has_prefix("file:///")){
result = result.slice(7, result.len());
}
debug("Sanitize image path - result = %s", result);
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index 357c31a..c4d3b50 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -158,10 +158,13 @@ metadata_widget_button_release_event (GtkWidget *menuitem,
return TRUE;
}
+// TODO: Manage empty/mangled music details <unknown artist> etc.
static void
metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property,
GValue* value, gpointer userdata)
{
+ g_return_if_fail (IS_METADATA_WIDGET (userdata));
+
MetadataWidget* mitem = METADATA_WIDGET(userdata);
MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(mitem);
@@ -175,8 +178,13 @@ metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property,
gtk_label_set_text(GTK_LABEL(priv->container_label), g_value_get_string(value));
}
else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_IMAGE_PATH, property) == 0){
- priv->image_path = g_strdup(g_value_get_string(value));
- if(priv->image_path != NULL){
+ if(priv->image_path != NULL){
+ g_free(priv->image_path);
+ }
+
+ priv->image_path = g_value_dup_string(value);
+
+ if(priv->image_path != NULL){
update_album_art(mitem);
}
}
diff --git a/src/transport-widget.c b/src/transport-widget.c
index ce364e3..c53513d 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -170,7 +170,7 @@ transport_widget_button_press_event (GtkWidget *menuitem,
gboolean state = g_ascii_strcasecmp(gtk_button_get_label(GTK_BUTTON(priv->play_button)), ">") == 0;
- gtk_button_set_label(GTK_BUTTON(priv->play_button), g_strdup(transport_widget_toggle_play_label(gtk_button_get_label(GTK_BUTTON(priv->play_button)))));
+ gtk_button_set_label(GTK_BUTTON(priv->play_button), transport_widget_toggle_play_label(gtk_button_get_label(GTK_BUTTON(priv->play_button))));
GValue value = {0};
g_value_init(&value, G_TYPE_BOOLEAN);
g_debug("TransportWidget::menu_press_event - going to send value %i", state);