Merge lp:~alecu/unity-scope-click/start-apps-dash into lp:unity-scope-click

Proposed by Alejandro J. Cura
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 50
Merged at revision: 50
Proposed branch: lp:~alecu/unity-scope-click/start-apps-dash
Merge into: lp:unity-scope-click
Diff against target: 170 lines (+13/-85)
3 files modified
src/click-interface.vala (+0/-55)
src/click-scope.vala (+13/-12)
src/test-click-webservice.vala (+0/-18)
To merge this branch: bzr merge lp:~alecu/unity-scope-click/start-apps-dash
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Roberto Alsina (community) Approve
Review via email: mp+186899@code.launchpad.net

Commit message

Let the dash launch the apps

Description of the change

Let the dash launch the apps

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
Roberto Alsina (ralsina) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
http://jenkins.qa.ubuntu.com/job/unity-scope-click-autolanding/24/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-scope-click-saucy-amd64-autolanding/24
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-scope-click-saucy-armhf-autolanding/21

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/click-interface.vala'
--- src/click-interface.vala 2013-09-03 21:08:38 +0000
+++ src/click-interface.vala 2013-09-21 00:10:47 +0000
@@ -23,11 +23,6 @@
23 const string ARG_DESKTOP_FILE_HINT = "--desktop_file_hint";23 const string ARG_DESKTOP_FILE_HINT = "--desktop_file_hint";
24 delegate void ProcessManifestFunc (Json.Object manifest);24 delegate void ProcessManifestFunc (Json.Object manifest);
2525
26 void spawn (string working_dir, string[] args) throws SpawnError {
27 debug ("launching %s", string.joinv(" ", args));
28 Process.spawn_async (working_dir, args, Environ.get (), SpawnFlags.SEARCH_PATH, null, null);
29 }
30
31 public string get_click_id (string full_app_id) {26 public string get_click_id (string full_app_id) {
32 return full_app_id.split("_")[0];27 return full_app_id.split("_")[0];
33 }28 }
@@ -116,54 +111,4 @@
116 var msg = "No manifest found for app_id: %s".printf(app_id);111 var msg = "No manifest found for app_id: %s".printf(app_id);
117 throw new ClickError.EXEC_FAILURE(msg);112 throw new ClickError.EXEC_FAILURE(msg);
118 }113 }
119
120 public async void execute (string app_id) throws ClickError {
121 var dotdesktop_filename = yield get_dotdesktop (app_id);
122 var parsed_dotdesktop = new GLib.KeyFile ();
123 var dotdesktop_folder = Environment.get_user_data_dir () + "/applications/";
124 var dotdesktop_fullpath = dotdesktop_folder + dotdesktop_filename;
125 string exec;
126 string working_folder;
127 try {
128 parsed_dotdesktop.load_from_file (dotdesktop_fullpath, KeyFileFlags.NONE);
129 exec = parsed_dotdesktop.get_string ("Desktop Entry", "Exec");
130 working_folder = parsed_dotdesktop.get_string ("Desktop Entry", "Path");
131 debug ( "Exec line: %s", exec );
132 } catch (GLib.KeyFileError e) {
133 var msg = "Error using keyfile %s: %s".printf(dotdesktop_filename, e.message);
134 throw new ClickError.EXEC_FAILURE (msg);
135 } catch (GLib.FileError e) {
136 var msg = "Error using keyfile %s: %s".printf(dotdesktop_filename, e.message);
137 throw new ClickError.EXEC_FAILURE (msg);
138 }
139
140 string[] parsed_args;
141 try {
142 Shell.parse_argv (exec, out parsed_args);
143 } catch (GLib.ShellError e) {
144 var msg = "Error parsing arguments: %s".printf(e.message);
145 throw new ClickError.EXEC_FAILURE (msg);
146 }
147
148 var args = new Gee.ArrayList<string?> ();
149 foreach (var a in parsed_args) {
150 args.add (a);
151 }
152 // TODO: the following are needed for the device, but not for the desktop
153 // so, if DISPLAY is not set, we add the extra args.
154 var environ = Environ.get ();
155 var display = Environ.get_variable (environ, "DISPLAY");
156 if (display == null) {
157 var hint = ARG_DESKTOP_FILE_HINT + "=" + dotdesktop_fullpath;
158 debug (hint);
159 args.add (hint);
160 }
161
162 try {
163 args.add (null); // spawn and joinv expect this at the end of the vala array
164 spawn (working_folder, args.to_array ());
165 } catch (SpawnError e) {
166 debug ("spawn, error: %s\n", e.message);
167 }
168 }
169}114}
170115
=== modified file 'src/click-scope.vala'
--- src/click-scope.vala 2013-09-12 18:47:10 +0000
+++ src/click-scope.vala 2013-09-21 00:10:47 +0000
@@ -117,20 +117,15 @@
117 return uri.has_prefix (App.CLICK_INSTALL_SCHEMA);117 return uri.has_prefix (App.CLICK_INSTALL_SCHEMA);
118 }118 }
119119
120 async void launch_application (string app_id) throws ClickError {
121 var click_if = new ClickInterface ();
122 yield click_if.execute(app_id);
123 }
124
125 async Unity.Preview build_uninstalled_preview (string app_id) {120 async Unity.Preview build_uninstalled_preview (string app_id) {
126 Unity.Preview preview = yield build_app_preview (app_id);121 Unity.Preview preview = yield build_app_preview (app_id);
127 preview.add_action (new Unity.PreviewAction (ACTION_INSTALL_CLICK, ("Install"), null));122 preview.add_action (new Unity.PreviewAction (ACTION_INSTALL_CLICK, ("Install"), null));
128 return preview;123 return preview;
129 }124 }
130125
131 async Unity.Preview build_installed_preview (string app_id) {126 async Unity.Preview build_installed_preview (string app_id, string application_uri) {
132 Unity.Preview preview = yield build_app_preview (app_id);127 Unity.Preview preview = yield build_app_preview (app_id);
133 preview.add_action (new Unity.PreviewAction (ACTION_OPEN_CLICK, ("Open"), null));128 preview.add_action (new Unity.PreviewAction (ACTION_OPEN_CLICK + ":" + application_uri, ("Open"), null));
134 preview.add_action (new Unity.PreviewAction (ACTION_PIN_TO_LAUNCHER, ("Pin to launcher"), null));129 preview.add_action (new Unity.PreviewAction (ACTION_PIN_TO_LAUNCHER, ("Pin to launcher"), null));
135 preview.add_action (new Unity.PreviewAction (ACTION_UNINSTALL_CLICK, ("Uninstall"), null));130 preview.add_action (new Unity.PreviewAction (ACTION_UNINSTALL_CLICK, ("Uninstall"), null));
136 return preview;131 return preview;
@@ -149,7 +144,7 @@
149 if (uri_is_click_install(result.uri)) {144 if (uri_is_click_install(result.uri)) {
150 return yield build_uninstalled_preview (app_id);145 return yield build_uninstalled_preview (app_id);
151 } else {146 } else {
152 return yield build_installed_preview (app_id);147 return yield build_installed_preview (app_id, result.uri);
153 }148 }
154 }149 }
155150
@@ -164,7 +159,8 @@
164 if (uri_is_click_install(result.uri)) {159 if (uri_is_click_install(result.uri)) {
165 preview = yield build_uninstalled_preview (app_id);160 preview = yield build_uninstalled_preview (app_id);
166 } else {161 } else {
167 yield launch_application (app_id);162 debug ("Let the dash launch the app: %s", result.uri);
163 return new Unity.ActivationResponse(Unity.HandledType.NOT_HANDLED);
168 }164 }
169 } else if (action_id == ACTION_INSTALL_CLICK) {165 } else if (action_id == ACTION_INSTALL_CLICK) {
170 var progress_source = yield install_app(app_id);166 var progress_source = yield install_app(app_id);
@@ -172,9 +168,14 @@
172 } else if (action_id == ACTION_DOWNLOAD_COMPLETED) {168 } else if (action_id == ACTION_DOWNLOAD_COMPLETED) {
173 results_invalidated(Unity.SearchType.GLOBAL);169 results_invalidated(Unity.SearchType.GLOBAL);
174 results_invalidated(Unity.SearchType.DEFAULT);170 results_invalidated(Unity.SearchType.DEFAULT);
175 preview = yield build_installed_preview (app_id);171 var click_if = new ClickInterface ();
176 } else if (action_id == ACTION_OPEN_CLICK) {172 var dotdesktop = yield click_if.get_dotdesktop(app_id);
177 yield launch_application (app_id);173 var application_uri = "application://" + dotdesktop;
174 preview = yield build_installed_preview (app_id, application_uri);
175 } else if (action_id.has_prefix(ACTION_OPEN_CLICK)) {
176 var application_uri = action_id.split(":", 2)[1];
177 debug ("Let the dash launch the app: %s", application_uri);
178 return new Unity.ActivationResponse(Unity.HandledType.NOT_HANDLED, application_uri);
178 } else if (action_id == ACTION_CLOSE_PREVIEW) {179 } else if (action_id == ACTION_CLOSE_PREVIEW) {
179 // default is to close the dash180 // default is to close the dash
180 } else {181 } else {
181182
=== modified file 'src/test-click-webservice.vala'
--- src/test-click-webservice.vala 2013-08-22 00:36:57 +0000
+++ src/test-click-webservice.vala 2013-09-21 00:10:47 +0000
@@ -173,23 +173,6 @@
173 assert (run_with_timeout (mainloop, 10000));173 assert (run_with_timeout (mainloop, 10000));
174 }174 }
175175
176 public static void test_click_execute ()
177 {
178 MainLoop mainloop = new MainLoop ();
179 var click_if = new ClickInterface ();
180
181 click_if.execute.begin("com.ubuntu.dropping-letters", (obj, res) => {
182 mainloop.quit ();
183 try {
184 click_if.execute.end (res);
185 debug ("app executed");
186 } catch (GLib.Error e) {
187 error ("Can't execute app %s", e.message);
188 }
189 });
190 assert (run_with_timeout (mainloop, 10000));
191 }
192
193 public static void test_click_get_dotdesktop ()176 public static void test_click_get_dotdesktop ()
194 {177 {
195 MainLoop mainloop = new MainLoop ();178 MainLoop mainloop = new MainLoop ();
@@ -246,7 +229,6 @@
246 Test.init (ref args);229 Test.init (ref args);
247 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Interface", test_click_interface);230 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Interface", test_click_interface);
248 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Get_DotDesktop", test_click_get_dotdesktop);231 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Get_DotDesktop", test_click_get_dotdesktop);
249 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Execute", test_click_execute);
250 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Search_Result", test_parse_search_result);232 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Search_Result", test_parse_search_result);
251 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Search_Result_Item", test_parse_search_result_item);233 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Search_Result_Item", test_parse_search_result_item);
252 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_App_Details", test_parse_app_details);234 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_App_Details", test_parse_app_details);

Subscribers

People subscribed via source and target branches