void cdda_store__addlist_with_mode(int mode, gpointer data) { GtkTreeIter iter_store; playlist_t * pl = playlist_get_current(); if (gtk_tree_selection_get_selected(music_select, NULL, &iter_store)) { cdda_store_addlist_iter(iter_store, pl, (GtkTreeIter *)data, mode); if (pl == playlist_get_current()) { playlist_content_changed(pl); } } }
void cdda_track__addlist_cb(gpointer data) { GtkTreeIter iter_track; playlist_t * pl = playlist_get_current(); if (gtk_tree_selection_get_selected(music_select, NULL, &iter_track)) { cdda_track_addlist_iter(iter_track, pl, NULL, (GtkTreeIter *)data); if (pl == playlist_get_current()) { playlist_content_changed(pl); } } }
gint aifp_get_number_of_songs(void) { gint num = 0; playlist_t * pl = playlist_get_current(); if (pl != NULL) { playlist_foreach_selected(pl, (void *)aifp_get_songs_info_foreach, &num); } return num; }
gint aifp_check_files(void) { playlist_t * pl = playlist_get_current(); valid_files = 0; if (pl != NULL) { playlist_foreach_selected(pl, (void *)aifp_check_files_cb_foreach, NULL); } return valid_files; }
void upload_download_songs_cb(GtkButton * button, gpointer user_data) { int n = 0; playlist_t * pl = playlist_get_current(); if (transfer_mode == UPLOAD_MODE && pl == NULL) { return; } if (transfer_mode == DOWNLOAD_MODE) { if (access(dest_dir, W_OK) == -1) { message_dialog(_("Error"), aifp_window, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, NULL, _("Cannot write to selected directory. Please select another directory.")); return; } } transfer_active = 1; gtk_widget_set_sensitive(abort_button, TRUE); gtk_widget_set_sensitive(upload_download_button, FALSE); gtk_widget_set_sensitive(close_button, FALSE); if (transfer_mode == UPLOAD_MODE) { gtk_widget_set_sensitive(mkdir_button, FALSE); } else { gtk_widget_set_sensitive(local_path_browse_button, FALSE); } gtk_widget_set_sensitive(list, FALSE); gtk_widget_set_sensitive(rndir_button, FALSE); gtk_widget_set_sensitive(rmdir_button, FALSE); if (transfer_mode == UPLOAD_MODE) { playlist_foreach_selected(pl, (void *)upload_songs_cb_foreach, &n); } else { GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(list)); gtk_tree_selection_selected_foreach(selection, (GtkTreeSelectionForeachFunc)download_songs_cb_foreach, &n); } gtk_widget_set_sensitive(abort_button, FALSE); gtk_widget_set_sensitive(close_button, TRUE); gtk_widget_set_sensitive(list, TRUE); if (!abort_pressed) { gtk_widget_set_sensitive(upload_download_button, FALSE); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbar_op), _("Done")); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbar_cf), _("Done")); } else { gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbar_op), _("Aborted...")); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar_op), 0.0); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbar_cf), _("Aborted...")); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar_cf), 0.0); gtk_widget_set_sensitive(upload_download_button, TRUE); } aifp_update_info(); gtk_widget_set_sensitive(abort_button, FALSE); gtk_widget_set_sensitive(upload_download_button, TRUE); gtk_widget_set_sensitive(close_button, TRUE); if (transfer_mode == UPLOAD_MODE) { gtk_widget_set_sensitive(mkdir_button, TRUE); } else { gtk_widget_set_sensitive(local_path_browse_button, TRUE); } gtk_widget_set_sensitive(list, TRUE); gtk_widget_set_sensitive(rndir_button, TRUE); gtk_widget_set_sensitive(rmdir_button, TRUE); gtk_widget_grab_focus(list); gtk_entry_set_text(GTK_ENTRY(aifp_file_entry), _("None")); aifp_directory_listing(NULL); aifp_update_info(); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(aifp_close_when_ready_check)) && !abort_pressed) { aifp_window_close(NULL, NULL); } abort_pressed = 0; transfer_active = 0; }
void cdda_add_to_playlist(GtkTreeIter * iter_drive, unsigned long hash) { int i = 0; GtkTreeIter iter; int target_found = 0; GtkTreeIter target_iter; playlist_t * pl = NULL; playlist_data_t * pldata = NULL; if ((pl = playlist_get_current()) == NULL) { printf("NULL\n"); return; } while (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(pl->store), &iter, NULL, i++)) { if (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(pl->store), &iter) > 0) { int j = 0; int has_cdda = 0; GtkTreeIter child; while (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(pl->store), &child, &iter, j++)) { gtk_tree_model_get(GTK_TREE_MODEL(pl->store), &child, PL_COL_DATA, &pldata, -1); if (!target_found && g_str_has_prefix(pldata->file, "CDDA ")) { has_cdda = 1; } if (cdda_hash_matches(pldata->file, hash)) { return; } } if (!target_found && !has_cdda) { target_iter = iter; target_found = 1; } } else { gtk_tree_model_get(GTK_TREE_MODEL(pl->store), &iter, PL_COL_DATA, &pldata, -1); if (!target_found && !g_str_has_prefix(pldata->file, "CDDA ")) { target_iter = iter; target_found = 1; } if (cdda_hash_matches(pldata->file, hash)) { return; } } } if (target_found) { cdda_record_addlist_iter(*iter_drive, pl, &target_iter, options.playlist_is_tree); } else { cdda_record_addlist_iter(*iter_drive, pl, NULL, options.playlist_is_tree); } playlist_content_changed(pl); }