From 9e849af58d5c2b2863324e6d9102640dc02ae781 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Thu, 14 Feb 2013 05:21:59 +0000 Subject: [PATCH] Add API for checking the enabled/disabled flag Change-Id: I8efdf78f3d4a34a45643ad9f9cbc4c430f2ffebd --- CMakeLists.txt | 1 + include/livebox-service.h | 7 +++++++ packaging/liblivebox-service.spec | 5 +++-- src/livebox-service.c | 30 ++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e6e2c8..864eab9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ pkg_check_modules(pkgs REQUIRED pkgmgr x11 vconf + ail ) FOREACH(flag ${pkgs_CFLAGS}) diff --git a/include/livebox-service.h b/include/livebox-service.h index fcf77d9..c5b5acc 100644 --- a/include/livebox-service.h +++ b/include/livebox-service.h @@ -156,6 +156,13 @@ extern char *livebox_service_libexec(const char *appid); extern int livebox_service_nodisplay(const char *pkgid); /*! + * \brief Check the status of the livebox + * \param[in] lbid Livebox Id + * \return int 1 enabled, 0 disabled + */ +extern int livebox_service_is_enabled(const char *lbid); + +/*! * \brief * \param[in] * \return diff --git a/packaging/liblivebox-service.spec b/packaging/liblivebox-service.spec index 24067a9..25d34d5 100644 --- a/packaging/liblivebox-service.spec +++ b/packaging/liblivebox-service.spec @@ -1,6 +1,6 @@ Name: liblivebox-service Summary: Service API for gathering installed livebox information. -Version: 0.3.2 +Version: 0.3.3 Release: 1 Group: framework/livebox License: Flora License @@ -15,9 +15,10 @@ BuildRequires: pkgconfig(db-util) BuildRequires: pkgconfig(pkgmgr) BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(ail) %description -Service API for gathering installed livebox information +Service API for gathering information of installed liveboxes %package devel Summary: Files for livebox service. diff --git a/src/livebox-service.c b/src/livebox-service.c index 0e39885..55cf18e 100644 --- a/src/livebox-service.c +++ b/src/livebox-service.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "dlist.h" #include "util.h" @@ -1276,6 +1277,35 @@ EAPI char *livebox_service_provider_name(const char *lbid) return ret; } +EAPI int livebox_service_is_enabled(const char *lbid) +{ + ail_appinfo_h ai; + char *pkgname; + bool enabled; + int ret; + + pkgname = livebox_service_appid(lbid); + if (!pkgname) + return 0; + + ret = ail_get_appinfo(pkgname, &ai); + if (ret != AIL_ERROR_OK) { + free(pkgname); + return 0; + } + + if (ail_appinfo_get_bool(ai, AIL_PROP_X_SLP_ENABLED_BOOL, &enabled) != AIL_ERROR_OK) + enabled = false; + + ail_destroy_appinfo(ai); + free(pkgname); + return enabled == true; +} + +/*! + * appid == Package ID + * pkgid == Livebox ID + */ EAPI char *livebox_service_appid(const char *pkgname) { sqlite3_stmt *stmt; -- 2.7.4