Update License
[platform/framework/web/livebox-cpp.git] / src / livebox.cpp
index d68d030..d0755f1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012  Samsung Electronics Co., Ltd
+ * Copyright 2013  Samsung Electronics Co., Ltd
  *
  * Licensed under the Flora License, Version 1.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
 
 #include <dlog.h>
 #include <livebox.h>
+#include <livebox-errno.h>
 
 #include "livebox-cpp.h"
 #include "livebox-impl.h"
@@ -33,13 +34,13 @@ EAPI int livebox_initialize(const char *pkgname)
 
        module = CModule::FindModule(pkgname);
        if (module)
-               return 0;
+               return LB_STATUS_SUCCESS;
 
        module = CModule::Load(pkgname);
        if (!module)
-               return -EFAULT;
+               return LB_STATUS_ERROR_FAULT;
 
-       return 0;
+       return LB_STATUS_SUCCESS;
 }
 
 EAPI int livebox_finalize(const char *pkgname)
@@ -48,10 +49,10 @@ EAPI int livebox_finalize(const char *pkgname)
 
        module = CModule::FindModule(pkgname);
        if (!module)
-               return -ENOENT;
+               return LB_STATUS_ERROR_NOT_EXIST;
 
        module->Unload();
-       return 0;
+       return LB_STATUS_SUCCESS;
 }
 
 EAPI int livebox_create(const char *pkgname, const char *filename, const char *content, const char *cluster, const char *category)
@@ -62,11 +63,11 @@ EAPI int livebox_create(const char *pkgname, const char *filename, const char *c
 
        module = CModule::FindModule(pkgname);
        if (!module)
-               return -EINVAL;
+               return LB_STATUS_ERROR_INVALID;
 
        box = module->FindLiveBox(filename);
        if (box)
-               return -EEXIST;
+               return LB_STATUS_ERROR_NOT_EXIST;
 
        ret = module->Create(filename, content, cluster, category);
        return ret;
@@ -80,11 +81,11 @@ EAPI int livebox_destroy(const char *pkgname, const char *filename)
 
        module = CModule::FindModule(pkgname);
        if (!module)
-               return -EINVAL;
+               return LB_STATUS_ERROR_INVALID;
 
        box = module->FindLiveBox(filename);
        if (!box)
-               return -ENOENT;
+               return LB_STATUS_ERROR_NOT_EXIST;
 
        ret = module->Destroy(box);
        return ret;
@@ -97,11 +98,11 @@ EAPI int livebox_need_to_update(const char *pkgname, const char *filename)
 
        module = CModule::FindModule(pkgname);
        if (!module)
-               return -EINVAL;
+               return LB_STATUS_ERROR_INVALID;
 
        box = module->FindLiveBox(filename);
        if (!box)
-               return -ENOENT;
+               return LB_STATUS_ERROR_NOT_EXIST;
 
        return box->NeedToUpdate();
 }
@@ -113,11 +114,11 @@ EAPI int livebox_need_to_destroy(const char *pkgname, const char *filename)
 
        module = CModule::FindModule(pkgname);
        if (!module)
-               return -EINVAL;
+               return LB_STATUS_ERROR_INVALID;
 
        box = module->FindLiveBox(filename);
        if (!box)
-               return -ENOENT;
+               return LB_STATUS_ERROR_NOT_EXIST;
        
        return box->NeedToDestroy();
 }
@@ -129,11 +130,11 @@ EAPI int livebox_update_content(const char *pkgname, const char *filename)
 
        module = CModule::FindModule(pkgname);
        if (!module)
-               return -EINVAL;
+               return LB_STATUS_ERROR_INVALID;
 
        box = module->FindLiveBox(filename);
        if (!box)
-               return -ENOENT;
+               return LB_STATUS_ERROR_NOT_EXIST;
        
        return box->UpdateContent();
 }
@@ -145,11 +146,11 @@ EAPI int livebox_clicked(const char *pkgname, const char *filename, const char *
 
        module = CModule::FindModule(pkgname);
        if (!module)
-               return -EINVAL;
+               return LB_STATUS_ERROR_INVALID;
 
        box = module->FindLiveBox(filename);
        if (!box)
-               return -ENOENT;
+               return LB_STATUS_ERROR_NOT_EXIST;
 
        return box->Clicked(event, timestamp, x, y);
 }
@@ -161,11 +162,11 @@ EAPI int livebox_content_event(const char *pkgname, const char *filename, const
 
        module = CModule::FindModule(pkgname);
        if (!module)
-               return -EINVAL;
+               return LB_STATUS_ERROR_INVALID;
 
        box = module->FindLiveBox(filename);
        if (!box)
-               return -ENOENT;
+               return LB_STATUS_ERROR_NOT_EXIST;
 
        return box->ContentEvent(emission, source, event_info);
 }
@@ -177,11 +178,11 @@ EAPI int livebox_resize(const char *pkgname, const char *filename, int type)
 
        module = CModule::FindModule(pkgname);
        if (!module)
-               return -EINVAL;
+               return LB_STATUS_ERROR_INVALID;
 
        box = module->FindLiveBox(filename);
        if (!box)
-               return -ENOENT;
+               return LB_STATUS_ERROR_NOT_EXIST;
 
        return box->Resize(type);
 }
@@ -193,11 +194,11 @@ EAPI int livebox_change_group(const char *pkgname, const char *filename, const c
 
        module = CModule::FindModule(pkgname);
        if (!module)
-               return -EINVAL;
+               return LB_STATUS_ERROR_INVALID;
 
        box = module->FindLiveBox(filename);
        if (!box)
-               return -ENOENT;
+               return LB_STATUS_ERROR_NOT_EXIST;
 
        return box->ChangeGroup(cluster, category);
 }
@@ -209,11 +210,11 @@ EAPI int livebox_get_info(const char *pkgname, const char *filename, int *w, int
 
        module = CModule::FindModule(pkgname);
        if (!module)
-               return -EINVAL;
+               return LB_STATUS_ERROR_INVALID;
 
        box = module->FindLiveBox(filename);
        if (!box)
-               return -ENOENT;
+               return LB_STATUS_ERROR_NOT_EXIST;
 
        return box->GetInfo(w, h, priority, content, title);
 }
@@ -224,7 +225,7 @@ EAPI int livebox_need_to_create(const char *pkgname, const char *cluster, const
 
        module = CModule::FindModule(pkgname);
        if (!module)
-               return -EINVAL;
+               return LB_STATUS_ERROR_INVALID;
 
        return module->NeedToCreate(cluster, category);
 }