~cjcurran/indicator-sound/notifications-moved-service-side

« back to all changes in this revision

Viewing changes to src/metadata-widget.c

  • Committer: Conor Curran
  • Date: 2011-05-18 07:47:34 UTC
  • mfrom: (237.1.2 fix-654196)
  • Revision ID: conor.curran@canonical.com-20110518074734-ub0f2bcdb4yd5jkk
merged the aspect ratio fix for the album art, thank you Nicolas :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
  
107
107
  g_signal_connect(priv->album_art, "expose-event", 
108
108
                   G_CALLBACK(metadata_image_expose),
109
 
                   GTK_WIDGET(self));   
110
 
  gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60); 
 
109
                   GTK_WIDGET(self));
111
110
  
112
111
  gtk_box_pack_start (GTK_BOX (priv->hbox),
113
112
                      priv->album_art,
190
189
    if(g_string_equal(priv->image_path, priv->old_image_path) == FALSE ||
191
190
       priv->theme_change_occured == TRUE){
192
191
      priv->theme_change_occured = FALSE;         
193
 
      GdkPixbuf* orig_pixbuf;
194
 
      orig_pixbuf = gdk_pixbuf_new_from_file(priv->image_path->str, NULL);
 
192
      GdkPixbuf* pixbuf;
 
193
      pixbuf = gdk_pixbuf_new_from_file_at_size(priv->image_path->str, 60, 60, NULL);
195
194
      //g_debug("metadata_load_new_image -> pixbuf from %s",
196
195
      //        priv->image_path->str); 
197
 
      if(GDK_IS_PIXBUF(orig_pixbuf) == FALSE){
 
196
      if(GDK_IS_PIXBUF(pixbuf) == FALSE){
198
197
        //g_debug("problem loading the downloaded image just use the placeholder instead");
 
198
        gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60);
199
199
        draw_album_art_placeholder(metadata);
200
200
        return TRUE;
201
201
      }
202
 
      GdkPixbuf* pixbuf;         
203
 
      pixbuf = gdk_pixbuf_scale_simple(orig_pixbuf,60, 60, GDK_INTERP_BILINEAR);
204
202
      gtk_image_set_from_pixbuf(GTK_IMAGE(priv->album_art), pixbuf);
 
203
      gtk_widget_set_size_request(GTK_WIDGET(priv->album_art),
 
204
                                  gdk_pixbuf_get_width(pixbuf),
 
205
                                  gdk_pixbuf_get_height(pixbuf));
 
206
 
205
207
      g_string_erase(priv->old_image_path, 0, -1);
206
208
      g_string_overwrite(priv->old_image_path, 0, priv->image_path->str);
207
209
 
208
 
      g_object_unref(pixbuf);       
209
 
      g_object_unref(orig_pixbuf);       
 
210
      g_object_unref(pixbuf);
210
211
    }
211
212
    return FALSE;       
212
213
  }
 
214
  gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60);
213
215
  draw_album_art_placeholder(metadata);
214
216
  return TRUE;
215
217
}