static void begin_add (const char * path) { int list = get_playlist (FALSE, FALSE); if (list < 0) list = create_playlist (); aud_set_str ("search-tool", "path", path); char * uri = filename_to_uri (path); g_return_if_fail (uri); if (! g_str_has_suffix (uri, "/")) { SCONCAT2 (temp, uri, "/"); str_unref (uri); uri = str_get (temp); } destroy_added_table (); added_table = g_hash_table_new_full ((GHashFunc) str_hash, (GEqualFunc) str_equal, (GDestroyNotify) str_unref, NULL); int entries = aud_playlist_entry_count (list); for (int entry = 0; entry < entries; entry ++) { char * filename = aud_playlist_entry_get_filename (list, entry); if (g_str_has_prefix (filename, uri) && ! g_hash_table_contains (added_table, filename)) { aud_playlist_entry_set_selected (list, entry, FALSE); g_hash_table_insert (added_table, filename, NULL); } else { aud_playlist_entry_set_selected (list, entry, TRUE); str_unref (filename); } } aud_playlist_delete_selected (list); aud_playlist_remove_failed (list); Index * add = index_new (); index_insert (add, -1, uri); aud_playlist_entry_insert_filtered (list, -1, add, NULL, filter_cb, NULL, FALSE); adding = TRUE; }
EXPORT GdkPixbuf * audgui_pixbuf_fallback (void) { static GdkPixbuf * fallback = NULL; if (! fallback) { const char * data_dir = aud_get_path (AUD_PATH_DATA_DIR); SCONCAT2 (path, data_dir, "/images/album.png"); fallback = gdk_pixbuf_new_from_file (path, NULL); } if (fallback) g_object_ref ((GObject *) fallback); return fallback; }