Merge lp:~online-accounts/libaccounts-glib/packaging into lp:libaccounts-glib

Proposed by Alberto Mardegan on 2016-09-28
Status: Merged
Approved by: Alberto Mardegan on 2016-11-10
Approved revision: 200
Merged at revision: 198
Proposed branch: lp:~online-accounts/libaccounts-glib/packaging
Merge into: lp:libaccounts-glib
Diff against target: 627 lines (+188/-28)
30 files modified
NEWS (+7/-0)
configure.ac (+1/-1)
debian/changelog (+9/-0)
debian/libaccounts-glib0.symbols (+2/-0)
libaccounts-glib/Makefile.am (+1/-1)
libaccounts-glib/accounts-glib.h (+1/-1)
libaccounts-glib/ag-account-service.c (+1/-1)
libaccounts-glib/ag-account-service.h (+1/-1)
libaccounts-glib/ag-account.h (+1/-0)
libaccounts-glib/ag-application.c (+67/-4)
libaccounts-glib/ag-application.h (+3/-1)
libaccounts-glib/ag-auth-data.c (+1/-1)
libaccounts-glib/ag-auth-data.h (+1/-1)
libaccounts-glib/ag-debug.c (+1/-0)
libaccounts-glib/ag-debug.h (+1/-0)
libaccounts-glib/ag-errors.h (+1/-1)
libaccounts-glib/ag-internals.h (+2/-3)
libaccounts-glib/ag-manager.c (+19/-1)
libaccounts-glib/ag-manager.h (+3/-1)
libaccounts-glib/ag-provider.c (+1/-1)
libaccounts-glib/ag-provider.h (+1/-1)
libaccounts-glib/ag-service-type.c (+1/-1)
libaccounts-glib/ag-service-type.h (+1/-1)
libaccounts-glib/ag-service.c (+1/-1)
libaccounts-glib/ag-service.h (+1/-1)
libaccounts-glib/ag-types.h (+1/-1)
libaccounts-glib/ag-util.c (+1/-1)
libaccounts-glib/ag-util.h (+1/-1)
tests/check_ag.c (+46/-1)
tests/data/accounts/applications/Mailer.application (+10/-0)
To merge this branch: bzr merge lp:~online-accounts/libaccounts-glib/packaging
Reviewer Review Type Date Requested Status
Online Accounts 2016-09-28 Pending
Review via email: mp+306991@code.launchpad.net

Description of the change

New upstream release

Add a couple of methods related to .application files:
ag_manager_list_services_by_application() and
ag_application_supports_service().

To post a comment you must log in.
200. By Alberto Mardegan on 2016-09-28

