Merge lp:~mhr3/unity-lens-applications/separate-scope-category into lp:unity-lens-applications

Proposed by Michal Hruby
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 358
Merged at revision: 357
Proposed branch: lp:~mhr3/unity-lens-applications/separate-scope-category
Merge into: lp:unity-lens-applications
Diff against target: 188 lines (+38/-42)
4 files modified
data/scopes.scope.in.in (+3/-3)
src/commands-scope.vala (+4/-4)
src/daemon.vala (+4/-4)
src/scopes-scope.vala (+27/-31)
To merge this branch: bzr merge lp:~mhr3/unity-lens-applications/separate-scope-category
Reviewer Review Type Date Requested Status
Paweł Stołowski (community) Needs Information
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+178808@code.launchpad.net

Commit message

Move scopes into a separate scopes category.

Description of the change

Move scopes into a separate scopes category.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Paweł Stołowski (stolowski) wrote :

90 - filter.add_option ("scopes", _("Search plugins"));

Why is this filter removed?

review: Needs Information
Revision history for this message
Michal Hruby (mhr3) wrote :

> 90 - filter.add_option ("scopes", _("Search plugins"));
>
> Why is this filter removed?

Cause there's now a separate category for it.

358. By Michal Hruby

Undo the filter removal

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/scopes.scope.in.in'
2--- data/scopes.scope.in.in 2013-08-05 09:53:58 +0000
3+++ data/scopes.scope.in.in 2013-08-08 16:22:22 +0000
4@@ -4,11 +4,11 @@
5 Module=@libdir@/unity/unity-scope-applications.so
6 ModuleType=C
7 Icon=@prefix@/share/unity/icons/lens-nav-app.svg
8-_Name=Scopes
9-_Description=This is an Ubuntu search plugin that enables information from available search plugins to be searched and displayed in the Dash underneath the Applications header. If you do not wish to search this content source, you can disable this search plugin.
10+_Name=Dash plugins
11+_Description=This is an Ubuntu search plugin that enables information from available search plugins to be searched and displayed in the Dash underneath the Dash plugins header. If you do not wish to search this content source, you can disable this search plugin.
12 Type=applications
13 _SearchHint=Search search plugins
14-OptionalMetadata=is_scope[u]
15+OptionalMetadata=scope_disabled[u]
16
17 [Desktop Entry]
18 X-Ubuntu-Gettext-Domain=unity-lens-applications
19
20=== modified file 'src/commands-scope.vala'
21--- src/commands-scope.vala 2013-07-25 08:18:39 +0000
22+++ src/commands-scope.vala 2013-08-08 16:22:22 +0000
23@@ -224,10 +224,10 @@
24
25 public override void run_async (Unity.ScopeSearchBaseCallback async_callback)
26 {
27- update_search.begin (
28- () => {
29- async_callback (this);
30- });
31+ update_search.begin (() =>
32+ {
33+ async_callback (this);
34+ });
35 }
36
37 private void add_result (Unity.ResultSet result_set, string uri,
38
39=== modified file 'src/daemon.vala'
40--- src/daemon.vala 2013-07-25 12:36:20 +0000
41+++ src/daemon.vala 2013-08-08 16:22:22 +0000
42@@ -816,10 +816,10 @@
43
44 public override void run_async (Unity.ScopeSearchBaseCallback async_callback)
45 {
46- dispatch_search.begin (
47- () => {
48- async_callback (this);
49- });
50+ dispatch_search.begin (() =>
51+ {
52+ async_callback (this);
53+ });
54 }
55
56 private async void dispatch_search ()
57
58=== modified file 'src/scopes-scope.vala'
59--- src/scopes-scope.vala 2013-08-05 09:53:58 +0000
60+++ src/scopes-scope.vala 2013-08-08 16:22:22 +0000
61@@ -34,8 +34,10 @@
62 {
63 this.appscope = appscope;
64 // Track the remote scopes
65- remote_scopes_model = new Dee.SharedModel ("com.canonical.Unity.SmartScopes.RemoteScopesModel");
66- remote_scopes_model.set_schema ("s", "s", "s", "s", "s", "as");
67+ var shared_model = new Dee.SharedModel ("com.canonical.Unity.SmartScopes.RemoteScopesModel");
68+ shared_model.set_schema ("s", "s", "s", "s", "s", "as");
69+ shared_model.end_transaction.connect (this.remote_scopes_changed);
70+ remote_scopes_model = shared_model;
71
72 scopes_index = Utils.prepare_index (remote_scopes_model,
73 RemoteScopesColumn.NAME,
74@@ -53,6 +55,11 @@
75 build_scope_index.begin ();
76 }
77
78+ private void remote_scopes_changed (uint64 begin_seqnum, uint64 end_seqnum)
79+ {
80+ this.results_invalidated (SearchType.DEFAULT);
81+ }
82+
83 private void update_disabled_scopes_hash ()
84 {
85 disabled_scope_ids.remove_all ();
86@@ -150,24 +157,8 @@
87 Unity.CategorySet categories = new Unity.CategorySet ();
88 File icon_dir = File.new_for_path (ICON_PATH);
89
90- var cat = new Unity.Category ("apps", _("Applications"),
91- new FileIcon (icon_dir.get_child ("group-apps.svg")));
92- categories.add (cat);
93-
94- cat = new Unity.Category ("recently-used", _("Recently used"),
95- new FileIcon (icon_dir.get_child ("group-recent.svg")));
96- categories.add (cat);
97-
98- cat = new Unity.Category ("recent", _("Recent apps"),
99- new FileIcon (icon_dir.get_child ("group-apps.svg")));
100- categories.add (cat);
101-
102- cat = new Unity.Category ("installed", _("Installed"),
103- new FileIcon (icon_dir.get_child ("group-installed.svg")));
104- categories.add (cat);
105-
106- cat = new Unity.Category ("more", _("More suggestions"),
107- new FileIcon (icon_dir.get_child ("group-treat-yourself.svg")));
108+ var cat = new Unity.Category ("scopes", _("Dash plugins"),
109+ new FileIcon (icon_dir.get_child ("group-installed.svg")));
110 categories.add (cat);
111
112 return categories;
113@@ -176,7 +167,7 @@
114 public override Unity.Schema get_schema ()
115 {
116 var schema = new Unity.Schema ();
117- schema.add_field ("is_scope", "u", Schema.FieldType.OPTIONAL);
118+ schema.add_field ("scope_disabled", "u", Schema.FieldType.OPTIONAL);
119 return schema;
120 }
121
122@@ -262,6 +253,13 @@
123 add_remote_results (context.search_query, context.result_set);
124 }
125
126+ public override void run_async (ScopeSearchBaseCallback callback)
127+ {
128+ // just run the matching in the origin thread, it's cheap
129+ run ();
130+ callback (this);
131+ }
132+
133 private void add_local_results (string search_query, Unity.ResultSet result_set)
134 {
135 bool has_search = !Utils.is_search_empty (search_query);
136@@ -283,8 +281,7 @@
137
138 var result = Unity.ScopeResult ();
139 result.uri = @"scope://$(info.desktop_file)";
140- result.category = info.desktop_file in scope.disabled_scope_ids ?
141- Category.AVAILABLE : Category.INSTALLED;
142+ result.category = 0;
143 result.result_type = Unity.ResultType.DEFAULT;
144 result.mimetype = "application/x-unity-scope";
145 result.title = info.application_name;
146@@ -293,7 +290,7 @@
147 result.comment = "";
148 result.dnd_uri = "";
149 result.metadata = new HashTable<string, Variant> (str_hash, str_equal);
150- result.metadata["is_scope"] = new Variant.uint32 (1);
151+ result.metadata["scope_disabled"] = new Variant.uint32 (info.desktop_file in scope.disabled_scope_ids ? 1 : 0);
152
153 var icon_hint = info.icon;
154 try
155@@ -324,8 +321,7 @@
156 unowned string scope_id =
157 scope.remote_scopes_model.get_string (iter, RemoteScopesColumn.SCOPE_ID);
158 result.uri = @"scope://$(scope_id)";
159- result.category = scope_id in scope.disabled_scope_ids ?
160- Category.AVAILABLE : Category.INSTALLED;
161+ result.category = 0;
162 result.result_type = Unity.ResultType.DEFAULT;
163 result.mimetype = "application/x-unity-scope";
164 result.title =
165@@ -333,7 +329,7 @@
166 result.comment = "";
167 result.dnd_uri = "";
168 result.metadata = new HashTable<string, Variant> (str_hash, str_equal);
169- result.metadata["is_scope"] = new Variant.uint32 (1);
170+ result.metadata["scope_disabled"] = new Variant.uint32 (scope_id in scope.disabled_scope_ids ? 1 : 0);
171
172 var icon_hint =
173 scope.remote_scopes_model.get_string (iter, RemoteScopesColumn.ICON_HINT);
174@@ -383,10 +379,10 @@
175 public override void run_async (Unity.AbstractPreviewCallback callback)
176 {
177 make_preview.begin ((obj, res) =>
178- {
179- var preview = make_preview.end (res);
180- callback (this, preview);
181- });
182+ {
183+ var preview = make_preview.end (res);
184+ callback (this, preview);
185+ });
186 }
187
188 private async Unity.AbstractPreview? make_preview ()

Subscribers

People subscribed via source and target branches