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
1=== modified file 'src/click-interface.vala'
2--- src/click-interface.vala 2013-09-03 21:08:38 +0000
3+++ src/click-interface.vala 2013-09-21 00:10:47 +0000
4@@ -23,11 +23,6 @@
5 const string ARG_DESKTOP_FILE_HINT = "--desktop_file_hint";
6 delegate void ProcessManifestFunc (Json.Object manifest);
7
8- void spawn (string working_dir, string[] args) throws SpawnError {
9- debug ("launching %s", string.joinv(" ", args));
10- Process.spawn_async (working_dir, args, Environ.get (), SpawnFlags.SEARCH_PATH, null, null);
11- }
12-
13 public string get_click_id (string full_app_id) {
14 return full_app_id.split("_")[0];
15 }
16@@ -116,54 +111,4 @@
17 var msg = "No manifest found for app_id: %s".printf(app_id);
18 throw new ClickError.EXEC_FAILURE(msg);
19 }
20-
21- public async void execute (string app_id) throws ClickError {
22- var dotdesktop_filename = yield get_dotdesktop (app_id);
23- var parsed_dotdesktop = new GLib.KeyFile ();
24- var dotdesktop_folder = Environment.get_user_data_dir () + "/applications/";
25- var dotdesktop_fullpath = dotdesktop_folder + dotdesktop_filename;
26- string exec;
27- string working_folder;
28- try {
29- parsed_dotdesktop.load_from_file (dotdesktop_fullpath, KeyFileFlags.NONE);
30- exec = parsed_dotdesktop.get_string ("Desktop Entry", "Exec");
31- working_folder = parsed_dotdesktop.get_string ("Desktop Entry", "Path");
32- debug ( "Exec line: %s", exec );
33- } catch (GLib.KeyFileError e) {
34- var msg = "Error using keyfile %s: %s".printf(dotdesktop_filename, e.message);
35- throw new ClickError.EXEC_FAILURE (msg);
36- } catch (GLib.FileError e) {
37- var msg = "Error using keyfile %s: %s".printf(dotdesktop_filename, e.message);
38- throw new ClickError.EXEC_FAILURE (msg);
39- }
40-
41- string[] parsed_args;
42- try {
43- Shell.parse_argv (exec, out parsed_args);
44- } catch (GLib.ShellError e) {
45- var msg = "Error parsing arguments: %s".printf(e.message);
46- throw new ClickError.EXEC_FAILURE (msg);
47- }
48-
49- var args = new Gee.ArrayList<string?> ();
50- foreach (var a in parsed_args) {
51- args.add (a);
52- }
53- // TODO: the following are needed for the device, but not for the desktop
54- // so, if DISPLAY is not set, we add the extra args.
55- var environ = Environ.get ();
56- var display = Environ.get_variable (environ, "DISPLAY");
57- if (display == null) {
58- var hint = ARG_DESKTOP_FILE_HINT + "=" + dotdesktop_fullpath;
59- debug (hint);
60- args.add (hint);
61- }
62-
63- try {
64- args.add (null); // spawn and joinv expect this at the end of the vala array
65- spawn (working_folder, args.to_array ());
66- } catch (SpawnError e) {
67- debug ("spawn, error: %s\n", e.message);
68- }
69- }
70 }
71
72=== modified file 'src/click-scope.vala'
73--- src/click-scope.vala 2013-09-12 18:47:10 +0000
74+++ src/click-scope.vala 2013-09-21 00:10:47 +0000
75@@ -117,20 +117,15 @@
76 return uri.has_prefix (App.CLICK_INSTALL_SCHEMA);
77 }
78
79- async void launch_application (string app_id) throws ClickError {
80- var click_if = new ClickInterface ();
81- yield click_if.execute(app_id);
82- }
83-
84 async Unity.Preview build_uninstalled_preview (string app_id) {
85 Unity.Preview preview = yield build_app_preview (app_id);
86 preview.add_action (new Unity.PreviewAction (ACTION_INSTALL_CLICK, ("Install"), null));
87 return preview;
88 }
89
90- async Unity.Preview build_installed_preview (string app_id) {
91+ async Unity.Preview build_installed_preview (string app_id, string application_uri) {
92 Unity.Preview preview = yield build_app_preview (app_id);
93- preview.add_action (new Unity.PreviewAction (ACTION_OPEN_CLICK, ("Open"), null));
94+ preview.add_action (new Unity.PreviewAction (ACTION_OPEN_CLICK + ":" + application_uri, ("Open"), null));
95 preview.add_action (new Unity.PreviewAction (ACTION_PIN_TO_LAUNCHER, ("Pin to launcher"), null));
96 preview.add_action (new Unity.PreviewAction (ACTION_UNINSTALL_CLICK, ("Uninstall"), null));
97 return preview;
98@@ -149,7 +144,7 @@
99 if (uri_is_click_install(result.uri)) {
100 return yield build_uninstalled_preview (app_id);
101 } else {
102- return yield build_installed_preview (app_id);
103+ return yield build_installed_preview (app_id, result.uri);
104 }
105 }
106
107@@ -164,7 +159,8 @@
108 if (uri_is_click_install(result.uri)) {
109 preview = yield build_uninstalled_preview (app_id);
110 } else {
111- yield launch_application (app_id);
112+ debug ("Let the dash launch the app: %s", result.uri);
113+ return new Unity.ActivationResponse(Unity.HandledType.NOT_HANDLED);
114 }
115 } else if (action_id == ACTION_INSTALL_CLICK) {
116 var progress_source = yield install_app(app_id);
117@@ -172,9 +168,14 @@
118 } else if (action_id == ACTION_DOWNLOAD_COMPLETED) {
119 results_invalidated(Unity.SearchType.GLOBAL);
120 results_invalidated(Unity.SearchType.DEFAULT);
121- preview = yield build_installed_preview (app_id);
122- } else if (action_id == ACTION_OPEN_CLICK) {
123- yield launch_application (app_id);
124+ var click_if = new ClickInterface ();
125+ var dotdesktop = yield click_if.get_dotdesktop(app_id);
126+ var application_uri = "application://" + dotdesktop;
127+ preview = yield build_installed_preview (app_id, application_uri);
128+ } else if (action_id.has_prefix(ACTION_OPEN_CLICK)) {
129+ var application_uri = action_id.split(":", 2)[1];
130+ debug ("Let the dash launch the app: %s", application_uri);
131+ return new Unity.ActivationResponse(Unity.HandledType.NOT_HANDLED, application_uri);
132 } else if (action_id == ACTION_CLOSE_PREVIEW) {
133 // default is to close the dash
134 } else {
135
136=== modified file 'src/test-click-webservice.vala'
137--- src/test-click-webservice.vala 2013-08-22 00:36:57 +0000
138+++ src/test-click-webservice.vala 2013-09-21 00:10:47 +0000
139@@ -173,23 +173,6 @@
140 assert (run_with_timeout (mainloop, 10000));
141 }
142
143- public static void test_click_execute ()
144- {
145- MainLoop mainloop = new MainLoop ();
146- var click_if = new ClickInterface ();
147-
148- click_if.execute.begin("com.ubuntu.dropping-letters", (obj, res) => {
149- mainloop.quit ();
150- try {
151- click_if.execute.end (res);
152- debug ("app executed");
153- } catch (GLib.Error e) {
154- error ("Can't execute app %s", e.message);
155- }
156- });
157- assert (run_with_timeout (mainloop, 10000));
158- }
159-
160 public static void test_click_get_dotdesktop ()
161 {
162 MainLoop mainloop = new MainLoop ();
163@@ -246,7 +229,6 @@
164 Test.init (ref args);
165 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Interface", test_click_interface);
166 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Get_DotDesktop", test_click_get_dotdesktop);
167- Test.add_data_func ("/Unit/ClickChecker/Test_Click_Execute", test_click_execute);
168 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Search_Result", test_parse_search_result);
169 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Search_Result_Item", test_parse_search_result_item);
170 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_App_Details", test_parse_app_details);

Subscribers

People subscribed via source and target branches