Merge lp:~abreu-alexandre/unity-webapps-qml/content-hub-fail-safe-14-10 into lp:unity-webapps-qml/14.10

Proposed by Alexandre Abreu
Status: Approved
Approved by: Alexandre Abreu
Approved revision: 134
Proposed branch: lp:~abreu-alexandre/unity-webapps-qml/content-hub-fail-safe-14-10
Merge into: lp:unity-webapps-qml/14.10
Diff against target: 49 lines (+19/-4)
2 files modified
src/Ubuntu/UnityWebApps/UnityWebApps.qml (+2/-1)
src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js (+17/-3)
To merge this branch: bzr merge lp:~abreu-alexandre/unity-webapps-qml/content-hub-fail-safe-14-10
Reviewer Review Type Date Requested Status
David Barth (community) Approve
Review via email: mp+243578@code.launchpad.net

Commit message

Dont expect the content hub to be installed in a desktop environment.

Description of the change

Dont expect the content hub to be installed in a desktop environment.

To post a comment you must log in.
Revision history for this message
David Barth (dbarth) :
review: Approve

Unmerged revisions

134. By Alexandre Abreu

backport content hub failsafe init fix

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/UnityWebApps/UnityWebApps.qml'
2--- src/Ubuntu/UnityWebApps/UnityWebApps.qml 2014-07-18 21:46:57 +0000
3+++ src/Ubuntu/UnityWebApps/UnityWebApps.qml 2014-12-03 18:52:06 +0000
4@@ -775,7 +775,8 @@
5 return AlarmApiBackend.createAlarmApi(UnityBackends.backendDelegate)
6 }),
7
8- ContentHub: ContentHubApiBackend.createContentHubApi(UnityBackends.backendDelegate),
9+ ContentHub: ContentHubApiBackend.createContentHubApi(
10+ UnityBackends.backendDelegate, webapps),
11
12 RuntimeApi: __injectResourceIfExtraApisAreEnabled(function() {
13 return RuntimeApiBackend.createRuntimeApi(UnityBackends.backendDelegate)
14
15=== modified file 'src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js'
16--- src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js 2014-06-17 13:53:49 +0000
17+++ src/Ubuntu/UnityWebApps/bindings/content-hub/backend/content-hub.js 2014-12-03 18:52:06 +0000
18@@ -16,15 +16,29 @@
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22-.import Ubuntu.Content 0.1 as ContentHubBridge
23-
24 /**
25 *
26 * ContentHub API backend binding
27 *
28 */
29
30-function createContentHubApi(backendDelegate, accessPolicy) {
31+function createContentHubApi(backendDelegate, parent) {
32+
33+ var bridge = null
34+ try {
35+ bridge = Qt.createQmlObject(
36+ 'import QtQuick 2.0; import Ubuntu.Content 0.1 as ContentHubBridge; \
37+ QtObject { property var hub: ContentHubBridge }', parent)
38+ }
39+ catch(e) { }
40+
41+ if (!bridge) {
42+ console.log('Could not create ContentHub backend (does not appear to be installed)')
43+ return {};
44+ }
45+
46+ var ContentHubBridge = bridge.hub;
47+
48 var PLUGIN_URI = 'Ubuntu.Content';
49 var VERSION = 0.1;
50

Subscribers

People subscribed via source and target branches

to all changes: