static void equalizerwin_destroyed (void) { hook_dissociate ("set equalizer_active", (HookFunction) update_from_config); hook_dissociate ("set equalizer_bands", (HookFunction) update_from_config); hook_dissociate ("set equalizer_preamp", (HookFunction) update_from_config); hook_dissociate ("playlist position", position_cb); index_free_full (equalizer_presets, (IndexFreeFunc) aud_equalizer_preset_free); index_free_full (equalizer_auto_presets, (IndexFreeFunc) aud_equalizer_preset_free); equalizer_presets = NULL; equalizer_auto_presets = NULL; }
static void equalizerwin_read_winamp_eqf(VFSFile * file) { Index * presets = aud_import_winamp_presets (file); if (! presets) { SPRINTF (error, _("Error importing Winamp EQF file '%s'"), vfs_get_filename (file)); aud_interface_show_error (error); return; } if (! index_count (presets)) goto DONE; /* just get the first preset --asphyx */ EqualizerPreset * preset = index_get (presets, 0); equalizerwin_set_preamp(preset->preamp); for (int i = 0; i < AUD_EQUALIZER_NBANDS; i ++) equalizerwin_set_band(i, preset->bands[i]); equalizerwin_eq_changed(); DONE: index_free_full (presets, (IndexFreeFunc) aud_equalizer_preset_free); }
void pw_col_init (void) { pw_num_cols = 0; char * columns = aud_get_str ("gtkui", "playlist_columns"); Index * index = str_list_to_index (columns, " "); int count = index_count (index); if (count > PW_COLS) count = PW_COLS; for (int c = 0; c < count; c ++) { char * column = index_get (index, c); int i = 0; while (i < PW_COLS && strcmp (column, pw_col_keys[i])) i ++; if (i == PW_COLS) break; pw_cols[pw_num_cols ++] = i; } index_free_full (index, (IndexFreeFunc) str_unref); str_unref (columns); }
static bool_t search_cb (GtkTreeModel * model, int column, const char * key, GtkTreeIter * iter, void * user) { GtkTreePath * path = gtk_tree_model_get_path (model, iter); g_return_val_if_fail (path, TRUE); int row = gtk_tree_path_get_indices (path)[0]; gtk_tree_path_free (path); char * title = aud_playlist_get_title (row); g_return_val_if_fail (title, TRUE); Index * keys = str_list_to_index (key, " "); int count = index_count (keys); bool_t match = FALSE; for (int i = 0; i < count; i ++) { if (strstr_nocase_utf8 (title, index_get (keys, i))) match = TRUE; else { match = FALSE; break; } } index_free_full (keys, (IndexFreeFunc) str_unref); str_unref (title); return ! match; /* TRUE == not matched, FALSE == matched */ }
static void set_search_phrase (const char * phrase) { char * folded = str_tolower_utf8 (phrase); index_free_full (search_terms, (IndexFreeFunc) str_unref); search_terms = str_list_to_index (folded, " "); str_unref (folded); }
static void close_plugin (PluginData * plugin) { g_free (plugin->path); index_free_full (plugin->controls, (IndexFreeFunc) free_control); g_array_free (plugin->in_ports, 1); g_array_free (plugin->out_ports, 1); g_slice_free (PluginData, plugin); }
char * get_associated_image_file (const char * filename) { char * image_uri = NULL; char * local = uri_to_filename (filename); char * base = local ? last_path_element (local) : NULL; if (local && base) { char * include = get_str (NULL, "cover_name_include"); char * exclude = get_str (NULL, "cover_name_exclude"); SearchParams params = { .basename = base, .include = str_list_to_index (include, ", "), .exclude = str_list_to_index (exclude, ", ") }; str_unref (include); str_unref (exclude); SNCOPY (path, local, base - 1 - local); char * image_local = fileinfo_recursive_get_image (path, & params, 0); if (image_local) image_uri = filename_to_uri (image_local); str_unref (image_local); index_free_full (params.include, (IndexFreeFunc) str_unref); index_free_full (params.exclude, (IndexFreeFunc) str_unref); } str_unref (local); return image_uri; }
static bool_t search_cb (GtkTreeModel * model, int column, const char * search, GtkTreeIter * iter, void * user) { GtkTreePath * path = gtk_tree_model_get_path (model, iter); g_return_val_if_fail (path, TRUE); int row = gtk_tree_path_get_indices (path)[0]; g_return_val_if_fail (row >= 0, TRUE); gtk_tree_path_free (path); Index * keys = str_list_to_index (search, " "); int n_keys = index_count (keys); bool_t matched = FALSE; if (n_keys) { char * s[3] = {NULL, NULL, NULL}; aud_playlist_entry_describe (((PlaylistWidgetData *) user)->list, row, & s[0], & s[1], & s[2], FALSE); for (int i = 0; i < ARRAY_LEN (s); i ++) { if (! s[i]) continue; for (int j = 0; j < n_keys;) { if (strstr_nocase_utf8 (s[i], index_get (keys, j))) { index_delete_full (keys, j, 1, (IndexFreeFunc) str_unref); n_keys --; } else j ++; } str_unref (s[i]); } matched = ! n_keys; } index_free_full (keys, (IndexFreeFunc) str_unref); return ! matched; }
static void search_cleanup (void) { hook_dissociate ("playlist add complete", add_complete_cb); hook_dissociate ("playlist scan complete", scan_complete_cb); hook_dissociate ("playlist update", playlist_update_cb); if (search_source) { g_source_remove (search_source); search_source = 0; } index_free_full (search_terms, (IndexFreeFunc) str_unref); search_terms = NULL; index_free (items); items = NULL; g_array_free (selection, TRUE); selection = NULL; destroy_added_table (); destroy_database (); }