#include <sys/smack.h>
#include <badge.h>
#include <badge_db.h>
-#include <badge_setting_service.h>
#include <badge_internal.h>
#include <tzplatform_config.h>
ret = badge_set_display_option(parameters, &reply_body, uid);
else if (g_strcmp0(method_name, "get_disp_option") == 0)
ret = badge_get_display_option(parameters, &reply_body, uid);
- else if (g_strcmp0(method_name, "set_noti_property") == 0)
- ret = badge_set_setting_property(parameters, &reply_body, uid);
- else if (g_strcmp0(method_name, "get_noti_property") == 0)
- ret = badge_get_setting_property(parameters, &reply_body, uid);
if (ret == BADGE_ERROR_NONE) {
DbgPrint("badge service success : %d", ret);
" <arg type='i' name='is_display' direction='out'/>"
" </method>"
- " <method name='set_noti_property'>"
- " <arg type='s' name='pkgname' direction='in'/>"
- " <arg type='s' name='property' direction='in'/>"
- " <arg type='s' name='value' direction='in'/>"
- " <arg type='i' name='uid' direction='in'/>"
- " </method>"
-
- " <method name='get_noti_property'>"
- " <arg type='s' name='pkgname' direction='in'/>"
- " <arg type='s' name='property' direction='in'/>"
- " <arg type='i' name='uid' direction='in'/>"
- " <arg type='s' name='value' direction='out'/>"
- " </method>"
" </interface>"
" </node>";
return ret;
}
-/* set_noti_property */
-int badge_set_setting_property(GVariant *parameters, GVariant **reply_body, uid_t uid)
-{
- int ret = 0;
- int is_display = 0;
- char *pkgname = NULL;
- char *property = NULL;
- char *value = NULL;
- GVariant *body = NULL;
- GList *monitoring_list = NULL;
- uid_t param_uid;
-
- g_variant_get(parameters, "(&s&s&si)", &pkgname, &property, &value, ¶m_uid);
-
- ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid);
- if (ret != BADGE_ERROR_NONE)
- return ret;
-
- if (pkgname != NULL && property != NULL && value != NULL)
- ret = badge_setting_db_set(pkgname, property, value, param_uid);
- else
- return BADGE_ERROR_INVALID_PARAMETER;
-
- if (ret != BADGE_ERROR_NONE) {
- ErrPrint("failed to setting db set :%d\n", ret);
- return ret;
- }
-
- if (ret == BADGE_ERROR_NONE) {
- if (strcmp(property, "OPT_BADGE") == 0) {
- if (strcmp(value, "ON") == 0)
- is_display = 1;
- else
- is_display = 0;
-
- body = g_variant_new("(si)", pkgname, is_display);
- if (body == NULL) {
- ErrPrint("cannot make gvariant to noti");
- return BADGE_ERROR_OUT_OF_MEMORY;
- }
-
- monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, GUINT_TO_POINTER(param_uid));
- ret = send_notify(body, "set_disp_option_notify", monitoring_list, PROVIDER_BADGE_INTERFACE_NAME);
- g_variant_unref(body);
- if (ret != BADGE_ERROR_NONE) {
- ErrPrint("failed to send notify:%d\n", ret);
- return ret;
- }
- }
- } else {
- ErrPrint("failed to set noti property:%d\n", ret);
- }
-
- *reply_body = g_variant_new("()");
- if (*reply_body == NULL) {
- ErrPrint("cannot make gvariant to noti");
- return BADGE_ERROR_OUT_OF_MEMORY;
- }
- return ret;
-}
-
-/* get_noti_property */
-int badge_get_setting_property(GVariant *parameters, GVariant **reply_body, uid_t uid)
-{
- int ret = 0;
- char *pkgname = NULL;
- char *property = NULL;
- char *value = NULL;
- uid_t param_uid;
-
- g_variant_get(parameters, "(&s&si)", &pkgname, &property, ¶m_uid);
-
- ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid);
- if (ret != BADGE_ERROR_NONE)
- return ret;
-
- if (pkgname != NULL && property != NULL)
- ret = badge_setting_db_get(pkgname, property, &value, param_uid);
- else
- return BADGE_ERROR_INVALID_PARAMETER;
-
- if (ret != BADGE_ERROR_NONE) {
- ErrPrint("failed to setting db get :%d\n", ret);
- return ret;
- }
-
- *reply_body = g_variant_new("(s)", value);
- if (*reply_body == NULL) {
- ErrPrint("cannot make gvariant to noti");
- return BADGE_ERROR_OUT_OF_MEMORY;
- }
- return ret;
-}
-
/*!
* MAIN THREAD
* Do not try to do anyother operation in these functions