Add API for checking the enabled/disabled flag
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 14 Feb 2013 05:21:59 +0000 (05:21 +0000)
committerSung-jae Park <nicesj.park@samsung.com>
Thu, 14 Feb 2013 05:21:59 +0000 (05:21 +0000)
Change-Id: I8efdf78f3d4a34a45643ad9f9cbc4c430f2ffebd

CMakeLists.txt
include/livebox-service.h
packaging/liblivebox-service.spec
src/livebox-service.c

index 7e6e2c8..864eab9 100644 (file)
@@ -24,6 +24,7 @@ pkg_check_modules(pkgs REQUIRED
        pkgmgr
        x11
        vconf
+       ail
 )
 
 FOREACH(flag ${pkgs_CFLAGS})
index fcf77d9..c5b5acc 100644 (file)
@@ -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
index 24067a9..25d34d5 100644 (file)
@@ -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.
index 0e39885..55cf18e 100644 (file)
@@ -33,6 +33,7 @@
 #include <package-manager.h>
 #include <vconf.h>
 #include <vconf-keys.h>
+#include <ail.h>
 
 #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;