Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion wallpapers-ocs/wallpapers_ocs.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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<WallpaperProviderChoice> 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 {
Expand All @@ -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)
Expand Down
Loading