Adapt the AIL filter used to new ones 15/28215/4
authorBaptiste DURAND <baptiste.durand@open.eurogiciel.org>
Tue, 23 Sep 2014 15:33:22 +0000 (17:33 +0200)
committerBaptiste DURAND <baptiste.durand@open.eurogiciel.org>
Fri, 3 Oct 2014 14:08:29 +0000 (16:08 +0200)
Replace ail_filter_list_appinfo_foreach by ail_filter_list_usr_appinfo_foreach, this permits to apply the filter on all user applications not only the Global/Common ones.

Change-Id: I0d8b9b695364d54b239bae33c5b279be5033726a
Signed-off-by: Baptiste DURAND <baptiste.durand@open.eurogiciel.org>
lib/system-controller/CicoSCLifeCycleController.cpp
lib/system-controller/CicoSCLifeCycleController.h
src/homescreen/CicoHSLifeCycleController.cpp
src/homescreen/CicoHSLifeCycleController.h

index 2655cda..23a9349 100644 (file)
@@ -71,7 +71,7 @@ static ail_cb_ret_e CSCLCCail_list_appinfo_cb(const ail_appinfo_h appinfo,
                                               void *data, uid_t uid)
 {
     CicoSCLifeCycleController* x = (CicoSCLifeCycleController*)data;
-    return CSCLCCail_list_appinfo_cbX(appinfo, x);
+    return CSCLCCail_list_appinfo_cbX(appinfo, x, uid);
 }
 
 /**
@@ -623,7 +623,7 @@ void CicoSCLifeCycleController::renewAIL()
  *
  */
 ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
-                                        CicoSCLifeCycleController* x)
+                                        CicoSCLifeCycleController* x, uid_t uid)
 {
     ICO_TRA("start");
     if ((NULL == x) || (0 == x)) {
@@ -638,12 +638,12 @@ ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
     char   *exe;
     bool   bndsp = false;
     /* get package name for appid */
-    ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &pkg);
+    ail_appinfo_get_usr_str(appinfo, AIL_PROP_PACKAGE_STR, uid, &pkg);
     if (strcmp(pkg, APP_CONF_AIL_NULL_STR) == 0) {
         pkg = NULL;
     }
     /* get icon path */
-    ail_appinfo_get_str(appinfo, AIL_PROP_ICON_STR, &icn);
+    ail_appinfo_get_usr_str(appinfo, AIL_PROP_ICON_STR, uid, &icn);
     if (strcmp(icn, APP_CONF_AIL_NULL_STR) == 0) {
         icn = NULL;
     }
@@ -664,22 +664,22 @@ ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
         }
     }
     /* get name */
-    ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &nm);
+    ail_appinfo_get_usr_str(appinfo, AIL_PROP_NAME_STR, uid, &nm);
     if (strcmp(nm, APP_CONF_AIL_NULL_STR) == 0) {
         nm = NULL;
     }
     /* get category */
-    ail_appinfo_get_str(appinfo, AIL_PROP_CATEGORIES_STR, &ctgry);
+    ail_appinfo_get_usr_str(appinfo, AIL_PROP_CATEGORIES_STR, uid, &ctgry);
     if (strcmp(ctgry, APP_CONF_AIL_NULL_STR) == 0) {
         ctgry = NULL;
     }
     /* get type */
-    ail_appinfo_get_str(appinfo, AIL_PROP_TYPE_STR, &typ);
+    ail_appinfo_get_usr_str(appinfo, AIL_PROP_TYPE_STR, uid, &typ);
     if (strcmp(typ, APP_CONF_AIL_NULL_STR) == 0) {
         typ = NULL;
     }
     /* get exec */
-    ail_appinfo_get_str(appinfo, AIL_PROP_EXEC_STR, &exe);
+    ail_appinfo_get_usr_str(appinfo, AIL_PROP_EXEC_STR, uid, &exe);
     if (strcmp(exe, APP_CONF_AIL_NULL_STR) == 0) {
         exe = NULL;
     }
@@ -723,11 +723,12 @@ bool CicoSCLifeCycleController::createAilItems()
         g_string_free(gsfp, TRUE);
     }
     int r;
+    uid_t uid = getuid();
     ail_filter_h fil;
     ail_filter_new(&fil);
     r = ail_filter_add_str(fil, AIL_PROP_TYPE_STR, DAilTypeFilPrm_Menu);
