diff --git a/wallpapers-ocs/wallpapers_ocs.vala b/wallpapers-ocs/wallpapers_ocs.vala index 0fb898b..e8ab7fd 100644 --- a/wallpapers-ocs/wallpapers_ocs.vala +++ b/wallpapers-ocs/wallpapers_ocs.vala @@ -31,7 +31,9 @@ namespace WallpapersOcs { public bool supports_search { get { return false; } } public Provider() { base("/usr/local/bin/ncz-wallpaper-ocs"); } public async ArrayList choices(string index, Cancellable? cancel) throws Error { - return WallpaperOcs.categories(index, id); + // The browser passes an empty index; this provider fetches its own, + // same as wallpapers-bing's choices() fetching its own markets. + return WallpaperOcs.categories(yield command({helper, "index"}, cancel, 90), id); } public async WallpaperProviderResult browse(string category, string query, int page, bool refresh, Cancellable? cancel) throws Error { @@ -45,6 +47,11 @@ namespace WallpapersOcs { "--pages", "1", "--page-size", OCS_PAGE_SIZE}, cancel, 60, refresh); var result = new WallpaperProviderResult(); result.items = WallpaperOcs.items(data, network, network_category); + // items() sets owner_id to the per-network name (e.g. "pling"), + // but the registered provider id is the "ocs" aggregate -- fix + // it up here so import_card()'s provider_registry.lookup(owner_id) + // finds this provider instead of failing "not active". + foreach (var item in result.items) item.owner_id = id; var response = WallpaperOcs.document(data); var failed = response.get_member("failed_networks"); if (failed != null && failed.get_node_type() == Json.NodeType.ARRAY && failed.get_array().get_length() > 0)