Merge lp:~ken-vandine/content-hub/noclick into lp:content-hub

Proposed by Ken VanDine
Status: Merged
Approved by: Michael Sheldon
Approved revision: 334
Merged at revision: 332
Proposed branch: lp:~ken-vandine/content-hub/noclick
Merge into: lp:content-hub
Diff against target: 737 lines (+104/-256)
18 files modified
CMakeLists.txt (+0/-1)
debian/content-hub.install (+1/-2)
debian/control (+0/-2)
debian/rules (+2/-1)
include/com/ubuntu/content/type.h (+2/-2)
src/com/ubuntu/content/service/CMakeLists.txt (+7/-54)
src/com/ubuntu/content/service/content-hub-peer-hook-wrapper.in (+0/-13)
src/com/ubuntu/content/service/content-hub.hook.in (+0/-4)
src/com/ubuntu/content/service/helper.cpp (+0/-66)
src/com/ubuntu/content/service/main.cpp (+4/-1)
src/com/ubuntu/content/service/registry-updater.cpp (+57/-39)
src/com/ubuntu/content/service/registry-updater.h (+11/-9)
src/helper/CMakeLists.txt (+0/-2)
src/helper/exec-tool.c (+2/-43)
tests/acceptance-tests/CMakeLists.txt (+8/-8)
tests/acceptance-tests/test_registry_updater.cpp (+8/-7)
tools/peer-picker/content-hub-peer-picker.desktop (+1/-1)
tools/send/content-hub-send.desktop (+1/-1)
To merge this branch: bzr merge lp:~ken-vandine/content-hub/noclick
Reviewer Review Type Date Requested Status
Michael Sheldon (community) Approve
system-apps-ci-bot continuous-integration Needs Fixing
Review via email: mp+319356@code.launchpad.net

Commit message

* Removed the click hook and check for registered peers on service startup
* Removed click usage in the helper and dropped the depends
* Added QFileWatcher to watch for peers to be installed/removed

Description of the change

* Removed the click hook and check for registered peers on service startup
* Removed click usage in the helper and dropped the depends
* Added QFileWatcher to watch for peers to be installed/removed

To post a comment you must log in.
lp:~ken-vandine/content-hub/noclick updated
328. By Ken VanDine

Removed some debugging

329. By Ken VanDine

Rename the Hook class to RegistryUpdater

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
lp:~ken-vandine/content-hub/noclick updated
330. By Ken VanDine

merged trunk

331. By Ken VanDine

removed unused filed

332. By Ken VanDine

Added /var/cache/content-hub/peers/ to the list of directories watched for peers. The snap interface hook will install them there.

333. By Ken VanDine

Install an empty dir for the snap interface hook to install peers.

334. By Ken VanDine