-    r = ail_filter_list_appinfo_foreach(fil, CSCLCCail_list_appinfo_cb,
-                                        (void*)this);
+    r = ail_filter_list_usr_appinfo_foreach(fil, CSCLCCail_list_appinfo_cb,
+                                        (void*)this, uid);
     ail_filter_destroy(fil);
     if (r != AIL_ERROR_OK) {
         if (m_gconf) {
@@ -740,8 +741,8 @@ bool CicoSCLifeCycleController::createAilItems()
 
     ail_filter_new(&fil);
     r = ail_filter_add_str(fil, AIL_PROP_TYPE_STR, DAilTypeFilPrm_App);
-    r = ail_filter_list_appinfo_foreach(fil, CSCLCCail_list_appinfo_cb,
-                                        (void*)this);
+    r = ail_filter_list_usr_appinfo_foreach(fil, CSCLCCail_list_appinfo_cb,
+                                        (void*)this, uid);
     ail_filter_destroy(fil);
     if (r != AIL_ERROR_OK) {
         if (m_gconf) {
index 4a89a2d..efe512e 100644 (file)
@@ -79,7 +79,7 @@ public:
 protected:
     void initAIL();
     friend ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
-                                                   CicoSCLifeCycleController* x);
+                                                   CicoSCLifeCycleController* x, uid_t uid);
     bool createAilItems();
 
     friend 
index 7fdb4c9..2843d7a 100644 (file)
@@ -85,7 +85,7 @@ static ail_cb_ret_e CSCLCCail_list_appinfo_cb(const ail_appinfo_h appinfo,
                                               void *data, uid_t uid)
 {
     CicoHSLifeCycleController* x = (CicoHSLifeCycleController*)data;
-    return CSCLCCail_list_appinfo_cbX(appinfo, x);
+    return CSCLCCail_list_appinfo_cbX(appinfo, x, uid);
 }
 
 /**
@@ -624,7 +624,7 @@ void CicoHSLifeCycleController::renewAIL()
  *
  */
 ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
-                                        CicoHSLifeCycleController* x)
+                                        CicoHSLifeCycleController* x, uid_t uid)
 {
     ICO_TRA("start");
     if ((NULL == x) || (0 == x)) {
@@ -639,12 +639,12 @@ ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
     char   *exe;
     bool   bndsp = false;
     /* get package name for appid */
-    ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &pkg);
+    ail_appinfo_get_usr_str(appinfo, AIL_PROP_PACKAGE_STR, uid, &pkg);
     if (strcmp(pkg, APP_CONF_AIL_NULL_STR) == 0) {
         pkg = NULL;
     }
     /* get icon path */
-    ail_appinfo_get_str(appinfo, AIL_PROP_ICON_STR, &icn);
+    ail_appinfo_get_usr_str(appinfo, AIL_PROP_ICON_STR, uid, &icn);
     if (strcmp(icn, APP_CONF_AIL_NULL_STR) == 0) {
         icn = NULL;
     }
@@ -665,22 +665,22 @@ ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
         }
     }
     /* get name */
-    ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &nm);
+    ail_appinfo_get_usr_str(appinfo, AIL_PROP_NAME_STR, uid, &nm);
     if (strcmp(nm, APP_CONF_AIL_NULL_STR) == 0) {
         nm = NULL;
     }
     /* get category */
-    ail_appinfo_get_str(appinfo, AIL_PROP_CATEGORIES_STR, &ctgry);
+    ail_appinfo_get_usr_str(appinfo, AIL_PROP_CATEGORIES_STR, uid, &ctgry);
     if (strcmp(ctgry, APP_CONF_AIL_NULL_STR) == 0) {
         ctgry = NULL;
     }
     /* get type */
-    ail_appinfo_get_str(appinfo, AIL_PROP_TYPE_STR, &typ);
+    ail_appinfo_get_usr_str(appinfo, AIL_PROP_TYPE_STR, uid, &typ);
     if (strcmp(typ, APP_CONF_AIL_NULL_STR) == 0) {
         typ = NULL;
     }
     /* get exec */
-    ail_appinfo_get_str(appinfo, AIL_PROP_EXEC_STR, &exe);
+    ail_appinfo_get_usr_str(appinfo, AIL_PROP_EXEC_STR, uid, &exe);
     if (strcmp(exe, APP_CONF_AIL_NULL_STR) == 0) {
         exe = NULL;
     }
@@ -725,11 +725,12 @@ bool CicoHSLifeCycleController::createAilItems()
     }
 
     int r;
+    uid_t uid = getuid();
     ail_filter_h fil;
     ail_filter_new(&fil);
     r = ail_filter_add_str(fil, AIL_PROP_TYPE_STR, DAilTypeFilPrm_Menu);
-    r = ail_filter_list_appinfo_foreach(fil, CSCLCCail_list_appinfo_cb,
-                                        (void*)this);
+    r = ail_filter_list_usr_appinfo_foreach(fil, CSCLCCail_list_appinfo_cb,
+                                        (void*)this, uid);
     ail_filter_destroy(fil);
     if (r != AIL_ERROR_OK) {
         if (m_gconf) {
@@ -742,8 +743,8 @@ bool CicoHSLifeCycleController::createAilItems()
 
     ail_filter_new(&fil);
     r = ail_filter_add_str(fil, AIL_PROP_TYPE_STR, DAilTypeFilPrm_App);
-    r = ail_filter_list_appinfo_foreach(fil, CSCLCCail_list_appinfo_cb,
-                                        (void*)this);
+    r = ail_filter_list_usr_appinfo_foreach(fil, CSCLCCail_list_appinfo_cb,
+                                        (void*)this, uid);
     ail_filter_destroy(fil);
     if (r != AIL_ERROR_OK) {
         if (m_gconf) {
index 6126256..58a4eaa 100644 (file)
@@ -68,7 +68,7 @@ public:
 protected:
     void initAIL();
     friend ail_cb_ret_e CSCLCCail_list_appinfo_cbX(const ail_appinfo_h appinfo,
-                                                   CicoHSLifeCycleController* x);
+                                                   CicoHSLifeCycleController* x, uid_t uid);
     bool createAilItems();
 
     friend