1 /* Gnome Music Player Client (GMPC)
2 * Copyright (C) 2004-2011 Qball Cow <qball@gmpclient.org>
3 * Project homepage: http://gmpclient.org/
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #define LOG_DOMAIN "MetaImage"
31 #include <libmpd/libmpd.h>
32 #include "gmpc-extras.h"
36 static unsigned int num_drag_targets = 4; /* skip hyperlinks for now */
37 static GtkTargetEntry data_image_drag_target[] =
39 { (gchar *)"image/jpeg", 0, 0 },
40 { (gchar *)"image/png", 0, 1 },
41 { (gchar *)"image/gif", 0, 2 },
42 { (gchar *)"text/uri-list", 0, 3},
43 { (gchar *)"_NETSCAPE_URL", 0,4},
44 { (gchar *)"x-url/http", 0,5}
53 typedef enum _GmpcMetaImageState{
67 class Gmpc:MetaImage from Gtk:Event:Box{
68 private GmpcMetaImageState state = {STATE_EMPTY};
69 private int refresh = FALSE;
70 private gulong status_signal = {0};
71 private gulong connect_signal = {0};
72 private gulong meta_id = {0};
74 private gulong metadata_force_reload = {0};
76 private gchar *image_url = {NULL};
78 private mpd_Song *song = {NULL} destroywith mpd_freeSong;
82 public int size = {64};
83 public MetaDataType image_type = {META_ALBUM_ART};
84 public MpdObj *connection= {NULL};
85 public gboolean hide_on_na = {FALSE};
86 public gboolean squared = {TRUE};
87 public gchar *no_cover_icon = {g_strdup("gmpc-no-cover")} destroywith g_free;
88 public gchar *loading_cover_icon = {g_strdup("gmpc-loading-cover")} destroywith g_free;
90 private gulong expose_id = {0};
91 public gboolean scale_up = FALSE;
93 * I want fully set/get control,so I don't use property stuff,
94 * is there a way around this?
96 public gboolean is_visible = {TRUE};
98 property INT image_type
100 blurb = "Type of the image, like artist art",
101 default_value = META_ALBUM_ART,
107 blurb = "Size of the image",
112 property BOOLEAN hide_on_na
114 blurb = "Hide the image when not available",
115 default_value = FALSE,
119 property BOOLEAN scale_up
120 (nick = "Scale image up",
121 blurb = "Scale cover art up",
122 default_value = FALSE,
126 property BOOLEAN squared
128 blurb = "Keep the widget squared",
129 default_value = TRUE,
131 public void set_no_cover_icon (self, const gchar *name)
133 if(self->no_cover_icon) {
134 q_free(self->no_cover_icon);
136 self->no_cover_icon = g_strdup(name);
138 public void set_loading_cover_icon (self, const gchar *name)
140 if(self->loading_cover_icon) {
141 q_free(self->loading_cover_icon);
143 self->loading_cover_icon = g_strdup(name);
145 public void set_squared (self, const gboolean item)
147 self->squared = item;
149 public void set_connection(self, MpdObj *conn)
151 self->connection = conn;
154 self->_priv->status_signal = g_signal_connect_swapped(G_OBJECT(gmpcconn),
156 G_CALLBACK(self_update_cover),
159 self->_priv->connect_signal = g_signal_connect_swapped(G_OBJECT(gmpcconn),
160 "connection_changed",
161 G_CALLBACK(self_connection_changed),
165 private GtkWidget *image = { (GtkWidget *)gmpc_meta_image_async_new()} ;
166 private GtkWidget *tooltip_image = { (GtkWidget *)gmpc_meta_image_async_new()} ;
170 GtkWidget *win = NULL;
171 gtk_container_add(GTK_CONTAINER(self), self->_priv->image);
172 gtk_container_set_resize_mode(GTK_CONTAINER(self), GTK_RESIZE_IMMEDIATE);
173 gtk_widget_show_all(GTK_WIDGET(self));
175 g_signal_connect_swapped(G_OBJECT(self/*->_priv->image*/), "button-press-event", G_CALLBACK(self_menu_populate_callback), self);
176 self->_priv->meta_id = g_signal_connect(G_OBJECT(gmw), "data-changed", G_CALLBACK(self_meta_callback), self);
177 gtk_widget_add_events(GTK_WIDGET(self->_priv->image), GDK_POINTER_MOTION_MASK);
178 gtk_widget_set_no_show_all(GTK_WIDGET(self),TRUE);
180 win = gtk_window_new(GTK_WINDOW_POPUP);
181 gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
182 gtk_widget_modify_bg(win, GTK_STATE_NORMAL, &(GTK_WIDGET(self)->style->black));
183 gtk_container_set_border_width(GTK_CONTAINER(win), 6);
184 gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(self->_priv->tooltip_image));
186 gtk_widget_set_tooltip_window(GTK_WIDGET(self), GTK_WINDOW(win));
187 g_signal_connect(G_OBJECT(self), "query-tooltip", G_CALLBACK(self_tooltip_query), win);
190 gboolean tooltip_query(self, gint x, gint y,gboolean keyboard_mode, GtkTooltip *tip, GtkWidget *win)
192 if(self->_priv->state == STATE_IMAGE)
194 gtk_widget_show(self->_priv->tooltip_image);
202 dispose(G:Object *obj)
204 Self *self = GMPC_METAIMAGE(obj);
205 if(self->_priv->meta_id)
207 g_signal_handler_disconnect(G_OBJECT(gmw),self->_priv->meta_id);
208 self->_priv->meta_id = 0;
210 if(self->_priv->metadata_force_reload)
212 g_signal_handler_disconnect(G_OBJECT(gmw),self->_priv->metadata_force_reload);
213 self->_priv->metadata_force_reload = 0;
215 if(self->_priv->image_url) {
216 q_free(self->_priv->image_url);
218 if(self->_priv->status_signal){
219 g_signal_handler_disconnect(G_OBJECT(gmpcconn), self->_priv->status_signal);
220 self->_priv->status_signal =0;
222 if(self->_priv->connect_signal){
223 g_signal_handler_disconnect(G_OBJECT(gmpcconn), self->_priv->connect_signal);
224 self->_priv->connect_signal=0;
230 drag_data_recieved (self,
231 GdkDragContext *context,
234 GtkSelectionData *data,
241 if(self->_priv->song)
243 if(info < num_drag_targets)
245 gchar **uri = gtk_selection_data_get_uris(data);
246 /* Only one uri is interresting */
249 gchar *path = g_filename_from_uri(uri[0], NULL, NULL);
252 if(path && gdk_pixbuf_get_file_info(path, NULL,NULL))
254 /* Create MetaData object */
255 MetaData* met = meta_data_new();
256 met->type = self->image_type;
257 met->plugin_name = g_strdup("User set");
258 met->content_type = META_DATA_CONTENT_URI;
259 meta_data_set_uri(met, path);
261 meta_data_set_entry(self->_priv->song, met);
262 /* free Metadata object */
271 gtk_drag_finish(context, found, FALSE, dnd_time);
273 /* hack to make the "delayed" image load when it gets visible"
277 expose_event(self, GdkEventExpose *event, gpointer data)
279 g_signal_handler_disconnect(G_OBJECT(self), self->_priv->expose_id);
280 self->_priv->expose_id = 0;
281 self_update_cover_from_song_delayed_real(self);
286 Gmpc:Meta:Image *new_size(int type, int size)
289 gmi->image_type = type;
293 gtk_event_box_set_visible_window(GTK_EVENT_BOX(gmi), FALSE);
294 gtk_drag_dest_set(GTK_WIDGET(gmi),
295 GTK_DEST_DEFAULT_ALL,
296 data_image_drag_target, num_drag_targets,
297 GDK_ACTION_COPY|GDK_ACTION_LINK|GDK_ACTION_DEFAULT|GDK_ACTION_MOVE);
299 g_signal_connect_swapped (G_OBJECT (gmi),"drag-data-received",
300 GTK_SIGNAL_FUNC (self_drag_data_recieved),gmi);
302 gmi->_priv->metadata_force_reload = g_signal_connect_swapped(G_OBJECT(gmw), "force-reload", G_CALLBACK(self_reload_image), gmi);
307 GtkWidget * new (int type)
310 gmi->image_type = type;
312 gtk_event_box_set_visible_window(GTK_EVENT_BOX(gmi), FALSE);
313 gtk_drag_dest_set(GTK_WIDGET(gmi),
314 GTK_DEST_DEFAULT_ALL,
315 data_image_drag_target, num_drag_targets,
316 GDK_ACTION_COPY|GDK_ACTION_LINK|GDK_ACTION_DEFAULT|GDK_ACTION_MOVE);
317 g_signal_connect_swapped (G_OBJECT (gmi),"drag-data-received",
318 GTK_SIGNAL_FUNC (self_drag_data_recieved),gmi);
319 gmi->_priv->metadata_force_reload = g_signal_connect_swapped(G_OBJECT(gmw), "force-reload", G_CALLBACK(self_reload_image), gmi);
320 return (GtkWidget *)gmi;
325 update_cover(self, MpdObj *mi, ChangedStatusType what, GmpcConnection *gc)
328 if(self->connection && what&(MPD_CST_STATE|MPD_CST_SONGID|MPD_CST_SONGPOS|MPD_CST_PLAYLIST) && self->is_visible)
330 int state = mpd_player_get_state(self->connection);
331 if(state == MPD_PLAYER_STOP || state == MPD_PLAYER_UNKNOWN)
333 self->_priv->refresh = TRUE;
334 self_set_cover_na(self);
337 mpd_Song *song = mpd_playlist_get_current_song(self->connection);
340 if( self->_priv->refresh == FALSE &&
342 self->_priv->song->artist &&
344 strcmp(song->artist, self->_priv->song->artist) == 0)
346 /* If we are artist iamge, don't update, same artist */
347 if(self->image_type == META_ARTIST_ART ) return;
348 /* If we are album, check if album matches too */
349 else if(self->image_type == META_ALBUM_ART &&
350 self->_priv->song->album && song->album &&
351 strcmp(self->_priv->song->album, song->album) == 0){
355 self_update_cover_from_song(self, song);
359 self_set_cover_na(self);
361 self->_priv->refresh = FALSE;
368 connection_changed(self,MpdObj *mi, int connect, GmpcConnection *gmpconn)
372 self_set_cover_na(self);
378 int state = mpd_player_get_state(self->connection);
379 if(state != MPD_PLAYER_STOP && state != MPD_PLAYER_UNKNOWN)
381 mpd_Song *song = mpd_playlist_get_current_song(self->connection);
383 self_update_cover_from_song(self, song);
394 update_cover_from_song(self, const mpd_Song *song)
400 if(self->_priv->song)
401 mpd_freeSong(self->_priv->song);
402 self->_priv->song = NULL;
406 self_set_cover_na(self);
409 self->_priv->song = mpd_songDup(song);
411 ret = gmpc_meta_watcher_get_meta_path(gmw,self->_priv->song, self->image_type, &met);
412 if(ret == META_DATA_FETCHING)
414 self_set_cover_fetching(self);
415 }else if (ret == META_DATA_AVAILABLE) {
416 if(met->content_type == META_DATA_CONTENT_URI) {
417 const gchar *path = meta_data_get_uri(met);
418 self_set_cover_from_path(self,path);
419 }else if (met->content_type == META_DATA_CONTENT_RAW) {
420 self_set_cover_raw(self, met->content, met->size);
422 self_set_cover_na(self);
425 self_set_cover_na(self);
434 update_cover_from_song_delayed_real(self)
437 int ret = gmpc_meta_watcher_get_meta_path(gmw,self->_priv->song, self->image_type, &met);
438 if(ret == META_DATA_FETCHING)
440 self_set_cover_fetching(self);
441 }else if (ret == META_DATA_AVAILABLE) {
442 if(met->content_type == META_DATA_CONTENT_URI) {
443 const gchar *path = meta_data_get_uri(met);
444 self_set_cover_from_path(self,path);
445 }else if (met->content_type == META_DATA_CONTENT_RAW) {
446 self_set_cover_raw(self, met->content, met->size);
448 self_set_cover_na(self);
452 self_set_cover_na(self);
463 update_cover_from_song_delayed(self, mpd_Song *song)
465 if(self->_priv->song)
466 mpd_freeSong(self->_priv->song);
468 gtk_widget_set_size_request(GTK_WIDGET(self), self->size, self->size);
469 self->_priv->song = mpd_songDup(song);
470 /* hack to make it load when it gets visible */
471 self->_priv->expose_id = g_signal_connect(G_OBJECT(self), "expose-event", G_CALLBACK(self_expose_event) , NULL);
476 meta_callback(GmpcMetaWatcher *gmv, mpd_Song *song, MetaDataType type, MetaDataResult ret, MetaData *met,gpointer data)
479 if(!song || !self || !self->_priv || !self->_priv->song)
485 if(self->image_type != type)
488 printf("aa: %i %p - %p\n", self->image_type, self->_priv->song, song);
489 if(!gmpc_meta_watcher_match_data(self->image_type, self->_priv->song, song))
496 * If mpd is stopped before the result is back, set the cover to na, and ignore the result
498 if(self->connection && mpd_player_get_state(self->connection) == MPD_PLAYER_STOP)
500 self_set_cover_na(self);
504 if(ret == META_DATA_AVAILABLE) {
505 if(met->content_type == META_DATA_CONTENT_URI) {
506 const char *path = meta_data_get_uri(met);
507 self_set_cover_from_path(self,path);
508 }else if (met->content_type == META_DATA_CONTENT_RAW) {
509 self_set_cover_raw(self, met->content, met->size);
511 self_set_cover_na(self);
512 g_log(LOG_DOMAIN, G_LOG_LEVEL_WARNING, "Method not implemented: %i", met->content_type);
514 } else if (ret == META_DATA_FETCHING) {
515 self_set_cover_fetching(self);
517 self_set_cover_na(self);
528 GError *error = NULL;
529 GdkPixbuf *pb2 = NULL;
532 if(self->_priv->state == STATE_NA) {
535 self->_priv->state = STATE_NA;
536 gmpc_meta_image_async_clear_now(GMPC_META_IMAGE_ASYNC(self->_priv->tooltip_image));
538 if(self->_priv->image_url)
540 q_free(self->_priv->image_url);
541 self->_priv->image_url = NULL;
545 gtk_widget_hide(GTK_WIDGET(self));
549 if(cfg_get_single_value_as_int_with_default(config, "metaimage", "addcase",TRUE) && self->image_type == META_ALBUM_ART){
550 pb2 = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), "stylized-no-cover", self->size, 0,&error);
553 g_log(LOG_DOMAIN, G_LOG_LEVEL_WARNING, "Following error loading stylized-no-cover: %s", error->message);
559 pb2 = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), self->no_cover_icon, self->size, 0,&error);
561 g_log(LOG_DOMAIN, G_LOG_LEVEL_WARNING, "Following error loading stylized-no-cover: %s", error->message);
570 gtk_widget_set_size_request(GTK_WIDGET(self), self->size, self->size);
572 // gtk_widget_set_size_request(GTK_WIDGET(self), gdk_pixbuf_get_width(pb2), gdk_pixbuf_get_height(pb2));
574 gmpc_meta_image_async_set_pixbuf(GMPC_META_IMAGE_ASYNC(self->_priv->image), pb2);
577 /* If failed to load an image, clear it */
578 gmpc_meta_image_async_clear_now(GMPC_META_IMAGE_ASYNC(self->_priv->image));
583 set_cover_fetching(self)
586 GError *error = NULL;
587 GdkPixbuf *pb2 = NULL;
589 if(self->_priv->state == STATE_FETCHING) {
592 self->_priv->state = STATE_FETCHING;
593 gmpc_meta_image_async_clear_now(GMPC_META_IMAGE_ASYNC(self->_priv->tooltip_image));
594 if(self->_priv->image_url)
596 q_free(self->_priv->image_url);
597 self->_priv->image_url = NULL;
601 gtk_widget_hide(GTK_WIDGET(self));
605 if(cfg_get_single_value_as_int_with_default(config, "metaimage", "addcase",TRUE) && self->image_type == META_ALBUM_ART){
606 pb2 = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), "stylized-fetching-cover", self->size, 0,&error);
608 g_log(LOG_DOMAIN, G_LOG_LEVEL_WARNING, "Following error loading stylized-no-cover: %s", error->message);
615 pb2 = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), self->loading_cover_icon, self->size, 0,&error);
617 g_log(LOG_DOMAIN, G_LOG_LEVEL_WARNING, "Following error loading stylized-no-cover: %s", error->message);
626 gtk_widget_set_size_request(GTK_WIDGET(self), self->size, self->size);
628 // gtk_widget_set_size_request(GTK_WIDGET(self), gdk_pixbuf_get_width(pb2), gdk_pixbuf_get_height(pb2));
629 gmpc_meta_image_async_clear_now(GMPC_META_IMAGE_ASYNC(self->_priv->image));
633 gmpc_meta_image_async_set_pixbuf(GMPC_META_IMAGE_ASYNC(self->_priv->image), pb2);
636 /* If failed to load an image, clear it */
637 gmpc_meta_image_async_clear_now(GMPC_META_IMAGE_ASYNC(self->_priv->image));
643 set_cover_raw(self, unsigned char *data, unsigned int size)
645 self->_priv->state = STATE_IMAGE;
646 gmpc_meta_image_async_set_from_raw(GMPC_META_IMAGE_ASYNC(self->_priv->image),data, size, self->size,
647 ((cfg_get_single_value_as_int_with_default(config, "metaimage", "addcase",TRUE) && self->image_type == META_ALBUM_ART))?
648 GMPC_MODIFICATION_TYPE_CASING:GMPC_MODIFICATION_TYPE_BORDER
652 gtk_widget_set_size_request(GTK_WIDGET(self), self->size, self->size);
656 gmpc_meta_image_async_set_from_raw(GMPC_META_IMAGE_ASYNC(self->_priv->tooltip_image),
663 set_cover_from_path(self, const gchar *path)
665 self->_priv->state = STATE_IMAGE;
667 if(self->_priv->image_url)
669 if(strcmp(path, self->_priv->image_url) == 0) {
672 q_free(self->_priv->image_url);
673 self->_priv->image_url = NULL;
675 self->_priv->image_url = g_strdup(path);
676 gmpc_meta_image_async_set_from_file(GMPC_META_IMAGE_ASYNC(self->_priv->image), self->_priv->image_url, self->size,
677 ((cfg_get_single_value_as_int_with_default(config, "metaimage", "addcase",TRUE) && self->image_type == META_ALBUM_ART))?
678 GMPC_MODIFICATION_TYPE_CASING:GMPC_MODIFICATION_TYPE_BORDER
682 gtk_widget_set_size_request(GTK_WIDGET(self), self->size, self->size);
686 gmpc_meta_image_async_set_from_file(GMPC_META_IMAGE_ASYNC(self->_priv->tooltip_image),
687 self->_priv->image_url, 350,
695 set_is_visible(self, gboolean is_visible)
697 self->is_visible = is_visible;
702 self_update_cover(self,self->connection, MPD_CST_STATE, NULL);
705 gtk_widget_hide(GTK_WIDGET(self));
713 if(self->_priv->song)
716 MetaData *met = NULL;
718 ret = gmpc_meta_watcher_get_meta_path(gmw,self->_priv->song, self->image_type|META_QUERY_NO_CACHE, &met);
719 if(ret == META_DATA_FETCHING)
721 self_set_cover_fetching(self);
722 }else if (ret == META_DATA_AVAILABLE) {
723 if(met->content_type == META_DATA_CONTENT_URI) {
724 const gchar *path = meta_data_get_uri(met);
725 self_set_cover_from_path(self,path);
726 }else if (met->content_type == META_DATA_CONTENT_RAW) {
727 self_set_cover_raw(self, met->content, met->size);
729 g_log(LOG_DOMAIN, G_LOG_LEVEL_WARNING, "Not implemented");
730 self_set_cover_na(self);
733 self_set_cover_na(self);
742 signal last NONE (POINTER)
743 void menu_populate_client(self, GtkMenu *menu)
750 menu_populate_callback(self,GdkEventButton *event, gpointer data)
752 if(self->_priv->song && event->button == 3)
754 GtkWidget *menu = gtk_menu_new();
755 GtkWidget *item = NULL;
757 self_menu_populate_client(self,GTK_MENU(menu));
759 item = gtk_image_menu_item_new_with_label(_("Refetch"));
760 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), gtk_image_new_from_stock(GTK_STOCK_REFRESH, GTK_ICON_SIZE_MENU));
761 g_signal_connect_swapped(G_OBJECT(item), "activate", G_CALLBACK(self_query_refetch),self);
762 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
764 item = gtk_image_menu_item_new_with_label(_("Select file"));
765 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU));
766 g_signal_connect_swapped(G_OBJECT(item), "activate", G_CALLBACK(self_select_file),self);
767 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
769 item = gtk_image_menu_item_new_from_stock(GTK_STOCK_CLEAR, NULL);
770 g_signal_connect_swapped(G_OBJECT(item), "activate", G_CALLBACK(self_clear_entry),self);
771 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
773 item = gtk_image_menu_item_new_with_label(_("Metadata selector"));
774 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), gtk_image_new_from_stock(GTK_STOCK_EDIT, GTK_ICON_SIZE_MENU));
775 g_signal_connect_swapped(G_OBJECT(item), "activate", G_CALLBACK(self_select_metadata_editor),self);
776 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
778 gtk_widget_show_all(menu);
779 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,NULL, NULL, event->button, event->time);
789 meta_data_clear_entry(self->_priv->song, self->image_type);
793 select_metadata_editor(self)
795 gmpc_meta_data_edit_window_new(self->_priv->song,self->image_type);
803 mpd_Song *song = mpd_songDup(self->_priv->song);
804 MetaDataType type = self->image_type;
805 GtkFileFilter *gff = gtk_file_filter_new();
806 GtkWidget *fcd = gtk_file_chooser_dialog_new(_("Select File"),NULL,
807 GTK_FILE_CHOOSER_ACTION_OPEN,
808 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
809 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
811 gtk_file_filter_set_name(gff, _("Images"));
812 gtk_file_filter_add_pixbuf_formats(gff);
813 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fcd), gff);
815 gff = gtk_file_filter_new();
816 gtk_file_filter_set_name(gff, _("All"));
817 gtk_file_filter_add_pattern(gff, "*");
818 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fcd), gff);
820 gtk_widget_show_all(fcd);
822 p = cfg_get_single_value_as_string(config, "MetaData", "image-file-chooser");
824 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(fcd), p);
827 switch(gtk_dialog_run(GTK_DIALOG(fcd)))
829 case GTK_RESPONSE_ACCEPT:
831 gchar *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fcd));
833 /* Create MetaData object */
834 MetaData* met = meta_data_new();
835 met->type = self->image_type;
836 met->plugin_name = g_strdup("User set");
837 met->content_type = META_DATA_CONTENT_URI;
838 meta_data_set_uri(met, filename);
840 meta_data_set_entry(self->_priv->song, met);
841 /* free Metadata object */
844 cfg_set_single_value_as_string(config, "MetaData", "image-file-chooser", filename);
851 gtk_widget_destroy(fcd);
859 //gmpc_meta_image_async_clear(GMPC_META_IMAGE_ASYNC(self->_priv->image));
860 gmpc_meta_image_async_clear_now(GMPC_META_IMAGE_ASYNC(self->_priv->image));
861 switch(self->_priv->state)
864 self->_priv->state = STATE_EMPTY;
865 self_set_cover_na(self);
868 self->_priv->state = STATE_EMPTY;
869 self_set_cover_fetching(self);
872 if(self->_priv->image_url)
874 gchar *temp = self->_priv->image_url;
875 self->_priv->image_url = NULL;
877 self_set_cover_from_path(self, temp);