2
* Copyright (C) 2011 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by Alex Launi <alex.launi@canonical.com>
22
namespace Unity.MusicLens {
24
public class MusicStoreScopeProxy : SimpleScope
26
private MusicStoreCollection collection;
28
public MusicStoreScopeProxy ()
32
scope = new Unity.Scope ("/com/canonical/unity/scope/musicstore");
33
scope.search_in_global = false;
34
scope.activate_uri.connect (activate);
38
collection = new MusicStoreCollection ();
42
} catch (GLib.IOError e) {
43
stdout.printf (e.message);
47
protected override int num_results_without_search { get { return 100; } }
48
protected override int num_results_global_search { get { return 20; } }
49
protected override int num_results_lens_search { get { return 50; } }
51
public Unity.ActivationResponse activate (string uri)
53
/* launch the music store streaming client or the webstore or whatevz */
55
AppInfo.launch_default_for_uri (uri, null);
56
} catch (GLib.Error e) {
57
warning ("Failed to open uri %s. %s", uri, e.message);
59
return new Unity.ActivationResponse (Unity.HandledType.HIDE_DASH);
62
public override void perform_search (LensSearch? search, Dee.Model results_model,
63
List<FilterParser> filters, int max_results = -1)
65
if (search_is_invalid (search))
69
debug ("model has %u rows before search", results_model.get_n_rows ());
70
collection.search (search, results_model, filters, max_results);
71
debug ("model has %u rows after search", results_model.get_n_rows ());
73
warning ("Failed to search for '%s': %s", search.search_string, e.message);