} item_info_s;
/**
- * @brief Gets path icon of application with specified package name.
- * @param[in] package name of application.
- * @return path to icon.
- */
-HAPI char *get_app_icon(const char *appid);
-
-/**
- * @brief Gets display name of application with specified package name.
- * @param[in] package name of application.
- * @return application's display name.
- */
-HAPI char *get_app_name(const char *appid);
-
-/**
* @brief A function aimed to compare display names in list of item_info_s items in eina_list_sort().
* @param[in] first item to compare.
* @param[in] second item to compare.
*/
HAPI int apps_sort_cb(const void *d1, const void *d2);
+/**
+ * @brief A function is set to item its name and icon path by using application id
+ * @param[in] appid application id.
+ * @param[in] app_data item.
+ * @see item_info_s
+ */
+HAPI void get_app_info(const char *appid, item_info_s *app_data);
+
#endif //__APP_SETTING_INFO_H__
return strcmp(tmp1->name, tmp2->name);
}
-HAPI char *get_app_icon(const char *appid)
+HAPI void get_app_info(const char *appid, item_info_s *app_data)
{
- char *icon_path = NULL;
app_info_h app_info;
int error_code = app_info_create(appid, &app_info);
if (error_code == APP_MANAGER_ERROR_NONE) {
- error_code = app_info_get_icon(app_info, &icon_path);
- if (error_code != APP_MANAGER_ERROR_NONE) {
+ error_code = app_info_get_label(app_info, &app_data->name);
+ if (error_code != APP_MANAGER_ERROR_NONE)
+ NOTISET_ERR("app_info_get_label() failed with error-code %d", error_code);
+
+ error_code = app_info_get_icon(app_info, &app_data->icon);
+ if (error_code != APP_MANAGER_ERROR_NONE)
NOTISET_ERR("app_info_get_icon() failed with error-code %d", error_code);
- }
- app_info_destroy(app_info);
- } else {
- NOTISET_ERR("app_info_create() failed with error-code %d", error_code);
- }
- return icon_path;
-}
-HAPI char *get_app_name(const char *appid)
-{
- char *name = NULL;
- app_info_h app_info;
- int error_code = app_info_create(appid, &app_info);
- if (error_code == APP_MANAGER_ERROR_NONE) {
- error_code = app_info_get_label(app_info, &name);
- if (error_code != APP_MANAGER_ERROR_NONE) {
- NOTISET_ERR("app_info_get_label() failed with error-code %d", error_code);
- }
app_info_destroy(app_info);
} else {
NOTISET_ERR("app_info_create() failed with error-code %d", error_code);
}
- return name;
}
#define PHONE_PACKAGE "org.tizen.phone"
#define CALENDAR_PACKAGE "org.tizen.calendar"
#define MESSAGES_PACKAGE "org.tizen.message"
-/* TODO: we have no clock on device, when it will be add, we will need to change package id */
#define CLOCK_PACKAGE "org.tizen.clock"
Eina_Bool create_app_notification_list()
NOTISET_TRACE_BEGIN;
int i = 0;
int count = 0;
- char *package_id = NULL;
+ char *app_id = NULL;
bool allow_to_notify = false;
bool do_not_disturb_except = false;
notification_setting_h setting_array = NULL;
temp = setting_array + i;
- notification_setting_get_appid(temp, &package_id);
- item_info->appid = package_id;
+ notification_setting_get_appid(temp, &app_id);
+ item_info->appid = app_id;
notification_setting_get_allow_to_notify(temp, &allow_to_notify);
item_info->allow_to_notify = allow_to_notify;
notification_setting_get_do_not_disturb_except(temp, &do_not_disturb_except);
item_info->do_not_disturb_except = do_not_disturb_except;
- item_info->icon = get_app_icon(package_id);
- item_info->name = get_app_name(package_id);
+ get_app_info(app_id, item_info);
item_info->index = i;
- if (item_info->name && strcmp(package_id, CALENDAR_PACKAGE)
- && strcmp(package_id, CLOCK_PACKAGE)
- && strcmp(package_id, PHONE_PACKAGE)) {
+ if (item_info->name && strcmp(app_id, CALENDAR_PACKAGE)
+ && strcmp(app_id, CLOCK_PACKAGE)
+ && strcmp(app_id, PHONE_PACKAGE)) {
if (item_info->allow_to_notify)
setting_info->apps_noti_allowed_list = eina_list_append(setting_info->apps_noti_allowed_list, item_info);
else
setting_info->apps_noti_blocked_list = eina_list_append(setting_info->apps_noti_blocked_list, item_info);
} else {
- FREEIF(package_id);
+ FREEIF(app_id);
FREEIF(item_info->name);
FREEIF(item_info->icon);
FREEIF(item_info);
NOTISET_TRACE_BEGIN;
int i = 0;
int count = 0;
- char *package_id = NULL;
+ char *app_id = NULL;
bool allow_to_notify = false;
bool do_not_disturb_except = false;
notification_setting_h setting_array = NULL;
if (item_info) {
temp = setting_array + i;
- notification_setting_get_appid(temp, &package_id);
- item_info->appid = package_id;
+ notification_setting_get_appid(temp, &app_id);
+ item_info->appid = app_id;
notification_setting_get_allow_to_notify(temp, &allow_to_notify);
item_info->allow_to_notify = allow_to_notify;
notification_setting_get_do_not_disturb_except(temp, &do_not_disturb_except);
item_info->do_not_disturb_except = do_not_disturb_except;
- item_info->icon = get_app_icon(package_id);
+ get_app_info(app_id, item_info);
- if (!strcmp(package_id, CALENDAR_PACKAGE))
+ if (!strcmp(app_id, CALENDAR_PACKAGE))
item_info->name = strdup(APP_STRING("IDS_COM_BODY_CALENDAR_EVENTS"));
- else if (!strcmp(package_id, CLOCK_PACKAGE))
+ else if (!strcmp(app_id, CLOCK_PACKAGE))
item_info->name = strdup(APP_STRING("IDS_ST_BODY_ALARMS"));
- else
- item_info->name = get_app_name(package_id);
item_info->index = i;
- if (item_info->name && strcmp(package_id, PHONE_PACKAGE)) {
- if ((allow_to_notify && !strcmp(package_id, MESSAGES_PACKAGE))
- || !strcmp(package_id, CLOCK_PACKAGE)
- || !strcmp(package_id, CALENDAR_PACKAGE)) {
+ if (item_info->name && strcmp(app_id, PHONE_PACKAGE)) {
+ if ((allow_to_notify && !strcmp(app_id, MESSAGES_PACKAGE))
+ || !strcmp(app_id, CLOCK_PACKAGE)
+ || !strcmp(app_id, CALENDAR_PACKAGE)) {
setting_info->first_allowed_list = eina_list_append(setting_info->first_allowed_list, item_info);
if (do_not_disturb_except) {
setting_info->first_excepted_list = eina_list_append(setting_info->first_excepted_list, item_info);
}
}
- if (allow_to_notify && strcmp(package_id, MESSAGES_PACKAGE)
- && strcmp(package_id, CALENDAR_PACKAGE)
- && strcmp(package_id, CLOCK_PACKAGE)) {
+ if (allow_to_notify && strcmp(app_id, MESSAGES_PACKAGE)
+ && strcmp(app_id, CALENDAR_PACKAGE)
+ && strcmp(app_id, CLOCK_PACKAGE)) {
if (do_not_disturb_except) {
setting_info->excepted_list = eina_list_append(setting_info->excepted_list, item_info);
} else {
}
}
} else {
- FREEIF(package_id);
+ FREEIF(app_id);
FREEIF(item_info->name);
FREEIF(item_info->icon);
FREEIF(item_info);