Merge lp:~alecu/unity-scope-click/download-errors into lp:unity-scope-click

Proposed by Alejandro J. Cura
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 61
Merged at revision: 65
Proposed branch: lp:~alecu/unity-scope-click/download-errors
Merge into: lp:unity-scope-click
Diff against target: 36 lines (+11/-0)
1 file modified
src/click-scope.vala (+11/-0)
To merge this branch: bzr merge lp:~alecu/unity-scope-click/download-errors
Reviewer Review Type Date Requested Status
dobey (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+188712@code.launchpad.net

Commit message

Show download manager failures

To post a comment you must log in.
58. By Alejandro J. Cura

merged with trunk

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

+ preview.add_action (new Unity.PreviewAction (ACTION_DOWNLOAD_FAILED, ("*** download_failed"), null));

What the heck? Why are we adding weird buttons like this to the UI?

This is exactly what bug #1231145 is filed about. We should remove such things, not add more of them.

review: Needs Fixing
Revision history for this message
Alejandro J. Cura (alecu) wrote :

> + preview.add_action (new Unity.PreviewAction (ACTION_DOWNLOAD_FAILED, ("***
> download_failed"), null));
>
> What the heck? Why are we adding weird buttons like this to the UI?
>
> This is exactly what bug #1231145 is filed about. We should remove such
> things, not add more of them.

PreviewActions are not always buttons.

In the case of this preview, when the the dash finds out that it needs to show a progressbar, it does not show any button, and uses those two special actions (the ones that start with ***) to signal that the download manager has finished or errored out.

It was a bug that the action labeled with "*** ..." was shown as a button, but having the stars there helped uncover it.

59. By Alejandro J. Cura

Add a comment explaining the sufficiently advanced technique

60. By Alejandro J. Cura

merged with trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
61. By Alejandro J. Cura

ident 4>>

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/click-scope.vala'
2--- src/click-scope.vala 2013-10-01 22:13:05 +0000
3+++ src/click-scope.vala 2013-10-02 16:03:31 +0000
4@@ -16,6 +16,7 @@
5
6 private const string ACTION_INSTALL_CLICK = "install_click";
7 private const string ACTION_DOWNLOAD_COMPLETED = "download_completed";
8+private const string ACTION_DOWNLOAD_FAILED = "download_failed";
9 private const string ACTION_OPEN_CLICK = "open_click";
10 private const string ACTION_PIN_TO_LAUNCHER = "pin_to_launcher";
11 private const string ACTION_UNINSTALL_CLICK = "uninstall_click";
12@@ -132,7 +133,13 @@
13
14 async Unity.Preview build_installing_preview (string app_id, string progress_source) {
15 Unity.Preview preview = yield build_app_preview (app_id);
16+
17+ // When the progressbar is shown by the preview in the dash no buttons should be shown.
18+ // The two following actions (marked with ***) are not shown as buttons, but instead are triggered by the dash
19+ // when the download manager succeeds or fails with a given download+installation.
20 preview.add_action (new Unity.PreviewAction (ACTION_DOWNLOAD_COMPLETED, ("*** download_completed"), null));
21+ preview.add_action (new Unity.PreviewAction (ACTION_DOWNLOAD_FAILED, ("*** download_failed"), null));
22+
23 preview.add_info(new Unity.InfoHint.with_variant("show_progressbar", "Progressbar", null, new Variant.boolean(true)));
24 preview.add_info(new Unity.InfoHint.with_variant("progressbar_source", "Progress Source", null, progress_source));
25 return preview;
26@@ -164,6 +171,10 @@
27 } else if (action_id == ACTION_INSTALL_CLICK) {
28 var progress_source = yield install_app(app_id);
29 preview = yield build_installing_preview (app_id, progress_source);
30+ } else if (action_id.has_prefix(ACTION_DOWNLOAD_FAILED)) {
31+ // we don't have access to the error message in SearchMetadata, LP: #1233836
32+ var errormsg = "please check ubuntu-download-manager.log";
33+ throw new ClickScopeError.INSTALL_ERROR("Installation failed: %s".printf(errormsg));
34 } else if (action_id == ACTION_DOWNLOAD_COMPLETED) {
35 results_invalidated(Unity.SearchType.GLOBAL);
36 results_invalidated(Unity.SearchType.DEFAULT);

Subscribers

People subscribed via source and target branches