int sticker_dbus_shutdown(GDBusConnection *gdbus_connection, int *server_watcher_id, int *server_monitor_id, int *monitor_id)
{
int ret;
- GVariant *body = NULL;
if (server_watcher_id) {
- body = g_variant_new("(i)", *server_watcher_id);
- ret = _send_async_message(gdbus_connection, body, "sticker_service_unregister");
+ ret = _send_async_message(gdbus_connection, g_variant_new("(i)", *server_watcher_id), "sticker_service_unregister");
if (ret != STICKER_CLIENT_ERROR_NONE) {
LOGE("Failed to unregister sticker service");
return ret;
*monitor_id = 0;
}
- if (body)
- g_variant_unref(body);
-
return STICKER_CLIENT_ERROR_NONE;
}
int ret;
int ret_id = -1;
GDBusMessage *reply = NULL;
- GVariant *body = NULL;
GVariant *reply_body = NULL;
GVariantBuilder *info_builder;
GVariantBuilder *keyword_builder;
keyword_builder = g_variant_builder_new(G_VARIANT_TYPE("a(s)"));
g_list_foreach(sticker_data->keyword, (GFunc) _set_keyword_builder, keyword_builder);
- body = g_variant_new("(a{iv}a(s))", info_builder, keyword_builder);
-
- g_variant_builder_unref(info_builder);
- g_variant_builder_unref(keyword_builder);
-
- ret = _send_sync_message(gdbus_connection, body, &reply, "insert_sticker_info");
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(a{iv}a(s))", info_builder, keyword_builder), &reply, "insert_sticker_info");
if (ret != STICKER_CLIENT_ERROR_NONE) {
LOGW("Failed to save sticker info");
return ret;
sticker_data->sticker_info_id = ret_id;
LOGD("ret_id : %d", ret_id);
- if (body)
- g_variant_unref(body);
+
+ g_variant_builder_unref(info_builder);
+ g_variant_builder_unref(keyword_builder);
if (reply_body)
g_variant_unref(reply_body);
int sticker_dbus_insert_sticker_info_by_json(GDBusConnection *gdbus_connection, const char *app_id, const char *json_path)
{
int ret;
- GVariant *body = NULL;
- body = g_variant_new("(ss)", app_id, json_path);
- ret = _send_async_message(gdbus_connection, body, "update_sticker_info_by_json");
+ ret = _send_async_message(gdbus_connection, g_variant_new("(ss)", app_id, json_path), "update_sticker_info_by_json");
if (ret != STICKER_CLIENT_ERROR_NONE)
LOGE("failed to send json path");
- if (body)
- g_variant_unref(body);
-
return ret;
}
{
int ret;
GDBusMessage *reply = NULL;
- GVariant *body = NULL;
- body = g_variant_new("(i)", record_id);
- ret = _send_sync_message(gdbus_connection, body, &reply, "delete_sticker_info");
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(i)", record_id), &reply, "delete_sticker_info");
if (ret != STICKER_CLIENT_ERROR_NONE)
LOGE("failed to delete sticker info");
- if (body)
- g_variant_unref(body);
-
if (reply)
g_object_unref(reply);
{
int ret;
GDBusMessage *reply = NULL;
- GVariant *body = NULL;
GVariant *reply_body = NULL;
sticker_data_h origin_data = (sticker_data_h)calloc(1, sizeof(struct sticker_data_s));
return STICKER_CLIENT_ERROR_OUT_OF_MEMORY;
}
- body = g_variant_new("(i)", sticker_data->sticker_info_id);
- ret = _send_sync_message(gdbus_connection, body, &reply, "get_sticker_info");
-
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(i)", sticker_data->sticker_info_id), &reply, "get_sticker_info");
if (ret == STICKER_CLIENT_ERROR_NONE) {
reply_body = g_dbus_message_get_body(reply);
_get_sticker_info_from_gvariant(reply_body, origin_data);
free(origin_data);
if (reply)
g_object_unref(reply);
- if (body)
- g_variant_unref(body);
return ret;
}
if (sticker_data->type != 0 && sticker_data->type != origin_data->type) {
LOGD("origin_type : %d, new_type : %d", origin_data->type, sticker_data->type);
- g_variant_unref(body);
- body = g_variant_new("(ii)", sticker_data->sticker_info_id, sticker_data->type);
- ret = _send_sync_message(gdbus_connection, body, &reply, "update_sticker_type");
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(ii)", sticker_data->sticker_info_id, sticker_data->type), &reply, "update_sticker_type");
if (ret != STICKER_CLIENT_ERROR_NONE)
LOGE("failed to update sticker type");
}
if (sticker_data->uri && strcmp(sticker_data->uri, origin_data->uri) != 0) {
LOGD("origin_uri : %s, new_uri : %s", origin_data->uri, sticker_data->uri);
- g_variant_unref(body);
- body = g_variant_new("(isis)", sticker_data->sticker_info_id, sticker_data->app_id, sticker_data->type, sticker_data->uri);
- ret = _send_sync_message(gdbus_connection, body, &reply, "update_sticker_uri");
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(isis)", sticker_data->sticker_info_id, sticker_data->app_id, sticker_data->type, sticker_data->uri), &reply, "update_sticker_uri");
if (ret != STICKER_CLIENT_ERROR_NONE)
LOGE("failed to update sticker uri");
}
if (sticker_data->thumbnail && strcmp(sticker_data->thumbnail, origin_data->thumbnail) != 0) {
LOGD("origin_thumbnail : %s, new_thumbnail : %s", origin_data->thumbnail, sticker_data->thumbnail);
- g_variant_unref(body);
- body = g_variant_new("(is)", sticker_data->sticker_info_id, sticker_data->thumbnail);
- ret = _send_sync_message(gdbus_connection, body, &reply, "update_sticker_thumbnail");
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(is)", sticker_data->sticker_info_id, sticker_data->thumbnail), &reply, "update_sticker_thumbnail");
if (ret != STICKER_CLIENT_ERROR_NONE)
LOGE("failed to update sticker thumbnail");
}
if (sticker_data->description && strcmp(sticker_data->description, origin_data->description) != 0) {
LOGD("origin_description : %s, new_description : %s", origin_data->description, sticker_data->description);
- g_variant_unref(body);
- body = g_variant_new("(is)", sticker_data->sticker_info_id, sticker_data->description);
- ret = _send_sync_message(gdbus_connection, body, &reply, "update_sticker_description");
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(is)", sticker_data->sticker_info_id, sticker_data->description), &reply, "update_sticker_description");
if (ret != STICKER_CLIENT_ERROR_NONE)
LOGE("failed to update sticker description");
}
if (sticker_data->group && strcmp(sticker_data->group, origin_data->group) != 0) {
LOGD("origin_group : %s, new_group : %s", origin_data->group, sticker_data->group);
- g_variant_unref(body);
- body = g_variant_new("(is)", sticker_data->sticker_info_id, sticker_data->group);
- ret = _send_sync_message(gdbus_connection, body, &reply, "update_sticker_group");
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(is)", sticker_data->sticker_info_id, sticker_data->group), &reply, "update_sticker_group");
if (ret != STICKER_CLIENT_ERROR_NONE)
LOGE("failed to update sticker group");
}
if (sticker_data->keyword) {
GVariantBuilder *keyword_builder;
- g_variant_unref(body);
keyword_builder = g_variant_builder_new(G_VARIANT_TYPE("a(s)"));
g_list_foreach(sticker_data->keyword, (GFunc) _set_keyword_builder, keyword_builder);
- body = g_variant_new("(ia(s))", sticker_data->sticker_info_id, keyword_builder);
- ret = _send_sync_message(gdbus_connection, body, &reply, "update_sticker_keyword");
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(ia(s))", sticker_data->sticker_info_id, keyword_builder), &reply, "update_sticker_keyword");
if (ret != STICKER_CLIENT_ERROR_NONE)
LOGE("failed to update sticker keyword");
+ g_variant_builder_unref(keyword_builder);
}
_free_sticker_data(origin_data);
- if (body)
- g_variant_unref(body);
-
if (reply_body)
g_variant_unref(reply_body);
{
int ret;
GDBusMessage *reply = NULL;
- GVariant *body = NULL;
GVariant *reply_body = NULL;
- body = g_variant_new("(i)", record_id);
- ret = _send_sync_message(gdbus_connection, body, &reply, "get_sticker_info");
-
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(i)", record_id), &reply, "get_sticker_info");
if (ret == STICKER_CLIENT_ERROR_NONE) {
reply_body = g_dbus_message_get_body(reply);
sticker_data->sticker_info_id = record_id;
g_variant_unref(reply_body);
}
- if (body)
- g_variant_unref(body);
-
if (reply)
g_object_unref(reply);
int ret;
GDBusMessage *reply = NULL;
GVariantIter *iter = NULL;
- GVariant *body = NULL;
GVariant *reply_body = NULL;
char *group = NULL;
return STICKER_CLIENT_ERROR_INVALID_PARAMETER;
}
- body = g_variant_new("()");
- ret = _send_sync_message(gdbus_connection, body, &reply, "get_group_list");
-
+ ret = _send_sync_message(gdbus_connection, g_variant_new("()"), &reply, "get_group_list");
if (ret == STICKER_CLIENT_ERROR_NONE) {
reply_body = g_dbus_message_get_body(reply);
g_variant_get(reply_body, "(a(s))", &iter);
g_variant_iter_free(iter);
}
- if (body)
- g_variant_unref(body);
-
if (reply_body)
g_variant_unref(reply_body);
int ret;
GDBusMessage *reply = NULL;
GVariantIter *iter = NULL;
- GVariant *body = NULL;
GVariant *reply_body = NULL;
char *keyword = NULL;
return STICKER_CLIENT_ERROR_INVALID_PARAMETER;
}
- body = g_variant_new("()");
- ret = _send_sync_message(gdbus_connection, body, &reply, "get_keyword_list");
-
+ ret = _send_sync_message(gdbus_connection, g_variant_new("()"), &reply, "get_keyword_list");
if (ret == STICKER_CLIENT_ERROR_NONE) {
reply_body = g_dbus_message_get_body(reply);
g_variant_get(reply_body, "(a(s))", &iter);
g_variant_iter_free(iter);
}
- if (body)
- g_variant_unref(body);
-
if (reply_body)
g_variant_unref(reply_body);
{
int ret;
GDBusMessage *reply = NULL;
- GVariant *body = NULL;
GVariant *reply_body = NULL;
- body = g_variant_new("(s)", app_id);
- ret = _send_sync_message(gdbus_connection, body, &reply, "get_sticker_count");
-
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(s)", app_id), &reply, "get_sticker_count");
if (ret == STICKER_CLIENT_ERROR_NONE) {
reply_body = g_dbus_message_get_body(reply);
g_variant_get(reply_body, "(i)", count);
}
- if (body)
- g_variant_unref(body);
-
if (reply_body)
g_variant_unref(reply_body);
{
int ret;
GDBusMessage *reply = NULL;
- GVariant *body = NULL;
GVariant *reply_body = NULL;
- body = g_variant_new("(ii)", offset, count);
- ret = _send_sync_message(gdbus_connection, body, &reply, "get_all_sticker_info");
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(ii)", offset, count), &reply, "get_all_sticker_info");
if (ret == STICKER_CLIENT_ERROR_NONE) {
reply_body = g_dbus_message_get_body(reply);
g_variant_get(reply_body, "(a(i))", &(*id_iter));
}
- if (body)
- g_variant_unref(body);
-
if (reply_body)
g_variant_unref(reply_body);
{
int ret;
GDBusMessage *reply = NULL;
- GVariant *body = NULL;
GVariant *reply_body = NULL;
- body = g_variant_new("(sii)", app_id, offset, count);
- ret = _send_sync_message(gdbus_connection, body, &reply, "get_sticker_info_by_appid");
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(sii)", app_id, offset, count), &reply, "get_sticker_info_by_appid");
if (ret == STICKER_CLIENT_ERROR_NONE) {
reply_body = g_dbus_message_get_body(reply);
g_variant_get(reply_body, "(a(i))", &(*id_iter));
}
- if (body)
- g_variant_unref(body);
-
if (reply_body)
g_variant_unref(reply_body);
{
int ret;
GDBusMessage *reply = NULL;
- GVariant *body = NULL;
GVariant *reply_body = NULL;
- body = g_variant_new("(iii)", (int)type, offset, count);
- ret = _send_sync_message(gdbus_connection, body, &reply, "get_sticker_info_by_type");
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(iii)", (int)type, offset, count), &reply, "get_sticker_info_by_type");
if (ret == STICKER_CLIENT_ERROR_NONE) {
reply_body = g_dbus_message_get_body(reply);
g_variant_get(reply_body, "(a(i))", &(*id_iter));
}
- if (body)
- g_variant_unref(body);
-
if (reply_body)
g_variant_unref(reply_body);
{
int ret;
GDBusMessage *reply = NULL;
- GVariant *body = NULL;
GVariant *reply_body = NULL;
- body = g_variant_new("(sii)", group, offset, count);
- ret = _send_sync_message(gdbus_connection, body, &reply, "get_sticker_info_by_group");
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(sii)", group, offset, count), &reply, "get_sticker_info_by_group");
if (ret == STICKER_CLIENT_ERROR_NONE) {
reply_body = g_dbus_message_get_body(reply);
g_variant_get(reply_body, "(a(i))", &(*id_iter));
}
- if (body)
- g_variant_unref(body);
-
if (reply_body)
g_variant_unref(reply_body);
{
int ret;
GDBusMessage *reply = NULL;
- GVariant *body = NULL;
GVariant *reply_body = NULL;
- body = g_variant_new("(sii)", keyword, offset, count);
- ret = _send_sync_message(gdbus_connection, body, &reply, "get_sticker_info_by_keyword");
+ ret = _send_sync_message(gdbus_connection, g_variant_new("(sii)", keyword, offset, count), &reply, "get_sticker_info_by_keyword");
if (ret == STICKER_CLIENT_ERROR_NONE) {
reply_body = g_dbus_message_get_body(reply);
g_variant_get(reply_body, "(a(i))", &(*id_iter));
}
- if (body)
- g_variant_unref(body);
-
if (reply_body)
g_variant_unref(reply_body);