updated copyright years

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2017-02-16 12:08:29 +0000
3+++ CMakeLists.txt 2017-03-15 13:33:04 +0000
4@@ -72,7 +72,6 @@
5 pkg_check_modules(UBUNTU_DOWNLOAD_MANAGER REQUIRED ubuntu-download-manager-client)
6 pkg_check_modules(NOTIFY REQUIRED libnotify)
7 pkg_check_modules(MIRCLIENT REQUIRED mirclient)
8-pkg_check_modules(CLICK REQUIRED click-0.4)
9 pkg_check_modules(APPARMOR REQUIRED libapparmor)
10
11 add_definitions(-DDEBUG_ENABLED)
12
13=== modified file 'debian/content-hub.install'
14--- debian/content-hub.install 2016-12-08 12:11:27 +0000
15+++ debian/content-hub.install 2017-03-15 13:33:04 +0000
16@@ -2,10 +2,8 @@
17 usr/bin/content-hub-peer-picker
18 usr/bin/content-hub-send
19 usr/bin/content-hub-service
20-usr/lib/*/content-hub
21 usr/lib/*/ubuntu-app-launch
22 usr/lib/systemd/user
23-usr/share/click/hooks
24 usr/share/dbus-1
25 usr/share/glib-2.0/schemas
26 usr/share/locale/*/LC_MESSAGES/content-hub.mo
27@@ -14,5 +12,6 @@
28 usr/share/applications/content-hub-peer-picker.desktop
29 usr/share/url-dispatcher/urls/content-hub-send.url-dispatcher
30 usr/share/content-hub/icons
31+var/cache/content-hub/peers
32 debian/apparmor/content-hub-clipboard etc/apparmor.d
33 debian/apparmor/content-hub-peer-picker etc/apparmor.d
34
35=== modified file 'debian/control'
36--- debian/control 2017-03-09 02:39:40 +0000
37+++ debian/control 2017-03-15 13:33:04 +0000
38@@ -2,7 +2,6 @@
39 Priority: optional
40 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
41 Build-Depends: cmake,
42- click-dev,
43 dbus-test-runner,
44 debhelper (>= 9),
45 dh-apparmor,
46@@ -11,7 +10,6 @@
47 google-mock,
48 lcov,
49 libapparmor-dev,
50- libclick-0.4-dev,
51 libglib2.0-dev,
52 libgsettings-qt-dev,
53 libmirclient-dev [!powerpc !ppc64 !ppc64el],
54
55=== modified file 'debian/rules'
56--- debian/rules 2017-01-04 16:16:00 +0000
57+++ debian/rules 2017-03-15 13:33:04 +0000
58@@ -11,7 +11,7 @@
59 LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
60
61 %:
62- dh $@ --with click,translations --fail-missing -- -B build
63+ dh $@ --with translations --fail-missing -- -B build
64
65 override_dh_auto_test:
66 make -C build/tests/acceptance-tests test
67@@ -21,6 +21,7 @@
68 dh_apparmor -pcontent-hub --profile-name=content-hub-clipboard
69 dh_apparmor -pcontent-hub --profile-name=content-hub-peer-picker
70 dh_apparmor -pcontent-hub-testability --profile-name=content-hub-testability
71+ mkdir -p debian/tmp/var/cache/content-hub/peers
72
73 DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
74 # Skip tests on the archs they are known to be flaky with current configuration
75
76=== modified file 'include/com/ubuntu/content/type.h'
77--- include/com/ubuntu/content/type.h 2015-06-24 20:22:45 +0000
78+++ include/com/ubuntu/content/type.h 2017-03-15 13:33:04 +0000
79@@ -30,7 +30,7 @@
80 namespace detail
81 {
82 class Service;
83-class Hook;
84+class RegistryUpdater;
85 }
86 class Type : public QObject
87 {
88@@ -67,7 +67,7 @@
89 protected:
90 friend struct Known;
91 friend class detail::Service;
92- friend class detail::Hook;
93+ friend class detail::RegistryUpdater;
94
95 explicit Type(const QString&, QObject* = nullptr);
96
97
98=== modified file 'src/com/ubuntu/content/service/CMakeLists.txt'
99--- src/com/ubuntu/content/service/CMakeLists.txt 2016-11-15 19:45:40 +0000
100+++ src/com/ubuntu/content/service/CMakeLists.txt 2017-03-15 13:33:04 +0000
101@@ -37,11 +37,18 @@
102
103 main.cpp
104 registry.cpp
105+ registry-updater.cpp
106 ../debug.cpp
107 ../utils.cpp
108 ${CONTENT_SERVICE_SKELETON}
109 )
110
111+set_target_properties(
112+ content-hub-service
113+ PROPERTIES
114+ AUTOMOC TRUE
115+)
116+
117 qt5_use_modules(content-hub-service Core DBus Gui)
118
119 target_link_libraries(
120@@ -85,60 +92,6 @@
121
122 add_schema ("com.ubuntu.content.hub.gschema.xml")
123
124-add_executable(
125- content-hub-peer-hook
126-
127- helper.cpp
128- registry.cpp
129- hook.cpp
130-)
131-
132-qt5_use_modules(content-hub-peer-hook Core Gui DBus)
133-
134-target_link_libraries(
135- content-hub-peer-hook
136-
137- content-hub
138- ${GSETTINGS_LDFLAGS}
139- ${UBUNTU_LAUNCH_LDFLAGS}
140-)
141-
142-configure_file("content-hub-peer-hook-wrapper.in"
143- "content-hub-peer-hook-wrapper"
144- @ONLY
145-)
146-
147-install(
148- PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/content-hub-peer-hook-wrapper"
149- DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/content-hub"
150-)
151-
152-install(
153- TARGETS content-hub-peer-hook
154- RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/content-hub"
155-)
156-
157-set_target_properties(
158- content-hub-peer-hook
159- PROPERTIES
160- AUTOMOC TRUE
161-)
162-
163-set(CLICK_HOOK
164-"${CMAKE_CURRENT_BINARY_DIR}/content-hub.hook"
165-)
166-
167-configure_file("content-hub.hook.in"
168- "${CLICK_HOOK}"
169- @ONLY
170-)
171-
172-install(
173-FILES
174-"${CLICK_HOOK}"
175-DESTINATION "/usr/share/click/hooks"
176-)
177-
178 install(
179 FILES xorg.png
180 DESTINATION ${CMAKE_INSTALL_DATADIR}/content-hub/icons/
181
182=== removed file 'src/com/ubuntu/content/service/content-hub-peer-hook-wrapper.in'
183--- src/com/ubuntu/content/service/content-hub-peer-hook-wrapper.in 2014-11-10 12:57:43 +0000
184+++ src/com/ubuntu/content/service/content-hub-peer-hook-wrapper.in 1970-01-01 00:00:00 +0000
185@@ -1,13 +0,0 @@
186-#!/bin/sh
187-
188-# PackageKit clears all environment variables, so we get the UID and then read
189-# in $DBUS_SESSION_BUS_ADDRESS from /run/user/$UID/dbus-session
190-
191-USERID=`id -u`
192-
193-if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
194- [ -e /run/user/$USERID/dbus-session ] && . /run/user/$USERID/dbus-session
195- [ -n "$DBUS_SESSION_BUS_ADDRESS" ] && export DBUS_SESSION_BUS_ADDRESS
196-fi
197-
198-@pkglibexecdir@/content-hub/content-hub-peer-hook
199
200=== removed file 'src/com/ubuntu/content/service/content-hub.hook.in'
201--- src/com/ubuntu/content/service/content-hub.hook.in 2014-06-02 16:33:13 +0000
202+++ src/com/ubuntu/content/service/content-hub.hook.in 1970-01-01 00:00:00 +0000
203@@ -1,4 +0,0 @@
204-Pattern: ${home}/.local/share/content-hub/${id}
205-Exec: @pkglibexecdir@/content-hub/content-hub-peer-hook-wrapper
206-User-Level: yes
207-Hook-Name: content-hub
208
209=== removed file 'src/com/ubuntu/content/service/helper.cpp'
210--- src/com/ubuntu/content/service/helper.cpp 2015-08-12 17:24:29 +0000
211+++ src/com/ubuntu/content/service/helper.cpp 1970-01-01 00:00:00 +0000
212@@ -1,66 +0,0 @@
213-/*
214- * Copyright (C) 2013 Canonical, Ltd.
215- *
216- * This program is free software; you can redistribute it and/or modify
217- * it under the terms of the GNU General Public License as published by
218- * the Free Software Foundation; version 3.
219- *
220- * This program is distributed in the hope that it will be useful,
221- * but WITHOUT ANY WARRANTY; without even the implied warranty of
222- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
223- * GNU General Public License for more details.
224- *
225- * You should have received a copy of the GNU General Public License
226- * along with this program. If not, see <http://www.gnu.org/licenses/>.
227- *
228- * Authored by: Ken VanDine <ken.vandine@canonical.com>
229- */
230-
231-#include <QCoreApplication>
232-#include <QDir>
233-#include <QStandardPaths>
234-
235-#include "hook.h"
236-#include "debug.h"
237-
238-namespace cuc = com::ubuntu::content;
239-
240-int main(int argc, char** argv)
241-{
242- QCoreApplication app(argc, argv);
243-
244- TRACE() << Q_FUNC_INFO;
245-
246- if (app.arguments().count() > 1)
247- {
248- qWarning() << "Shouldn't have arguments";
249- return 1;
250- }
251-
252- /* read environment variables */
253- QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
254- if (environment.contains(QLatin1String("CONTENT_HUB_LOGGING_LEVEL"))) {
255- bool isOk;
256- int value = environment.value(
257- QLatin1String("CONTENT_HUB_LOGGING_LEVEL")).toInt(&isOk);
258- if (isOk)
259- setLoggingLevel(value);
260- }
261-
262- QDir contentDir(
263- QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
264- + QString("/")
265- + QString("content-hub"));
266-
267- if (!contentDir.exists()) {
268- if (!contentDir.mkpath(contentDir.absolutePath()))
269- return 0;
270- }
271-
272- new cuc::detail::Hook();
273-
274- app.exec();
275-
276- /* We always want to return 0 */
277- return 0;
278-}
279
280=== modified file 'src/com/ubuntu/content/service/main.cpp'
281--- src/com/ubuntu/content/service/main.cpp 2014-07-15 14:31:08 +0000
282+++ src/com/ubuntu/content/service/main.cpp 2017-03-15 13:33:04 +0000
283@@ -1,5 +1,5 @@
284 /*
285- * Copyright (C) 2013 Canonical, Ltd.
286+ * Copyright (C) 2013-2017 Canonical, Ltd.
287 *
288 * This program is free software; you can redistribute it and/or modify
289 * it under the terms of the GNU General Public License as published by
290@@ -25,6 +25,7 @@
291 #include "debug.h"
292 #include "common.h"
293 #include "registry.h"
294+#include "registry-updater.h"
295 #include "detail/i18n.h"
296 #include "detail/service.h"
297 #include "detail/peer_registry.h"
298@@ -63,6 +64,8 @@
299
300 auto registry = QSharedPointer<cucd::PeerRegistry>(new Registry());
301
302+ auto updater = new cuc::detail::RegistryUpdater(registry);
303+
304 auto app_manager = QSharedPointer<cuca::ApplicationManager>(new cucd::AppManager());
305
306 auto server = new cucd::Service(connection, registry, app_manager, app->parent());
307
308=== renamed file 'src/com/ubuntu/content/service/hook.cpp' => 'src/com/ubuntu/content/service/registry-updater.cpp'
309--- src/com/ubuntu/content/service/hook.cpp 2015-06-24 20:22:45 +0000
310+++ src/com/ubuntu/content/service/registry-updater.cpp 2017-03-15 13:33:04 +0000
311@@ -1,5 +1,5 @@
312 /*
313- * Copyright (C) 2013 Canonical, Ltd.
314+ * Copyright (C) 2013-2017 Canonical, Ltd.
315 *
316 * This program is free software; you can redistribute it and/or modify
317 * it under the terms of the GNU General Public License as published by
318@@ -20,6 +20,7 @@
319 #include <QJsonDocument>
320 #include <QJsonObject>
321 #include <QFile>
322+#include <QFileSystemWatcher>
323 #include <QDir>
324 #include <QStandardPaths>
325 #include <QTimer>
326@@ -27,34 +28,18 @@
327 #include <com/ubuntu/content/peer.h>
328
329 #include "debug.h"
330-#include "hook.h"
331+#include "registry-updater.h"
332
333+namespace cuc = com::ubuntu::content;
334 namespace cucd = com::ubuntu::content::detail;
335
336-cucd::Hook::Hook(QObject *parent) :
337- QObject(parent),
338- registry(new Registry())
339-{
340- QTimer::singleShot(200, this, SLOT(run()));
341-}
342-
343-cucd::Hook::Hook(com::ubuntu::content::detail::PeerRegistry *registry, QObject *parent) :
344- QObject(parent),
345- registry(registry)
346-{
347-}
348-
349-cucd::Hook::~Hook()
350-{
351- TRACE() << Q_FUNC_INFO;
352- delete registry;
353-}
354-
355-void cucd::Hook::run()
356-{
357- TRACE() << Q_FUNC_INFO;
358- /* Looks for files in ${HOME}/.local/share/content-hub/${id} installed
359- * by click packages. These files are JSON, for example:
360+cucd::RegistryUpdater::RegistryUpdater(const QSharedPointer<cucd::PeerRegistry>& registry, QObject *parent) :
361+ QObject(parent),
362+ registry(registry),
363+ watcher(new QFileSystemWatcher)
364+{
365+ /* Looks for files installed packages that define peer registration.
366+ * These files are JSON, for example:
367 *
368 * {
369 * "source": [
370@@ -63,22 +48,56 @@
371 * ]
372 * }
373 *
374- * The hook also iterates known peers and removes them if there is
375+ * The updater also iterates known peers and removes them if there is
376 * no JSON file installed in this path.
377 */
378-
379- QVector<QDir> contentDirs;
380-
381 contentDirs.append(QDir(
382 QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
383 + QString("/")
384 + QString("content-hub")));
385-
386+
387 contentDirs.append(QDir("/usr/share/content-hub/peers/"));
388 contentDirs.append(QDir("/usr/share/local/content-hub/peers/"));
389+ contentDirs.append(QDir("/var/cache/content-hub/peers/"));
390+
391+ QStringList dirs;
392+ Q_FOREACH(QDir d, contentDirs)
393+ {
394+ if (d.exists())
395+ dirs << d.path();
396+ }
397+
398+ watcher->addPaths(dirs);
399+ connect(watcher.data(), SIGNAL(directoryChanged(const QString&)), SLOT(refresh(const QString&)));
400+
401+ QTimer::singleShot(200, this, SLOT(run()));
402+}
403+
404+cucd::RegistryUpdater::~RegistryUpdater()
405+{
406+ TRACE() << Q_FUNC_INFO;
407+}
408+
409+void cucd::RegistryUpdater::refresh(const QString& dir)
410+{
411+ TRACE() << Q_FUNC_INFO << dir;
412+ bool shouldRefresh = true;
413+ /* Don't update the registry for temp files */
414+ Q_FOREACH(QFileInfo f, QDir(dir).entryInfoList(QDir::Files))
415+ {
416+ if (f.completeSuffix().contains("dpkg-"))
417+ shouldRefresh = false;
418+ }
419+ if (shouldRefresh)
420+ run();
421+}
422+
423+void cucd::RegistryUpdater::run()
424+{
425+ TRACE() << Q_FUNC_INFO;
426
427 QStringList all_peers;
428- registry->enumerate_known_peers([&all_peers](const com::ubuntu::content::Peer& peer)
429+ registry->enumerate_known_peers([&all_peers](const cuc::Peer& peer)
430 {
431 all_peers.append(peer.id());
432 });
433@@ -95,7 +114,7 @@
434 }
435 }
436 if(!foundPeer) {
437- registry->remove_peer(com::ubuntu::content::Peer{p});
438+ registry->remove_peer(cuc::Peer{p});
439 }
440 }
441
442@@ -107,9 +126,10 @@
443 if (contentDir.exists())
444 {
445 peerDirsExist = true;
446-
447 Q_FOREACH(QFileInfo f, contentDir.entryInfoList(QDir::Files))
448+ {
449 add_peer(f);
450+ }
451 }
452
453 }
454@@ -117,13 +137,11 @@
455 if(!peerDirsExist)
456 return_error("No peer setting directories exist.");
457
458- deleteLater();
459- QCoreApplication::instance()->quit();
460 }
461
462-bool cucd::Hook::add_peer(QFileInfo result)
463+bool cucd::RegistryUpdater::add_peer(QFileInfo result)
464 {
465- TRACE() << Q_FUNC_INFO << "Hook:" << result.filePath();
466+ TRACE() << Q_FUNC_INFO << "RegistryUpdater:" << result.filePath();
467
468 QStringList knownTypes;
469 knownTypes << "all" << "pictures" << "music" << "contacts" << "documents" << "videos" << "links" << "ebooks" << "text" << "events";
470@@ -182,7 +200,7 @@
471 return true;
472 }
473
474-bool cucd::Hook::return_error(QString err)
475+bool cucd::RegistryUpdater::return_error(QString err)
476 {
477 qWarning() << "Failed to install peer" << err;
478 return false;
479
480=== renamed file 'src/com/ubuntu/content/service/hook.h' => 'src/com/ubuntu/content/service/registry-updater.h'
481--- src/com/ubuntu/content/service/hook.h 2015-09-23 14:45:09 +0000
482+++ src/com/ubuntu/content/service/registry-updater.h 2017-03-15 13:33:04 +0000
483@@ -1,5 +1,5 @@
484 /*
485- * Copyright (C) 2013 Canonical, Ltd.
486+ * Copyright (C) 2013-2017 Canonical, Ltd.
487 *
488 * This program is free software; you can redistribute it and/or modify
489 * it under the terms of the GNU General Public License as published by
490@@ -16,8 +16,8 @@
491 * Authored by: Ken VanDine <ken.vandine@canonical.com>
492 */
493
494-#ifndef HOOK_H
495-#define HOOK_H
496+#ifndef REGISTRY_UPDATER_H
497+#define REGISTRY_UPDATER_H
498
499 #include <QObject>
500 #include <QFileInfo>
501@@ -33,21 +33,23 @@
502 {
503 namespace detail
504 {
505-class Hook : public QObject
506+class RegistryUpdater : public QObject
507 {
508 Q_OBJECT
509 public:
510- explicit Hook(QObject *parent = 0);
511- Hook(com::ubuntu::content::detail::PeerRegistry *registry, QObject *parent = 0);
512- ~Hook();
513+ RegistryUpdater(const QSharedPointer<com::ubuntu::content::detail::PeerRegistry>& registry, QObject *parent = 0);
514+ ~RegistryUpdater();
515
516 public Q_SLOTS:
517 bool return_error(QString err = "");
518+ void refresh(const QString&);
519 void run();
520 bool add_peer(QFileInfo);
521
522 private:
523- com::ubuntu::content::detail::PeerRegistry* registry;
524+ const QSharedPointer<com::ubuntu::content::detail::PeerRegistry>& registry;
525+ QVector<QDir> contentDirs;
526+ QScopedPointer<QFileSystemWatcher> watcher;
527
528 };
529 }
530@@ -55,4 +57,4 @@
531 }
532 }
533
534-#endif // HOOK_H
535+#endif // REGISTRY_UPDATER_H
536
537=== modified file 'src/helper/CMakeLists.txt'
538--- src/helper/CMakeLists.txt 2016-11-09 17:55:06 +0000
539+++ src/helper/CMakeLists.txt 2017-03-15 13:33:04 +0000
540@@ -21,7 +21,6 @@
541 ${UBUNTU_LAUNCH_INCLUDE_DIRS}
542 ${GIO_INCLUDE_DIRS}
543 ${GLIB_INCLUDE_DIRS}
544- ${CLICK_INCLUDE_DIRS}
545 ${MIRCLIENT_INCLUDE_DIRS}
546 )
547
548@@ -37,7 +36,6 @@
549 exec-tool
550
551 ${UBUNTU_LAUNCH_LDFLAGS}
552- ${CLICK_LDFLAGS}
553 ${GLIB_LDFLAGS}
554 ${GIO_LDFLAGS}
555 ${MIRCLIENT_LDFLAGS}
556
557=== modified file 'src/helper/exec-tool.c'
558--- src/helper/exec-tool.c 2016-11-09 17:55:06 +0000
559+++ src/helper/exec-tool.c 2017-03-15 13:33:04 +0000
560@@ -18,7 +18,7 @@
561 */
562
563 #include <glib.h>
564-#include <click.h>
565+#include <gio/gio.h>
566 #include <ubuntu-app-launch.h>
567
568 gchar *
569@@ -65,7 +65,6 @@
570 gchar *
571 build_dir (const gchar * appid)
572 {
573- GError * error = NULL;
574 gchar * package = NULL;
575
576 /* 'Parse' the App ID */
577@@ -73,42 +72,9 @@
578 g_warning("Unable to parse App ID: '%s'", appid);
579 return NULL;
580 }
581-
582- /* Check click to find out where the files are */
583- ClickDB * db = click_db_new();
584-
585- /* If TEST_CLICK_DB is unset, this reads the system database. */
586- click_db_read(db, g_getenv("TEST_CLICK_DB"), &error);
587- if (error != NULL) {
588- g_warning("Unable to read Click database: %s", error->message);
589- g_error_free(error);
590- g_free(package);
591- return NULL;
592- }
593-
594- /* If TEST_CLICK_USER is unset, this uses the current user name. */
595- ClickUser * user = click_user_new_for_user(db, g_getenv("TEST_CLICK_USER"), &error);
596- if (error != NULL) {
597- g_warning("Unable to read Click database: %s", error->message);
598- g_error_free(error);
599- g_free(package);
600- g_object_unref(db);
601- return NULL;
602- }
603-
604- gchar * pkgdir = click_user_get_path(user, package, &error);
605-
606- g_object_unref(user);
607- g_object_unref(db);
608 g_free(package);
609
610- if (error != NULL) {
611- g_warning("Unable to get the Click package directory for %s: %s", package, error->message);
612- g_error_free(error);
613- return NULL;
614- }
615-
616- return pkgdir;
617+ return NULL;
618 }
619
620 int
621@@ -136,13 +102,6 @@
622 exec = build_exec(appid, SYSTEM_DIRECTORY);
623 }
624
625- /* If not there look to the user directory (click) */
626- if (exec == NULL) {
627- gchar * userdir = g_build_filename(g_get_user_cache_dir(), "ubuntu-app-launch", "desktop", NULL);
628- exec = build_exec(appid, userdir);
629- g_free(userdir);
630- }
631-
632 if (exec == NULL) {
633 const gchar * props[3] = {
634 "AppID",
635
636=== modified file 'tests/acceptance-tests/CMakeLists.txt'
637--- tests/acceptance-tests/CMakeLists.txt 2017-01-04 16:16:00 +0000
638+++ tests/acceptance-tests/CMakeLists.txt 2017-03-15 13:33:04 +0000
639@@ -71,25 +71,25 @@
640 endforeach(test)
641
642 add_executable(
643- test_hook
644- test_hook.cpp
645+ test_registry_updater
646+ test_registry_updater.cpp
647 ${MOCS}
648- ${CMAKE_SOURCE_DIR}/src/com/ubuntu/content/service/hook.cpp
649+ ${CMAKE_SOURCE_DIR}/src/com/ubuntu/content/service/registry-updater.cpp
650 ${CMAKE_SOURCE_DIR}/src/com/ubuntu/content/service/registry.cpp
651 good.json
652 bad.json
653 source_all.json
654 )
655
656-qt5_use_modules(test_hook Core Gui DBus Test)
657-target_link_libraries(test_hook content-hub ${GTEST_ALL_LIBRARIES} ${GSETTINGS_LDFLAGS})
658-add_test(NAME test_hook COMMAND dbus-test-runner --task ${CMAKE_CURRENT_BINARY_DIR}/test_hook)
659+qt5_use_modules(test_registry_updater Core Gui DBus Test)
660+target_link_libraries(test_registry_updater content-hub ${GTEST_ALL_LIBRARIES} ${GSETTINGS_LDFLAGS})
661+add_test(NAME test_registry_updater COMMAND dbus-test-runner --task ${CMAKE_CURRENT_BINARY_DIR}/test_registry_updater)
662
663-SET_TESTS_PROPERTIES(test_hook
664+SET_TESTS_PROPERTIES(test_registry_updater
665 PROPERTIES ENVIRONMENT "CONTENT_HUB_TESTING=1")
666
667 set_target_properties(
668- test_hook
669+ test_registry_updater
670 PROPERTIES
671 AUTOMOC TRUE
672 )
673
674=== renamed file 'tests/acceptance-tests/test_hook.cpp' => 'tests/acceptance-tests/test_registry_updater.cpp'
675--- tests/acceptance-tests/test_hook.cpp 2015-10-20 20:23:09 +0000
676+++ tests/acceptance-tests/test_registry_updater.cpp 2017-03-15 13:33:04 +0000
677@@ -19,7 +19,7 @@
678 #include <com/ubuntu/content/peer.h>
679 #include <com/ubuntu/content/type.h>
680 #include "com/ubuntu/content/detail/peer_registry.h"
681-#include "com/ubuntu/content/service/hook.h"
682+#include "com/ubuntu/content/service/registry-updater.h"
683
684 #include <gmock/gmock.h>
685 #include <gtest/gtest.h>
686@@ -60,7 +60,7 @@
687 };
688 }
689
690-TEST(Hook, parse_json)
691+TEST(RegistryUpdater, parse_json)
692 {
693 using namespace ::testing;
694
695@@ -70,12 +70,13 @@
696 WillRepeatedly(Return(true));
697
698 QFileInfo f("good.json");
699- cucd::Hook *hook = new cucd::Hook(mock);
700+ auto mock_ptr = QSharedPointer<cuc::detail::PeerRegistry>(mock);
701+ cucd::RegistryUpdater *updater = new cucd::RegistryUpdater(mock_ptr);
702
703- EXPECT_TRUE(hook->add_peer(f));
704+ EXPECT_TRUE(updater->add_peer(f));
705 f.setFile("bad.json");
706- EXPECT_FALSE(hook->add_peer(f));
707+ EXPECT_FALSE(updater->add_peer(f));
708 f.setFile("source_all.json");
709- EXPECT_TRUE(hook->add_peer(f));
710- delete mock;
711+ EXPECT_TRUE(updater->add_peer(f));
712+ mock_ptr.clear();
713 }
714
715=== modified file 'tools/peer-picker/content-hub-peer-picker.desktop'
716--- tools/peer-picker/content-hub-peer-picker.desktop 2016-11-16 18:25:30 +0000
717+++ tools/peer-picker/content-hub-peer-picker.desktop 2017-03-15 13:33:04 +0000
718@@ -6,7 +6,7 @@
719 Icon=
720 Terminal=false
721 Type=Application
722-OnlyShowIn=Old
723+NoDisplay=true
724 X-Ubuntu-Touch=true
725 X-Ubuntu-Single-Instance=false
726 X-Ubuntu-Splash-Show-Header=true
727
728=== modified file 'tools/send/content-hub-send.desktop'
729--- tools/send/content-hub-send.desktop 2015-04-20 23:17:37 +0000
730+++ tools/send/content-hub-send.desktop 2017-03-15 13:33:04 +0000
731@@ -5,5 +5,5 @@
732 Icon=
733 Terminal=false
734 Type=Application
735-OnlyShowIn=Old
736+NoDisplay=true
737 X-Ubuntu-Touch=true

Subscribers

People subscribed via source and target branches