aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-05-18 09:47:34 +0200
committerConor Curran <conor.curran@canonical.com>2011-05-18 09:47:34 +0200
commitc60f2a2db21477a2339ed35600d2861fc792c0a4 (patch)
treeae8477efd603b62faba216f004eaa1110a180cd4
parent15c7802a9f753b0d06e7690ae24402644cd12bfe (diff)
parent19f28a5707785dbb609a0b2185053b54a6369dfa (diff)
downloadayatana-indicator-sound-c60f2a2db21477a2339ed35600d2861fc792c0a4.tar.gz
ayatana-indicator-sound-c60f2a2db21477a2339ed35600d2861fc792c0a4.tar.bz2
ayatana-indicator-sound-c60f2a2db21477a2339ed35600d2861fc792c0a4.zip
merged the aspect ratio fix for the album art, thank you Nicolas :)
-rw-r--r--src/metadata-widget.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index a37053b..38ed529 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -106,8 +106,7 @@ metadata_widget_init (MetadataWidget *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_WIDGET(self));
gtk_box_pack_start (GTK_BOX (priv->hbox),
priv->album_art,
@@ -190,26 +189,29 @@ metadata_image_expose (GtkWidget *metadata, GdkEventExpose *event, gpointer user
if(g_string_equal(priv->image_path, priv->old_image_path) == FALSE ||
priv->theme_change_occured == TRUE){
priv->theme_change_occured = FALSE;
- GdkPixbuf* orig_pixbuf;
- orig_pixbuf = gdk_pixbuf_new_from_file(priv->image_path->str, NULL);
+ GdkPixbuf* pixbuf;
+ pixbuf = gdk_pixbuf_new_from_file_at_size(priv->image_path->str, 60, 60, NULL);
//g_debug("metadata_load_new_image -> pixbuf from %s",
// priv->image_path->str);
- if(GDK_IS_PIXBUF(orig_pixbuf) == FALSE){
+ if(GDK_IS_PIXBUF(pixbuf) == FALSE){
//g_debug("problem loading the downloaded image just use the placeholder instead");
+ gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60);
draw_album_art_placeholder(metadata);
return TRUE;
}
- GdkPixbuf* pixbuf;
- pixbuf = gdk_pixbuf_scale_simple(orig_pixbuf,60, 60, GDK_INTERP_BILINEAR);
gtk_image_set_from_pixbuf(GTK_IMAGE(priv->album_art), pixbuf);
+ gtk_widget_set_size_request(GTK_WIDGET(priv->album_art),
+ gdk_pixbuf_get_width(pixbuf),
+ gdk_pixbuf_get_height(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);
- g_object_unref(orig_pixbuf);
+ g_object_unref(pixbuf);
}
return FALSE;
}
+ gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60);
draw_album_art_placeholder(metadata);
return TRUE;
}