return STICKER_ERROR_INVALID_PARAMETER;
if (!data_handle->app_id)
- return STICKER_ERROR_OPERATION_FAILED;
+ return STICKER_ERROR_NO_DATA;
*app_id = strdup(data_handle->app_id);
return STICKER_ERROR_INVALID_PARAMETER;
if (!data_handle->type || !data_handle->uri)
- return STICKER_ERROR_OPERATION_FAILED;
+ return STICKER_ERROR_NO_DATA;
*type = data_handle->type;
*uri = strdup(data_handle->uri);
return STICKER_ERROR_INVALID_PARAMETER;
if (!data_handle->keyword)
- return STICKER_ERROR_OPERATION_FAILED;
+ return STICKER_ERROR_NO_DATA;
GList *list = NULL;
for(list = g_list_first(data_handle->keyword); list != NULL; list=list->next) {
return STICKER_ERROR_INVALID_PARAMETER;
if (!data_handle->group)
- return STICKER_ERROR_OPERATION_FAILED;
+ return STICKER_ERROR_NO_DATA;
*group = strdup(data_handle->group);
return STICKER_ERROR_INVALID_PARAMETER;
if (!data_handle->date)
- return STICKER_ERROR_OPERATION_FAILED;
+ return STICKER_ERROR_NO_DATA;
*date = strdup(data_handle->date);
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);
- 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);
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)
+ if (ret != STICKER_CLIENT_ERROR_NONE) {
LOGE("failed to update sticker uri");
+ goto cleanup;
+ }
+ }
+
+ if (sticker_data->type != 0 && sticker_data->type != origin_data->type) {
+ LOGD("origin_type : %d, new_type : %d", origin_data->type, sticker_data->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");
+ goto cleanup;
+ }
}
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);
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)
+ if (ret != STICKER_CLIENT_ERROR_NONE) {
LOGE("failed to update sticker thumbnail");
+ goto cleanup;
+ }
}
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);
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)
+ if (ret != STICKER_CLIENT_ERROR_NONE) {
LOGE("failed to update sticker description");
+ goto cleanup;
+ }
}
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);
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)
+ if (ret != STICKER_CLIENT_ERROR_NONE) {
LOGE("failed to update sticker group");
+ goto cleanup;
+ }
}
if (sticker_data->disp_type != 0 && sticker_data->disp_type != origin_data->disp_type) {
LOGD("origin_disp_type : %d, new_disp_type : %d", origin_data->disp_type, sticker_data->disp_type);
ret = _send_sync_message(gdbus_connection, g_variant_new("(ii)", sticker_data->sticker_info_id, sticker_data->disp_type), &reply, "update_sticker_disp_type");
- if (ret != STICKER_CLIENT_ERROR_NONE)
+ if (ret != STICKER_CLIENT_ERROR_NONE) {
LOGE("failed to update sticker display type");
+ goto cleanup;
+ }
}
if (sticker_data->keyword) {
g_variant_builder_unref(keyword_builder);
}
+cleanup:
_free_sticker_data(origin_data);
if (reply_body)
STICKER_CLIENT_ERROR_SERVICE_NOT_READY,
STICKER_CLIENT_ERROR_OPERATION_FAILED,
STICKER_CLIENT_ERROR_IO_ERROR,
+ STICKER_CLIENT_ERROR_DB_FAILED,
+ STICKER_CLIENT_ERROR_FILE_EXISTS,
+ STICKER_CLIENT_ERROR_NO_SUCH_FILE,
};
int sticker_dbus_init(GDBusConnection **gdbus_connection, int *server_watcher_id,
* @retval #STICKER_ERROR_NONE Successful
* @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
* @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
+ * @retval #STICKER_ERROR_NO_DATA No data available
*/
int sticker_data_get_app_id(sticker_data_h data_handle, char **app_id);
* @retval #STICKER_ERROR_NONE Successful
* @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
* @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
* @see sticker_data_get_uri()
*/
int sticker_data_set_uri(sticker_data_h data_handle, sticker_data_uri_type_e type, const char *uri);
* @retval #STICKER_ERROR_NONE Successful
* @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
* @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
+ * @retval #STICKER_ERROR_NO_DATA No data available
* @see sticker_data_set_uri()
*/
int sticker_data_get_uri(sticker_data_h data_handle, sticker_data_uri_type_e *type, char **uri);
* @retval #STICKER_ERROR_NONE Successful
* @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
* @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
+ * @retval #STICKER_ERROR_NO_DATA No data available
* @post This function invokes sticker_data_keyword_foreach_cb() repeatedly for getting keywords.
* @see sticker_data_keyword_foreach_cb()
* @see sticker_data_add_keyword()
* @retval #STICKER_ERROR_NONE Successful
* @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
* @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
+ * @retval #STICKER_ERROR_NO_DATA No data available
* @see sticker_data_set_group()
*/
int sticker_data_get_group_name(sticker_data_h data_handle, char **group);
* @retval #STICKER_ERROR_NONE Successful
* @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
* @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
+ * @retval #STICKER_ERROR_NO_DATA No data available
*/
int sticker_data_get_date(sticker_data_h data_handle, char **date);
STICKER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
STICKER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
STICKER_ERROR_OPERATION_FAILED = TIZEN_ERROR_STICKER | 0x0001, /**< Operation failed */
+ STICKER_ERROR_FILE_EXISTS = TIZEN_ERROR_FILE_EXISTS, /**< File exists */
+ STICKER_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< No data available */
+ STICKER_ERROR_NO_SUCH_FILE = TIZEN_ERROR_FILE_EXISTS, /**< No such file */
} sticker_error_e;
/**
* @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
* @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
+ * @retval #STICKER_ERROR_FILE_EXISTS File exists
+ * @retval #STICKER_ERROR_NO_SUCH_FILE No such file
* @see sticker_provider_update_data()
* @see sticker_provider_delete_data()
*/
* @retval #STICKER_ERROR_NOT_SUPPORTED Not supported
* @retval #STICKER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #STICKER_ERROR_OPERATION_FAILED Operation failed
+ * @retval #STICKER_ERROR_FILE_EXISTS File exists
+ * @retval #STICKER_ERROR_NO_SUCH_FILE No such file
* @see sticker_provider_insert_data()
* @see sticker_provider_delete_data()
*/
ret = sticker_dbus_insert_sticker_info(provider_handle->gdbus_connection, data_handle);
if (ret != STICKER_ERROR_NONE) {
LOGE("Failed to insert sticker information : %d", ret);
- return STICKER_ERROR_OPERATION_FAILED;
+ if (ret == STICKER_CLIENT_ERROR_FILE_EXISTS)
+ return STICKER_ERROR_FILE_EXISTS;
+ else if (ret == STICKER_CLIENT_ERROR_NO_SUCH_FILE)
+ return STICKER_ERROR_NO_SUCH_FILE;
+ else
+ return STICKER_ERROR_OPERATION_FAILED;
}
return STICKER_ERROR_NONE;
ret = sticker_dbus_update_sticker_info(provider_handle->gdbus_connection, data_handle);
if (ret != STICKER_ERROR_NONE) {
LOGE("Failed to update sticker information : %d", ret);
- return STICKER_ERROR_OPERATION_FAILED;
+ if (ret == STICKER_CLIENT_ERROR_FILE_EXISTS)
+ return STICKER_ERROR_FILE_EXISTS;
+ else if (ret == STICKER_CLIENT_ERROR_NO_SUCH_FILE)
+ return STICKER_ERROR_NO_SUCH_FILE;
+ else
+ return STICKER_ERROR_OPERATION_FAILED;
}
return STICKER_ERROR_NONE;
sticker_info->uri = _convert_sticker_uri(sticker_info->uri, sticker_info->app_id);
if (!sticker_info->uri) {
LOGE("failed to copy sticker file");
- ret = STICKERD_SERVER_ERROR_OPERATION_FAILED;
+ ret = STICKERD_SERVER_ERROR_FILE_EXISTS;
goto cleanup;
}
} else {
LOGE("sticker file does not exist");
- ret = STICKERD_SERVER_ERROR_OPERATION_FAILED;
+ ret = STICKERD_SERVER_ERROR_NO_SUCH_FILE;
goto cleanup;
}
}
sticker_info->uri = _convert_sticker_uri(sticker_info->uri, sticker_info->app_id);
if (!sticker_info->uri)
goto free_memory;
+ } else {
+ goto free_memory;
}
}
uri = _convert_sticker_uri(uri, app_id);
if (!uri) {
LOGE("failed to copy sticker file");
- return STICKERD_SERVER_ERROR_OPERATION_FAILED;
+ return STICKERD_SERVER_ERROR_FILE_EXISTS;
}
+ } else {
+ return STICKERD_SERVER_ERROR_NO_SUCH_FILE;
}
}
*/
enum stickerd_server_error {
STICKERD_SERVER_ERROR_NONE,
- STICKERD_SERVER_ERROR_IO_ERROR,
STICKERD_SERVER_ERROR_INVALID_PARAMETER,
STICKERD_SERVER_ERROR_PERMISSION_DENIED,
STICKERD_SERVER_ERROR_OUT_OF_MEMORY,
STICKERD_SERVER_ERROR_SERVICE_NOT_READY,
STICKERD_SERVER_ERROR_OPERATION_FAILED,
+ STICKERD_SERVER_ERROR_IO_ERROR,
STICKERD_SERVER_ERROR_DB_FAILED,
+ STICKERD_SERVER_ERROR_FILE_EXISTS,
+ STICKERD_SERVER_ERROR_NO_SUCH_FILE,
};
/**