Update symbols file

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2016-05-20 08:30:26 +0000
3+++ NEWS 2016-09-28 08:05:28 +0000
4@@ -1,5 +1,12 @@
5 libaccounts-glib NEWS
6
7+Version 1.23
8+------------
9+
10+* Add a couple of methods related to .application files:
11+ ag_manager_list_services_by_application() and
12+ ag_application_supports_service().
13+
14 Version 1.22
15 ------------
16
17
18=== modified file 'configure.ac'
19--- configure.ac 2016-05-20 08:30:26 +0000
20+++ configure.ac 2016-09-28 08:05:28 +0000
21@@ -1,7 +1,7 @@
22 dnl Process this file with autoconf to produce a configure script.
23 AC_PREREQ([2.64])
24 AC_INIT([libaccounts-glib],
25- [1.22],
26+ [1.23],
27 [https://gitlab.com/accounts-sso/libaccounts-glib/issues],
28 [libaccounts-glib],
29 [https://gitlab.com/accounts-sso/libaccounts-glib])
30
31=== modified file 'debian/changelog'
32--- debian/changelog 2016-05-20 13:28:05 +0000
33+++ debian/changelog 2016-09-28 08:05:28 +0000
34@@ -1,3 +1,12 @@
35+libaccounts-glib (1.23-0ubuntu1) UNRELEASED; urgency=medium
36+
37+ * New upstream release
38+ - Add a couple of methods related to .application files:
39+ ag_manager_list_services_by_application() and
40+ ag_application_supports_service().
41+
42+ -- Alberto Mardegan <alberto.mardegan@canonical.com> Wed, 28 Sep 2016 10:55:30 +0300
43+
44 libaccounts-glib (1.22+16.10.20160520.2-0ubuntu1) yakkety; urgency=medium
45
46 [ Alberto Mardegan ]
47
48=== modified file 'debian/libaccounts-glib0.symbols'
49--- debian/libaccounts-glib0.symbols 2013-10-15 14:14:06 +0000
50+++ debian/libaccounts-glib0.symbols 2016-09-28 08:05:28 +0000
51@@ -55,6 +55,7 @@
52 ag_application_get_service_usage@Base 1.0
53 ag_application_get_type@Base 1.0
54 ag_application_ref@Base 1.0
55+ ag_application_supports_service@Base 1.23
56 ag_application_unref@Base 1.0
57 ag_auth_data_get_credentials_id@Base 1.0
58 ag_auth_data_get_login_parameters@Base 1.4
59@@ -86,6 +87,7 @@
60 ag_manager_list_providers@Base 1.0
61 ag_manager_list_service_types@Base 1.0
62 ag_manager_list_services@Base 1.0
63+ ag_manager_list_services_by_application@Base 1.23
64 ag_manager_list_services_by_type@Base 1.0
65 ag_manager_load_account@Base 1.0
66 ag_manager_load_service_type@Base 1.0
67
68=== modified file 'libaccounts-glib/Makefile.am'
69--- libaccounts-glib/Makefile.am 2015-12-01 10:34:17 +0000
70+++ libaccounts-glib/Makefile.am 2016-09-28 08:05:28 +0000
71@@ -14,7 +14,7 @@
72 $(LIBACCOUNTS_LIBS)
73 libaccounts_glib_la_LDFLAGS = \
74 $(COVERAGE_LDFLAGS) \
75- -version-info 1:3:1 \
76+ -version-info 2:0:2 \
77 --no-allow-shlib-undefined \
78 -export-symbols-regex '^ag_'
79
80
81=== modified file 'libaccounts-glib/accounts-glib.h'
82--- libaccounts-glib/accounts-glib.h 2013-01-03 09:13:14 +0000
83+++ libaccounts-glib/accounts-glib.h 2016-09-28 08:05:28 +0000
84@@ -3,7 +3,7 @@
85 /*
86 * This file is part of libaccounts-glib
87 *
88- * Copyright (C) 2011 Canonical Ltd.
89+ * Copyright (C) 2011-2016 Canonical Ltd.
90 *
91 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
92 *
93
94=== modified file 'libaccounts-glib/ag-account-service.c'
95--- libaccounts-glib/ag-account-service.c 2012-10-24 12:58:32 +0000
96+++ libaccounts-glib/ag-account-service.c 2016-09-28 08:05:28 +0000
97@@ -4,7 +4,7 @@
98 * This file is part of libaccounts-glib
99 *
100 * Copyright (C) 2011 Nokia Corporation.
101- * Copyright (C) 2012 Canonical Ltd.
102+ * Copyright (C) 2012-2016 Canonical Ltd.
103 *
104 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
105 *
106
107=== modified file 'libaccounts-glib/ag-account-service.h'
108--- libaccounts-glib/ag-account-service.h 2012-10-17 14:02:06 +0000
109+++ libaccounts-glib/ag-account-service.h 2016-09-28 08:05:28 +0000
110@@ -4,7 +4,7 @@
111 * This file is part of libaccounts-glib
112 *
113 * Copyright (C) 2009-2011 Nokia Corporation.
114- * Copyright (C) 2012 Canonical Ltd.
115+ * Copyright (C) 2012-2016 Canonical Ltd.
116 *
117 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
118 *
119
120=== modified file 'libaccounts-glib/ag-account.h'
121--- libaccounts-glib/ag-account.h 2012-10-22 13:03:16 +0000
122+++ libaccounts-glib/ag-account.h 2016-09-28 08:05:28 +0000
123@@ -4,6 +4,7 @@
124 * This file is part of libaccounts-glib
125 *
126 * Copyright (C) 2009-2010 Nokia Corporation.
127+ * Copyright (C) 2012-2016 Canonical Ltd.
128 *
129 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
130 *
131
132=== modified file 'libaccounts-glib/ag-application.c'
133--- libaccounts-glib/ag-application.c 2013-06-14 08:26:06 +0000
134+++ libaccounts-glib/ag-application.c 2016-09-28 08:05:28 +0000
135@@ -3,7 +3,7 @@
136 /*
137 * This file is part of libaccounts-glib
138 *
139- * Copyright (C) 2012 Canonical Ltd.
140+ * Copyright (C) 2012-2016 Canonical Ltd.
141 *
142 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
143 *
144@@ -158,6 +158,8 @@
145 item = g_slice_new0 (AgApplicationItem);
146 g_hash_table_insert (hash_table, item_id, item);
147
148+ if (xmlTextReaderIsEmptyElement (reader)) return TRUE;
149+
150 ret = xmlTextReaderRead (reader);
151 while (ret == 1)
152 {
153@@ -365,6 +367,13 @@
154 return ret;
155 }
156
157+static gint compare_service_name (gconstpointer a, gconstpointer b)
158+{
159+ AgService *service = (AgService *)a;
160+ const gchar *name = b;
161+ return g_strcmp0 (ag_service_get_name (service), name);
162+}
163+
164 AgApplication *
165 _ag_application_new_from_file (const gchar *application_name)
166 {
167@@ -383,10 +392,42 @@
168 return application;
169 }
170
171-gboolean
172-_ag_application_supports_service (AgApplication *self, AgService *service)
173+GList *
174+_ag_application_list_supported_services (AgApplication *self, AgManager *manager)
175 {
176- return _ag_application_get_service_item (self, service) != NULL;
177+ GHashTableIter iter;
178+ GList *ret = NULL;
179+ gchar *key;
180+ AgService *service;
181+
182+ g_return_val_if_fail (self != NULL, NULL);
183+
184+ if (self->service_types)
185+ {
186+ g_hash_table_iter_init (&iter, self->service_types);
187+ while (g_hash_table_iter_next (&iter, (gpointer)&key, NULL))
188+ {
189+ GList *services = ag_manager_list_services_by_type (manager, key);
190+ ret = g_list_concat (ret, services);
191+ }
192+ }
193+
194+ if (self->services)
195+ {
196+ g_hash_table_iter_init (&iter, self->services);
197+ while (g_hash_table_iter_next (&iter, (gpointer)&key, NULL))
198+ {
199+ if (g_list_find_custom (ret, key, compare_service_name)) continue;
200+
201+ service = ag_manager_get_service (manager, key);
202+ if (service)
203+ {
204+ ret = g_list_prepend (ret, service);
205+ }
206+ }
207+ }
208+
209+ return ret;
210 }
211
212 /**
213@@ -463,6 +504,28 @@
214 }
215
216 /**
217+ * ag_application_supports_service:
218+ * @self: the #AgApplication.
219+ * @service: an #AgService.
220+ *
221+ * Check whether the application supports the given service.
222+ *
223+ * Returns: %TRUE if @service is supported, %FALSE otherwise.
224+ */
225+gboolean
226+ag_application_supports_service (AgApplication *self, AgService *service)
227+{
228+ AgApplicationItem *item;
229+
230+ g_return_val_if_fail (self != NULL, FALSE);
231+ g_return_val_if_fail (service != NULL, FALSE);
232+
233+ item = _ag_application_get_service_item (self, service);
234+
235+ return item != NULL;
236+}
237+
238+/**
239 * ag_application_get_service_usage:
240 * @self: the #AgApplication.
241 * @service: an #AgService.
242
243=== modified file 'libaccounts-glib/ag-application.h'
244--- libaccounts-glib/ag-application.h 2012-07-06 13:09:23 +0000
245+++ libaccounts-glib/ag-application.h 2016-09-28 08:05:28 +0000
246@@ -3,7 +3,7 @@
247 /*
248 * This file is part of libaccounts-glib
249 *
250- * Copyright (C) 2012 Canonical Ltd.
251+ * Copyright (C) 2012-2016 Canonical Ltd.
252 *
253 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
254 *
255@@ -39,6 +39,8 @@
256
257 GDesktopAppInfo *ag_application_get_desktop_app_info (AgApplication *self);
258
259+gboolean ag_application_supports_service (AgApplication *self,
260+ AgService *service);
261 const gchar *ag_application_get_service_usage(AgApplication *self,
262 AgService *service);
263
264
265=== modified file 'libaccounts-glib/ag-auth-data.c'
266--- libaccounts-glib/ag-auth-data.c 2014-11-04 08:18:31 +0000
267+++ libaccounts-glib/ag-auth-data.c 2016-09-28 08:05:28 +0000
268@@ -3,7 +3,7 @@
269 /*
270 * This file is part of libaccounts-glib
271 *
272- * Copyright (C) 2012 Canonical Ltd.
273+ * Copyright (C) 2012-2016 Canonical Ltd.
274 *
275 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
276 *
277
278=== modified file 'libaccounts-glib/ag-auth-data.h'
279--- libaccounts-glib/ag-auth-data.h 2012-10-16 07:40:27 +0000
280+++ libaccounts-glib/ag-auth-data.h 2016-09-28 08:05:28 +0000
281@@ -3,7 +3,7 @@
282 /*
283 * This file is part of libaccounts-glib
284 *
285- * Copyright (C) 2012 Canonical Ltd.
286+ * Copyright (C) 2012-2016 Canonical Ltd.
287 *
288 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
289 *
290
291=== modified file 'libaccounts-glib/ag-debug.c'
292--- libaccounts-glib/ag-debug.c 2012-07-13 06:21:13 +0000
293+++ libaccounts-glib/ag-debug.c 2016-09-28 08:05:28 +0000
294@@ -4,6 +4,7 @@
295 * This file is part of libaccounts-glib
296 *
297 * Copyright (C) 2010 Nokia Corporation.
298+ * Copyright (C) 2012-2016 Canonical Ltd.
299 *
300 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
301 *
302
303=== modified file 'libaccounts-glib/ag-debug.h'
304--- libaccounts-glib/ag-debug.h 2012-07-13 06:21:13 +0000
305+++ libaccounts-glib/ag-debug.h 2016-09-28 08:05:28 +0000
306@@ -4,6 +4,7 @@
307 * This file is part of libaccounts-glib
308 *
309 * Copyright (C) 2009-2010 Nokia Corporation.
310+ * Copyright (C) 2012-2016 Canonical Ltd.
311 *
312 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
313 *
314
315=== modified file 'libaccounts-glib/ag-errors.h'
316--- libaccounts-glib/ag-errors.h 2013-09-05 09:10:38 +0000
317+++ libaccounts-glib/ag-errors.h 2016-09-28 08:05:28 +0000
318@@ -4,7 +4,7 @@
319 * This file is part of libaccounts-glib
320 *
321 * Copyright (C) 2009-2010 Nokia Corporation.
322- * Copyright (C) 2012-2013 Canonical Ltd.
323+ * Copyright (C) 2012-2016 Canonical Ltd.
324 *
325 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
326 *
327
328=== modified file 'libaccounts-glib/ag-internals.h'
329--- libaccounts-glib/ag-internals.h 2016-05-02 14:35:01 +0000
330+++ libaccounts-glib/ag-internals.h 2016-09-28 08:05:28 +0000
331@@ -222,9 +222,8 @@
332 G_GNUC_INTERNAL
333 AgApplication *_ag_application_new_from_file (const gchar *application_name);
334
335-/* Application functions */
336 G_GNUC_INTERNAL
337-gboolean _ag_application_supports_service (AgApplication *self,
338- AgService *service);
339+GList *_ag_application_list_supported_services (AgApplication *self,
340+ AgManager *manager);
341
342 #endif /* _AG_INTERNALS_H_ */
343
344=== modified file 'libaccounts-glib/ag-manager.c'
345--- libaccounts-glib/ag-manager.c 2016-05-02 14:35:01 +0000
346+++ libaccounts-glib/ag-manager.c 2016-09-28 08:05:28 +0000
347@@ -2839,7 +2839,7 @@
348 for (list = all_applications; list != NULL; list = list->next)
349 {
350 AgApplication *application = list->data;
351- if (_ag_application_supports_service (application, service))
352+ if (ag_application_supports_service (application, service))
353 {
354 applications = g_list_prepend (applications, application);
355 }
356@@ -2853,3 +2853,21 @@
357 return applications;
358 }
359
360+/**
361+ * ag_manager_list_services_by_application:
362+ * @manager: the #AgManager.
363+ * @application: a #AgApplication.
364+ *
365+ * Get the list of services that are supported by @application.
366+ *
367+ * Returns: (transfer full) (element-type AgService): a #GList of #AgService
368+ * items representing all the services which are supported. Must be free'd with
369+ * ag_service_list_free().
370+ */
371+GList *
372+ag_manager_list_services_by_application (AgManager *manager,
373+ AgApplication *application)
374+{
375+ g_return_val_if_fail (AG_IS_MANAGER (manager), NULL);
376+ return _ag_application_list_supported_services (application, manager);
377+}
378
379=== modified file 'libaccounts-glib/ag-manager.h'
380--- libaccounts-glib/ag-manager.h 2012-10-17 14:02:06 +0000
381+++ libaccounts-glib/ag-manager.h 2016-09-28 08:05:28 +0000
382@@ -4,7 +4,7 @@
383 * This file is part of libaccounts-glib
384 *
385 * Copyright (C) 2009-2010 Nokia Corporation.
386- * Copyright (C) 2012 Canonical Ltd.
387+ * Copyright (C) 2012-2016 Canonical Ltd.
388 * Copyright (C) 2012 Intel Corporation.
389 *
390 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
391@@ -95,6 +95,8 @@
392 GList *ag_manager_list_services (AgManager *manager);
393 GList *ag_manager_list_services_by_type (AgManager *manager,
394 const gchar *service_type);
395+GList *ag_manager_list_services_by_application (AgManager *manager,
396+ AgApplication *application);
397 GList *ag_manager_list_enabled (AgManager *manager);
398 GList *ag_manager_list_enabled_by_service_type (AgManager *manager,
399 const gchar *service_type);
400
401=== modified file 'libaccounts-glib/ag-provider.c'
402--- libaccounts-glib/ag-provider.c 2014-03-05 08:15:15 +0000
403+++ libaccounts-glib/ag-provider.c 2016-09-28 08:05:28 +0000
404@@ -4,7 +4,7 @@
405 * This file is part of libaccounts-glib
406 *
407 * Copyright (C) 2009-2010 Nokia Corporation.
408- * Copyright (C) 2012-2013 Canonical Ltd.
409+ * Copyright (C) 2012-2016 Canonical Ltd.
410 *
411 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
412 *
413
414=== modified file 'libaccounts-glib/ag-provider.h'
415--- libaccounts-glib/ag-provider.h 2013-10-10 11:28:53 +0000
416+++ libaccounts-glib/ag-provider.h 2016-09-28 08:05:28 +0000
417@@ -4,7 +4,7 @@
418 * This file is part of libaccounts-glib
419 *
420 * Copyright (C) 2009-2010 Nokia Corporation.
421- * Copyright (C) 2012-2013 Canonical Ltd.
422+ * Copyright (C) 2012-2016 Canonical Ltd.
423 *
424 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
425 *
426
427=== modified file 'libaccounts-glib/ag-service-type.c'
428--- libaccounts-glib/ag-service-type.c 2012-10-16 14:25:19 +0000
429+++ libaccounts-glib/ag-service-type.c 2016-09-28 08:05:28 +0000
430@@ -4,7 +4,7 @@
431 * This file is part of libaccounts-glib
432 *
433 * Copyright (C) 2010 Nokia Corporation.
434- * Copyright (C) 2012 Canonical Ltd.
435+ * Copyright (C) 2012-2016 Canonical Ltd.
436 * Copyright (C) 2012 Intel Corporation.
437 *
438 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
439
440=== modified file 'libaccounts-glib/ag-service-type.h'
441--- libaccounts-glib/ag-service-type.h 2012-07-13 06:21:13 +0000
442+++ libaccounts-glib/ag-service-type.h 2016-09-28 08:05:28 +0000
443@@ -4,7 +4,7 @@
444 * This file is part of libaccounts-glib
445 *
446 * Copyright (C) 2010 Nokia Corporation.
447- * Copyright (C) 2012 Canonical Ltd.
448+ * Copyright (C) 2012-2016 Canonical Ltd.
449 * Copyright (C) 2012 Intel Corporation.
450 *
451 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
452
453=== modified file 'libaccounts-glib/ag-service.c'
454--- libaccounts-glib/ag-service.c 2013-06-05 06:38:48 +0000
455+++ libaccounts-glib/ag-service.c 2016-09-28 08:05:28 +0000
456@@ -4,7 +4,7 @@
457 * This file is part of libaccounts-glib
458 *
459 * Copyright (C) 2009-2010 Nokia Corporation.
460- * Copyright (C) 2012 Canonical Ltd.
461+ * Copyright (C) 2012-2016 Canonical Ltd.
462 * Copyright (C) 2012 Intel Corporation.
463 *
464 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
465
466=== modified file 'libaccounts-glib/ag-service.h'
467--- libaccounts-glib/ag-service.h 2012-07-13 06:21:13 +0000
468+++ libaccounts-glib/ag-service.h 2016-09-28 08:05:28 +0000
469@@ -4,7 +4,7 @@
470 * This file is part of libaccounts-glib
471 *
472 * Copyright (C) 2009-2010 Nokia Corporation.
473- * Copyright (C) 2012 Canonical Ltd.
474+ * Copyright (C) 2012-2016 Canonical Ltd.
475 * Copyright (C) 2012 Intel Corporation.
476 *
477 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
478
479=== modified file 'libaccounts-glib/ag-types.h'
480--- libaccounts-glib/ag-types.h 2013-12-23 15:22:56 +0000
481+++ libaccounts-glib/ag-types.h 2016-09-28 08:05:28 +0000
482@@ -4,7 +4,7 @@
483 * This file is part of libaccounts-glib
484 *
485 * Copyright (C) 2009-2010 Nokia Corporation.
486- * Copyright (C) 2012 Canonical Ltd.
487+ * Copyright (C) 2012-2016 Canonical Ltd.
488 *
489 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
490 *
491
492=== modified file 'libaccounts-glib/ag-util.c'
493--- libaccounts-glib/ag-util.c 2016-02-18 19:37:45 +0000
494+++ libaccounts-glib/ag-util.c 2016-09-28 08:05:28 +0000
495@@ -4,7 +4,7 @@
496 * This file is part of libaccounts-glib
497 *
498 * Copyright (C) 2009-2010 Nokia Corporation.
499- * Copyright (C) 2012 Canonical Ltd.
500+ * Copyright (C) 2012-2016 Canonical Ltd.
501 * Copyright (C) 2012 Intel Corporation.
502 *
503 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
504
505=== modified file 'libaccounts-glib/ag-util.h'
506--- libaccounts-glib/ag-util.h 2013-10-10 11:28:53 +0000
507+++ libaccounts-glib/ag-util.h 2016-09-28 08:05:28 +0000
508@@ -4,7 +4,7 @@
509 * This file is part of libaccounts-glib
510 *
511 * Copyright (C) 2009-2010 Nokia Corporation.
512- * Copyright (C) 2012 Canonical Ltd.
513+ * Copyright (C) 2012-2016 Canonical Ltd.
514 * Copyright (C) 2012 Intel Corporation.
515 *
516 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
517
518=== modified file 'tests/check_ag.c'
519--- tests/check_ag.c 2016-02-19 10:05:07 +0000
520+++ tests/check_ag.c 2016-09-28 08:05:28 +0000
521@@ -4,7 +4,7 @@
522 * This file is part of libaccounts-glib
523 *
524 * Copyright (C) 2009-2010 Nokia Corporation.
525- * Copyright (C) 2012-2013 Canonical Ltd.
526+ * Copyright (C) 2012-2016 Canonical Ltd.
527 * Copyright (C) 2012 Intel Corporation.
528 *
529 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
530@@ -1625,6 +1625,8 @@
531 "mailer-catalog") == 0);
532 fail_unless (g_strcmp0 (ag_application_get_description (application),
533 "Mailer application") == 0);
534+ ck_assert (ag_application_supports_service (application, email_service));
535+ ck_assert (!ag_application_supports_service (application, sharing_service));
536 fail_unless (g_strcmp0 (ag_application_get_service_usage (application,
537 email_service),
538 "Mailer can retrieve your e-mails") == 0);
539@@ -1647,6 +1649,8 @@
540 "Gallery") == 0);
541 fail_unless (g_strcmp0 (ag_application_get_description (application),
542 "Image gallery") == 0);
543+ ck_assert (!ag_application_supports_service (application, email_service));
544+ ck_assert (ag_application_supports_service (application, sharing_service));
545 fail_unless (g_strcmp0 (ag_application_get_service_usage (application,
546 sharing_service),
547 "Publish images on OtherService") == 0);
548@@ -1660,6 +1664,46 @@
549 }
550 END_TEST
551
552+START_TEST(test_application_supported_services)
553+{
554+ AgService *email_service, *sharing_service;
555+ AgApplication *application;
556+ GList *list;
557+ gint i;
558+
559+ manager = ag_manager_new ();
560+
561+ application = ag_manager_get_application (manager, "Mailer");
562+ ck_assert (application != NULL);
563+
564+ list = ag_manager_list_services_by_application (manager, application);
565+ ck_assert (list != NULL);
566+ ck_assert_int_eq (g_list_length (list), 1);
567+
568+ email_service = list->data;
569+ ck_assert (email_service != NULL);
570+ ck_assert_str_eq (ag_service_get_name (email_service), "MyService");
571+
572+ ag_application_unref (application);
573+ ag_service_list_free (list);
574+
575+ application = ag_manager_get_application (manager, "Gallery");
576+ ck_assert (application != NULL);
577+
578+ list = ag_manager_list_services_by_application (manager, application);
579+ ck_assert (list != NULL);
580+ ck_assert_int_eq (g_list_length (list), 1);
581+
582+ email_service = list->data;
583+ ck_assert_str_eq (ag_service_get_name (email_service), "OtherService");
584+
585+ ag_application_unref (application);
586+ ag_service_list_free (list);
587+
588+ end_test ();
589+}
590+END_TEST
591+
592 START_TEST(test_service)
593 {
594 GValue value = { 0 };
595@@ -4039,6 +4083,7 @@
596
597 tc = tcase_create("Application");
598 tcase_add_test (tc, test_application);
599+ tcase_add_test (tc, test_application_supported_services);
600 IF_TEST_CASE_ENABLED("Application")
601 suite_add_tcase (s, tc);
602
603
604=== modified file 'tests/data/accounts/applications/Mailer.application'
605--- tests/data/accounts/applications/Mailer.application 2016-02-18 09:45:53 +0000
606+++ tests/data/accounts/applications/Mailer.application 2016-09-28 08:05:28 +0000
607@@ -3,10 +3,20 @@
608 <description>Mailer application</description>
609 <translations>mailer-catalog</translations>
610
611+ <!-- This file refers to "missing-service" and "missing-service-type" which,
612+ as their name hints, do not exist. The only valid reference contained in
613+ this file is the "e-mail" service type. -->
614+ <services>
615+ <service id="missing-service" />
616+ </services>
617+
618 <service-types>
619 <service-type id="e-mail">
620 <description>Mailer can retrieve your e-mails</description>
621 </service-type>
622+ <service-type id="missing-service-type">
623+ <description>I wish I could do something with it</description>
624+ </service-type>
625 </service-types>
626
627 </application>

Subscribers

No one subscribed via source and target branches