static void budgie_media_label_dispose(GObject *object) { BudgieMediaLabel *self; self = BUDGIE_MEDIA_LABEL(object); if (self->info) { free_media_info(self->info); self->info = NULL; } /* Destruct */ G_OBJECT_CLASS (budgie_media_label_parent_class)->dispose (object); }
static void budgie_media_label_dispose(GObject *object) { BudgieMediaLabel *self; self = BUDGIE_MEDIA_LABEL(object); if (self->info) { free_media_info(self->info); /* GtkListBox actually revisits us twice sometimes.. */ self->info = NULL; } /* Destruct */ G_OBJECT_CLASS (budgie_media_label_parent_class)->dispose (object); }
/* * Do all the required steps to stop the node from accessing * tape drives in the library - Offline tape drives and then * run samd stop. If more steps are required to stop drives, * add them here. * * Return: success = 0 [or] failure = 1 */ int stopAccess2Tapes(void) { struct media_info *mout; if (library_in_mcf() && check_sam_daemon("sam-amld")) { if ((mout = collect_media_info()) != NULL) { offline_tape_drives(mout); free_media_info(mout); } } return (0); }
static void update_db(BudgieMediaView *self) { GtkIconTheme *theme; GtkListStore *model; GPtrArray *albums = NULL; GPtrArray *results = NULL; GdkPixbuf *pixbuf; GtkTreeIter iter; gchar *album = NULL; gchar *markup = NULL; MediaInfo *current; const gchar *cache; gchar *album_id = NULL, *path = NULL; int i; /* No albums */ if (!budgie_db_get_all_by_field(self->db, MEDIA_QUERY_ALBUM, &albums)) return; cache = g_get_user_cache_dir(); /* We don't *yet* support album art, use generic symbol */ theme = gtk_icon_theme_get_default(); model = gtk_list_store_new(ALBUM_COLUMNS, G_TYPE_STRING, GDK_TYPE_PIXBUF); for (i=0; i < albums->len; i++) { album = (gchar *)albums->pdata[i]; /* Try to gain at least one artist */ if (!budgie_db_search_field(self->db, MEDIA_QUERY_ALBUM, MATCH_QUERY_EXACT, album, 1, &results)) goto fail; current = results->pdata[0]; if (current->album == NULL) goto albumfail; album_id = albumart_name_for_media(current, "jpeg"); path = g_strdup_printf("%s/media-art/%s", cache, album_id); g_free(album_id); pixbuf = gdk_pixbuf_new_from_file_at_size(path, 64, 64, NULL); if (!pixbuf) pixbuf = gtk_icon_theme_load_icon(theme, "folder-music-symbolic", 64, GTK_ICON_LOOKUP_GENERIC_FALLBACK, NULL); /* Pretty label */ markup = g_markup_printf_escaped("<big><b>%s</b>\n<span color='grey'>%s</span></big>", current->album, current->artist); gtk_list_store_append(model, &iter); gtk_list_store_set(model, &iter, ALBUM_TITLE, markup, -1); gtk_list_store_set(model, &iter, ALBUM_PIXBUF, pixbuf, -1); g_object_unref(pixbuf); albumfail: free_media_info(current); g_ptr_array_free(results, TRUE); fail: g_free(album); } gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(model), ALBUM_TITLE, GTK_SORT_ASCENDING); gtk_icon_view_set_model(GTK_ICON_VIEW(self->icon_view), GTK_TREE_MODEL(model)); g_ptr_array_free(albums, TRUE); }