Apply ACR
authorhyun lee <hyunn.lee@samsung.com>
Mon, 20 Oct 2014 08:36:47 +0000 (17:36 +0900)
committerhyun lee <hyunn.lee@samsung.com>
Mon, 20 Oct 2014 11:16:08 +0000 (20:16 +0900)
Change-Id: Ib0199e685da6ff049018e63b886cbdf6a2e262e3
Signed-off-by: hyun lee <hyunn.lee@samsung.com>
doc/shortcut_doc.h
doc_prod/shortcut_doc.h
lib/CMakeLists.txt
lib/include/shortcut.h
lib/include/shortcut_manager.h [new file with mode: 0755]
lib/include/shortcut_private.h
lib/src/main.c
packaging/libshortcut.spec

index 3b5107c..6469494 100755 (executable)
@@ -38,41 +38,28 @@ If home screen implements the shortcut service using the library, the applicatio
 The following are two separate APIs to support the "add to home" feature. 
  
 \code
-typedef int (*result_cb_t)(int ret, int pid, void *data)
+typedef int (*result_cb_t)(int ret, void *data)
 
-extern int shortcut_add_shortcut(const char *pkgname, const char *name, int type, const char *content_info, const char *icon, result_cb_t result_cb, void *data)
-extern int shortcut_add_dynamicbox(const char *pkgname, const char *name, int type, const char *content, const char *icon, double period, result_cb_t result_cb, void *data)
+extern int shortcut_add_to_home(const char *name, shortcut_type type, const char *uri, const char *icon, int allow_duplicate, result_cb_t result_cb, void *data)
 \endcode
 
-Currently, our home screen can contain two different types of contents (that are pure shortcuts and dynamicboxes).
-
-To add a pure shortcut i.e., simply for launching an app, developers can use the "shortcut_add_shortcut" API to deliver their shortcuts to a home screen.
+Currently, our home screen can contain two different types of contents (that are pure shortcuts).
 
-If your application supports our dynamicbox service and implements a dynamicbox type shortcut, then you can use the "shortcut_add_dynamicbox" API to have a home screen add the dynamicbox on its screen.
+To add a pure shortcut i.e., simply for launching an app, developers can use the "shortcut_add_to_home" API to deliver their shortcuts to a home screen.
 
 <TABLE>
 <TR><TH>Parameters</TH><TH>Comment</TH></TR>
-<TR><TD>pkgname</TD><TD>Package name</TD></TR>
 <TR><TD>name</TD><TD>Application name which will be displayed on the screen</TD></TR>
-<TR><TD>type</TD><TD>Basically it describes launching options whether to use a package name or URI. LAUNCH_BY_PACKAGE or LAUNCH_BY_URI</TD></TR>
+<TR><TD>type</TD><TD>Basically it describes launching options whether to use a package name or URI. LAUNCH_BY_APP or LAUNCH_BY_URI</TD></TR>
 <TR><TD>content</TD><TD>
-Application data used for creating a pure shortcut or creating a dynamicbox
+Application data used for creating a pure shortcut
 
     Shortcut
 
-1. If the type is Launch by package: None
+1. If the type is Launch by app: None
 
 2. If the type is Launch by URI: Put the URI in the content
 
-    Dynamicbox: any data necessary to create a dynamicbox. Basically, it will be passed to the dynamicbox plug-in's create function.
-</TD></TR>
-<TR><TD>icon</TD><TD>Absolute path to the icon file, If you set this to "NULL", the home screen will use the deafult icon file (but it is depends on the homescreen implementations)</TD></TR>
-<TR><TD>period</TD><TD>&lt;Only for dynamicbox> Update period. The period must be greater than 0.0f</TD></TR>
-<TR><TD>result_cb</TD><TD>Result callback. The callback will be called after a shortcut or dynamicbox has been added. Don't forget to check the return value.</TD></TR>
-<TR><TD>data</TD><TD>Callback data</TD></TR>
-</TABLE>
-
 <H3>2.1.1 Supported types</H3>
 shortcut.h Enumeration values for type of shortcuts
 
@@ -143,7 +130,7 @@ The shortcut listing application will launch your application using app-svc with
 It will use the pkgname and param attrbute to launch your application.
 The shortcut list view will launch your "[App] Shortcut list" using the following code.
 
-When your app is launched, the app should send a selected item as a shortcut or dynamicbox to the home screen using "shortcut_add" series functions mentioned above.
+When your app is launched, the app should send a selected item as a shortcut to the home screen using "shortcut_add" series functions mentioned above.
 
 <H3>2.2.3 What each app has to do</H3>
 You can implement your shortcut list view using App or UG.
@@ -159,7 +146,7 @@ Who is going to handle the shortcut
 </LI>
 </UL>
 
-In your shortcut list view, you just call the "shortcut_add_shortcut" or "shortcut_add_dynamicbox" which are described in the section 2.1
+In your shortcut list view, you just call the "shortcut_add_to_home" which is described in the section 2.1
 
 <H4>2.2.3.1 Handled by App</H4>
 \image html ShortcutApp.png
@@ -178,43 +165,6 @@ If you didn't destroy it, it will be reside on the process list. and it will not
 Currently, the UG container process only supports multiple instance for a process.
 So if the user tries to add a new shortcut again from the shortcut list application, your UG will be launched again if you didn't
 terminate previous UG process (when you got PAUSE event).
-
-<H1>3. What the home screen should do</H1>
-\code
-typedef int (*request_cb_t)(const char *pkgname, const char *name, int type, const char *content_info, const char *icon, int pid, double period, void *data)
-extern int shortcut_set_request_cb(request_cb_t request_cb, void *data)
-\endcode
-
-<TABLE>
-<TR><TH>Parameter</TH><TH>Comment</TH></TR>
-<TR><TD>pkgname</TD><TD>Package name to be added</TD></TR>
-<TR><TD>name</TD><TD>Application name to be displayed on the screen</TD></TR>
-<TR><TD>type</TD><TD>LAUNCH_BY_PACKAGE or LAUNCH_BY_URI</TD></TR>
-<TR><TD>content_info</TD><TD>Used for the dynamicbox, or homescreen by itself if it required.</TD></TR>
-<TR><TD>icon</TD><TD>Absolute path of the icon file. (If it is not exists, the homescreen can use the deafult icon file)</TD></TR>
-<TR><TD>pid</TD><TD>Reuquestor's Process ID</TD></TR>
-<TR><TD>period</TD><TD>Update period only for the dynamicbox</TD></TR>
-<TR><TD>data</TD><TD>Callback data</TD></TR>
-</TABLE>
-
-<H1>4. To list up shortcuts registered in the device</H1>
-<TABLE>
-<TR><TH>shortcut-list viewer will launch your app by this way</TH></TR>
-<TR><TD>
-\code
-int shortcut_get_list(const char *pkgname, int (*cb)(const char *pkgname, const char *icon, const char *name, const char *extra_key, const char *extra_data, void *data), void *data)
-\endcode
-</TD></TR>
-</TABLE>
-
-If you specified the "pkgname", this API will only gather the given Package's shortcut list.
-If you set is to NULL, this API will gathering all shortcuts.
-Every shortcut item will be passed via "cb" callback function. so it will be invoked N times if the number of registered shortcut item is N.
-pkgname and name and param is described in the XML file of each application package.
-It will returns the number of shortcut items, or return <0 as an error value.
-
--EIO : failed to access the shortcut list DB
-> 0 : Number of shortcut items (count of callback function calling)
  *
  */
 
index 3b5107c..6469494 100755 (executable)
@@ -38,41 +38,28 @@ If home screen implements the shortcut service using the library, the applicatio
 The following are two separate APIs to support the "add to home" feature. 
  
 \code
-typedef int (*result_cb_t)(int ret, int pid, void *data)
+typedef int (*result_cb_t)(int ret, void *data)
 
-extern int shortcut_add_shortcut(const char *pkgname, const char *name, int type, const char *content_info, const char *icon, result_cb_t result_cb, void *data)
-extern int shortcut_add_dynamicbox(const char *pkgname, const char *name, int type, const char *content, const char *icon, double period, result_cb_t result_cb, void *data)
+extern int shortcut_add_to_home(const char *name, shortcut_type type, const char *uri, const char *icon, int allow_duplicate, result_cb_t result_cb, void *data)
 \endcode
 
-Currently, our home screen can contain two different types of contents (that are pure shortcuts and dynamicboxes).
-
-To add a pure shortcut i.e., simply for launching an app, developers can use the "shortcut_add_shortcut" API to deliver their shortcuts to a home screen.
+Currently, our home screen can contain two different types of contents (that are pure shortcuts).
 
-If your application supports our dynamicbox service and implements a dynamicbox type shortcut, then you can use the "shortcut_add_dynamicbox" API to have a home screen add the dynamicbox on its screen.
+To add a pure shortcut i.e., simply for launching an app, developers can use the "shortcut_add_to_home" API to deliver their shortcuts to a home screen.
 
 <TABLE>
 <TR><TH>Parameters</TH><TH>Comment</TH></TR>
-<TR><TD>pkgname</TD><TD>Package name</TD></TR>
 <TR><TD>name</TD><TD>Application name which will be displayed on the screen</TD></TR>
-<TR><TD>type</TD><TD>Basically it describes launching options whether to use a package name or URI. LAUNCH_BY_PACKAGE or LAUNCH_BY_URI</TD></TR>
+<TR><TD>type</TD><TD>Basically it describes launching options whether to use a package name or URI. LAUNCH_BY_APP or LAUNCH_BY_URI</TD></TR>
 <TR><TD>content</TD><TD>
-Application data used for creating a pure shortcut or creating a dynamicbox
+Application data used for creating a pure shortcut
 
     Shortcut
 
-1. If the type is Launch by package: None
+1. If the type is Launch by app: None
 
 2. If the type is Launch by URI: Put the URI in the content
 
-    Dynamicbox: any data necessary to create a dynamicbox. Basically, it will be passed to the dynamicbox plug-in's create function.
-</TD></TR>
-<TR><TD>icon</TD><TD>Absolute path to the icon file, If you set this to "NULL", the home screen will use the deafult icon file (but it is depends on the homescreen implementations)</TD></TR>
-<TR><TD>period</TD><TD>&lt;Only for dynamicbox> Update period. The period must be greater than 0.0f</TD></TR>
-<TR><TD>result_cb</TD><TD>Result callback. The callback will be called after a shortcut or dynamicbox has been added. Don't forget to check the return value.</TD></TR>
-<TR><TD>data</TD><TD>Callback data</TD></TR>
-</TABLE>
-
 <H3>2.1.1 Supported types</H3>
 shortcut.h Enumeration values for type of shortcuts
 
@@ -143,7 +130,7 @@ The shortcut listing application will launch your application using app-svc with
 It will use the pkgname and param attrbute to launch your application.
 The shortcut list view will launch your "[App] Shortcut list" using the following code.
 
-When your app is launched, the app should send a selected item as a shortcut or dynamicbox to the home screen using "shortcut_add" series functions mentioned above.
+When your app is launched, the app should send a selected item as a shortcut to the home screen using "shortcut_add" series functions mentioned above.
 
 <H3>2.2.3 What each app has to do</H3>
 You can implement your shortcut list view using App or UG.
@@ -159,7 +146,7 @@ Who is going to handle the shortcut
 </LI>
 </UL>
 
-In your shortcut list view, you just call the "shortcut_add_shortcut" or "shortcut_add_dynamicbox" which are described in the section 2.1
+In your shortcut list view, you just call the "shortcut_add_to_home" which is described in the section 2.1
 
 <H4>2.2.3.1 Handled by App</H4>
 \image html ShortcutApp.png
@@ -178,43 +165,6 @@ If you didn't destroy it, it will be reside on the process list. and it will not
 Currently, the UG container process only supports multiple instance for a process.
 So if the user tries to add a new shortcut again from the shortcut list application, your UG will be launched again if you didn't
 terminate previous UG process (when you got PAUSE event).
-
-<H1>3. What the home screen should do</H1>
-\code
-typedef int (*request_cb_t)(const char *pkgname, const char *name, int type, const char *content_info, const char *icon, int pid, double period, void *data)
-extern int shortcut_set_request_cb(request_cb_t request_cb, void *data)
-\endcode
-
-<TABLE>
-<TR><TH>Parameter</TH><TH>Comment</TH></TR>
-<TR><TD>pkgname</TD><TD>Package name to be added</TD></TR>
-<TR><TD>name</TD><TD>Application name to be displayed on the screen</TD></TR>
-<TR><TD>type</TD><TD>LAUNCH_BY_PACKAGE or LAUNCH_BY_URI</TD></TR>
-<TR><TD>content_info</TD><TD>Used for the dynamicbox, or homescreen by itself if it required.</TD></TR>
-<TR><TD>icon</TD><TD>Absolute path of the icon file. (If it is not exists, the homescreen can use the deafult icon file)</TD></TR>
-<TR><TD>pid</TD><TD>Reuquestor's Process ID</TD></TR>
-<TR><TD>period</TD><TD>Update period only for the dynamicbox</TD></TR>
-<TR><TD>data</TD><TD>Callback data</TD></TR>
-</TABLE>
-
-<H1>4. To list up shortcuts registered in the device</H1>
-<TABLE>
-<TR><TH>shortcut-list viewer will launch your app by this way</TH></TR>
-<TR><TD>
-\code
-int shortcut_get_list(const char *pkgname, int (*cb)(const char *pkgname, const char *icon, const char *name, const char *extra_key, const char *extra_data, void *data), void *data)
-\endcode
-</TD></TR>
-</TABLE>
-
-If you specified the "pkgname", this API will only gather the given Package's shortcut list.
-If you set is to NULL, this API will gathering all shortcuts.
-Every shortcut item will be passed via "cb" callback function. so it will be invoked N times if the number of registered shortcut item is N.
-pkgname and name and param is described in the XML file of each application package.
-It will returns the number of shortcut items, or return <0 as an error value.
-
--EIO : failed to access the shortcut list DB
-> 0 : Number of shortcut items (count of callback function calling)
  *
  */
 
index 009fd32..4444b43 100755 (executable)
@@ -46,6 +46,8 @@ SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/lib/include/shortcut.h DESTINATION include/${PROJECT_NAME})
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/lib/include/shortcut_product.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/lib/include/shortcut_private.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/lib/include/shortcut_manager.h DESTINATION include/${PROJECT_NAME})
 INSTALL(FILES ${CMAKE_BINARY_DIR}/lib/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/lib/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}")
 
index 75fc73a..ab35a08 100755 (executable)
@@ -19,6 +19,7 @@
 #define __SHORTCUT_H__
 
 #include <tizen.h>
+#include <shortcut_manager.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -67,7 +68,7 @@ typedef int (*request_cb_t)(const char *appid, const char *name, int type, const
                otherwise errno
  * @see add_to_home_shortcut()
  */
-typedef int (*result_cb_t)(int ret, int pid, void *data);
+typedef int (*result_internal_cb_t)(int ret, int pid, void *data);
 
 /**
  * @brief Enumeration for shortcut types.
@@ -78,16 +79,12 @@ typedef int (*result_cb_t)(int ret, int pid, void *data);
  *          #LAUNCH_BY_URI is used for adding a shortcut for "uri" data.
  * @since_tizen 2.3
  */
-enum shortcut_type {
+enum shortcut_internal_type {
        /**< Deprecated type */
        SHORTCUT_PACKAGE        = 0x00000000,   /**< Launch the package using the given package name */
        SHORTCUT_DATA           = 0x00000001,   /**< Launch the related package with the given data(content_info) */
        SHORTCUT_FILE           = 0x00000002,   /**< Launch the related package with the given filename(content_info) */
 
-       /**< Use these */
-       LAUNCH_BY_PACKAGE       = 0x00000000,   /**< Launch the package using the given package name */
-       LAUNCH_BY_URI           = 0x00000001,   /**< Launch the related package with the given data(URI) */
-
        SHORTCUT_REMOVE         = 0x40000000,   /**< Remove a shortcut */
        DYNAMICBOX_REMOVE               = 0x80000000,   /**< Remove a dynamicbox */
 
@@ -112,22 +109,13 @@ enum shortcut_type {
  * @brief Enumeration for values of shortcut response types.
  * @since_tizen 2.3
  */
-enum shortcut_error_e {
-       SHORTCUT_ERROR_NONE = 0x00000000,                               /**< Successfully handled */
+enum shortcut_internal_error_e {
        SHORTCUT_ERROR = 0x80000000,                            /**< MSB(1). Check this using the #SHORTCUT_STATUS_IS_ERROR macro  */
-       SHORTCUT_ERROR_NO_SPACE = SHORTCUT_ERROR | 0x0001,      /**< There is no space to add a new shortcut */
-       SHORTCUT_ERROR_EXIST = SHORTCUT_ERROR | 0x0002,         /**< Shortcut is already added */
-       SHORTCUT_ERROR_FAULT = SHORTCUT_ERROR | 0x0004,         /**< Failed to add a shortcut. Unrecoverable error */
-       SHORTCUT_ERROR_UNSUPPORTED = SHORTCUT_ERROR | 0x0008,   /**< Unsupported shortcut */
-       SHORTCUT_ERROR_BUSY = SHORTCUT_ERROR | 0x0010,          /**< Receiver is busy, try again later */
-       SHORTCUT_ERROR_INVALID_PARAMETER = SHORTCUT_ERROR | 0x0020,     /**< Shortcut request is not valid, invalid parameter or invalid argument value */
-       SHORTCUT_ERROR_COMM = SHORTCUT_ERROR | 0x0040,          /**< Connection is not established. or there is a problem in the communication */ 
-       SHORTCUT_ERROR_OUT_OF_MEMORY = SHORTCUT_ERROR | 0x0080, /**< Memory is not enough to handle a new request */
-       SHORTCUT_ERROR_IO_ERROR = SHORTCUT_ERROR | 0x0100,              /**< Unable to access the file or DB. Check your resource files */
-       SHORTCUT_ERROR_PERMISSION_DENIED = SHORTCUT_ERROR | 0x0200,     /**< Has no permission to add a shortcut */
-       SHORTCUT_ERROR_NOT_SUPPORTED = SHORTCUT_ERROR | 0x0400, /**< Shortcut is not supported */
 
-       SHORTCUT_STATUS_CARED = 0x08000000                      /**< Shortcut status is already cared. Check this using the #SHORTCUT_STATUS_IS_CARED macro */
+       SHORTCUT_STATUS_CARED = 0x08000000,                     /**< Shortcut status is already cared. Check this using the #SHORTCUT_STATUS_IS_CARED macro */
+
+       SHORTCUT_ERROR_BUSY = TIZEN_ERROR_RESOURCE_BUSY,                /**< Receiver is busy, try again later */
+       SHORTCUT_ERROR_UNSUPPORTED = SHORTCUT_ERROR | 0x0400    /**< Shortcut is not supported */
 };
 
 /**
@@ -283,7 +271,7 @@ extern int shortcut_set_request_cb(request_cb_t request_cb, void *data);
  *
  * @post You have to check the return status from the callback function which is passed by the argument.
  *
- * @see result_cb_t
+ * @see result_internal_cb_t
  *
  * @par Example
  * @code
@@ -315,7 +303,7 @@ extern int shortcut_set_request_cb(request_cb_t request_cb, void *data);
  *
  * @endcode
  */
-extern int add_to_home_shortcut(const char *appid, const char *name, int type, const char *content_info, const char *icon, int allow_duplicate, result_cb_t result_cb, void *data);
+extern int add_to_home_shortcut(const char *appid, const char *name, int type, const char *content_info, const char *icon, int allow_duplicate, result_internal_cb_t result_cb, void *data);
 
 /**
  *
@@ -354,7 +342,7 @@ extern int add_to_home_shortcut(const char *appid, const char *name, int type, c
  *
  * @post You have to check the return status from the callback function which is passed by the argument.
  *
- * @see result_cb_t
+ * @see result_internal_cb_t
  */
 extern int shortcut_get_list(const char *appid, int (*cb)(const char *appid, const char *icon, const char *name, const char *extra_key, const char *extra_data, void *data), void *data);
 
@@ -406,7 +394,7 @@ extern int shortcut_get_list(const char *appid, int (*cb)(const char *appid, con
  *
  * @post You have to check the return status from the callback function which is passed by the argument.
  *
- * @see result_cb_t
+ * @see result_internal_cb_t
  *
  * @par Example
  * @code
@@ -438,7 +426,7 @@ extern int shortcut_get_list(const char *appid, int (*cb)(const char *appid, con
  *
  * @endcode
  */
-extern int add_to_home_dynamicbox(const char *appid, const char *name, int type, const char *content, const char *icon, double period, int allow_duplicate, result_cb_t result_cb, void *data);
+extern int add_to_home_dynamicbox(const char *appid, const char *name, int type, const char *content, const char *icon, double period, int allow_duplicate, result_internal_cb_t result_cb, void *data);
 
 /**
  * @}
diff --git a/lib/include/shortcut_manager.h b/lib/include/shortcut_manager.h
new file mode 100755 (executable)
index 0000000..685e7b5
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+#ifndef __SHORTCUT_MANAGER_H__
+#define __SHORTCUT_MANAGER_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file shortcut_manager.h
+ * @brief This file declares the API of the libshortcut library.
+ */
+
+/**
+ * @addtogroup SHORTCUT_MODULE
+ * @{
+ */
+
+/**
+ * @brief Called to receive the result of shortcut_add_to_home().
+ * @since_tizen 2.3
+ * @param[in] ret The result value, it could be @c 0 if it succeeds to add a shortcut, 
+ *                otherwise it returns an errno
+ * @param[in] data The callback data
+ * @return int @c 0 if there is no error,
+               otherwise errno
+ * @see shortcut_add_to_home()
+ */
+typedef int (*result_cb_t)(int ret, void *data);
+
+/**
+ * @brief Enumeration for shortcut types.
+ * @details Basically, three types of shortcuts are defined.
+ *          Every homescreen developer should support these types of shortcuts.
+ *          Or return a proper errno to figure out why the application failed to add a shortcut.
+ *          #LAUNCH_BY_APP is used for adding a package itself as a shortcut.
+ *          #LAUNCH_BY_URI is used for adding a shortcut for "uri" data.
+ * @since_tizen 2.3
+ */
+typedef enum _shortcut_type {
+       /**< Use these */
+       LAUNCH_BY_APP   = 0x00000000,   /**< Launch the application itself */
+       LAUNCH_BY_URI   = 0x00000001,   /**< Launch the application with the given data(URI) */
+} shortcut_type;
+
+/**
+ * @brief Enumeration for values of shortcut response types.
+ * @since_tizen 2.3
+ */
+enum shortcut_error_e {
+       SHORTCUT_ERROR_NONE = TIZEN_ERROR_NONE,                         /**< Successfully handled */
+       SHORTCUT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,       /**< Shortcut request is not valid, invalid parameter or invalid argument value */
+       SHORTCUT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,       /**< Memory is not enough to handle a new request */
+       SHORTCUT_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR,         /**< Unable to access the file or DB. Check your resource files */
+       SHORTCUT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,       /**< Has no permission to add a shortcut */
+       SHORTCUT_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED,       /**< Not supported shortcut */
+       SHORTCUT_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY,               /**< Receiver is busy, try again later */
+       SHORTCUT_ERROR_NO_SPACE = TIZEN_ERROR_SHORTCUT | 0x0001,        /**< There is no space to add a new shortcut */
+       SHORTCUT_ERROR_EXIST = TIZEN_ERROR_SHORTCUT | 0x0002,           /**< Shortcut is already added */
+       SHORTCUT_ERROR_FAULT = TIZEN_ERROR_SHORTCUT | 0x0004,           /**< Failed to add a shortcut. Unrecoverable error */
+       SHORTCUT_ERROR_COMM = TIZEN_ERROR_SHORTCUT | 0x0040             /**< Connection is not established. or there is a problem in the communication */
+};
+
+/**
+ *
+ * @brief Supports the add_to_home feature, should invoke this.
+ *
+ * @details
+ * Sync (or) Async:
+ * This is an asynchronous API.
+ *
+ * @since_tizen 2.3
+ *
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/shortcut
+ *
+ * @remarks Application must check the return value of this function.\n
+ * Application must check the return status from the callback function.\n
+ * Application should set the callback function to get the result of this request.
+ * @remarks If a homescreen does not support this feature, you will get a proper error code.
+ *
+ * @param[in] name The name of the created shortcut icon
+ * @param[in] type The type of shortcuts
+ * @param[in] uri The specific information for delivering to the viewer for creating a shortcut
+ * @param[in] icon The absolute path of an icon file
+ * @param[in] allow_duplicate @c 1 if it accepts the duplicated shortcut,
+ *                            otherwise @c 0
+ * @param[in] result_cb The address of the callback function that is called when the result comes back from the viewer
+ * @param[in] data The callback data that is used in the callback function
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #SHORTCUT_ERROR_NONE Successful
+ * @retval #SHORTCUT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SHORTCUT_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #SHORTCUT_ERROR_IO_ERROR I/O error
+ * @retval #SHORTCUT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #SHORTCUT_ERROR_NOT_SUPPORTED Not supported
+ * @retval #SHORTCUT_ERROR_BUSY Device or resource busy
+ * @retval #SHORTCUT_ERROR_NO_SPACE No space
+ * @retval #SHORTCUT_ERROR_EXIST Already exist
+ * @retval #SHORTCUT_ERROR_FAULT Unrecoverable error
+ * @retval #SHORTCUT_ERROR_COMM Connection failed
+ *
+ * @pre You have to prepare the callback function.
+ *
+ * @post You have to check the return status from the callback function which is passed by the argument.
+ *
+ * @see result_cb_t
+ *
+ * @par Example
+ * @code
+ *
+ * #include <stdio.h>
+ * #include <shortcut.h>
+ *
+ * static int result_cb(int ret, int pid, void *data)
+ * {
+ *     if (ret < 0)
+ *             printf("Failed to add a shortcut: %s\n", perror(ret));
+ *
+ *     printf("Processed by the %d\n", pid);
+ *     return 0;
+ * }
+ *
+ * static int app_create(void *data)
+ * {
+ *     shortcut_add_to_home("With friends",
+ *                                     LAUNCH_BY_URI, "gallery:0000-0000",
+ *                                     "/opt/media/Pictures/Friends.jpg", 0, result_cb, NULL);
+ *     return 0;
+ * }
+ *
+ * int main(int argc, char *argv[])
+ * {
+ *     appcore....
+ * }
+ *
+ * @endcode
+ */
+extern int shortcut_add_to_home(const char *name, shortcut_type type, const char *uri, const char *icon, int allow_duplicate, result_cb_t result_cb, void *data);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index 7596789..096e7b6 100755 (executable)
@@ -97,7 +97,7 @@ extern FILE *__file_log_fp;
  *
  * @post You have to check the return status from callback function which is passed by argument.
  *
- * @see result_cb_t
+ * @see result_internal_cb_t
  *
  * @par Example
  * @code
@@ -129,7 +129,7 @@ extern FILE *__file_log_fp;
  *
  * @endcode
  */
-extern int add_to_home_remove_shortcut(const char *appid, const char *name, const char *content_info, result_cb_t result_cb, void *data);
+extern int add_to_home_remove_shortcut(const char *appid, const char *name, const char *content_info, result_internal_cb_t result_cb, void *data);
 
 /**
  *
@@ -169,7 +169,7 @@ extern int add_to_home_remove_shortcut(const char *appid, const char *name, cons
  *
  * @post You have to check the return status from callback function which is passed by argument.
  *
- * @see result_cb_t
+ * @see result_internal_cb_t
  *
  * @par Example
  * @code
@@ -199,6 +199,6 @@ extern int add_to_home_remove_shortcut(const char *appid, const char *name, cons
  *
  * @endcode
  */
-extern int add_to_home_remove_dynamicbox(const char *appid, const char *name, result_cb_t result_cb, void *data);
+extern int add_to_home_remove_dynamicbox(const char *appid, const char *name, result_internal_cb_t result_cb, void *data);
 
 /* End of a file */
index a94f000..23dbe83 100755 (executable)
@@ -343,7 +343,7 @@ EAPI int shortcut_set_request_cb(request_cb_t request_cb, void *data)
 
 
 struct result_cb_item {
-       result_cb_t result_cb;
+       result_internal_cb_t result_cb;
        void *data;
 };
 
@@ -373,7 +373,7 @@ static int shortcut_send_cb(pid_t pid, int handle, const struct packet *packet,
 
 
 
-EAPI int add_to_home_remove_shortcut(const char *appid, const char *name, const char *content_info, result_cb_t result_cb, void *data)
+EAPI int add_to_home_remove_shortcut(const char *appid, const char *name, const char *content_info, result_internal_cb_t result_cb, void *data)
 {
        struct packet *packet;
        struct result_cb_item *item;
@@ -434,7 +434,7 @@ EAPI int add_to_home_remove_shortcut(const char *appid, const char *name, const
 
 
 
-EAPI int add_to_home_remove_dynamicbox(const char *appid, const char *name, result_cb_t result_cb, void *data)
+EAPI int add_to_home_remove_dynamicbox(const char *appid, const char *name, result_internal_cb_t result_cb, void *data)
 {
        struct packet *packet;
        struct result_cb_item *item;
@@ -496,7 +496,7 @@ EAPI int add_to_home_remove_dynamicbox(const char *appid, const char *name, resu
 
 
 
-EAPI int add_to_home_shortcut(const char *appid, const char *name, int type, const char *content, const char *icon, int allow_duplicate, result_cb_t result_cb, void *data)
+EAPI int add_to_home_shortcut(const char *appid, const char *name, int type, const char *content, const char *icon, int allow_duplicate, result_internal_cb_t result_cb, void *data)
 {
        struct packet *packet;
        struct result_cb_item *item;
@@ -567,9 +567,13 @@ EAPI int add_to_home_shortcut(const char *appid, const char *name, int type, con
        return SHORTCUT_ERROR_NONE;
 }
 
+EAPI int shortcut_add_to_home(const char *name, shortcut_type type, const char *uri, const char *icon, int allow_duplicate, result_cb_t result_cb, void *data)
+{
+       return 0;
+}
 
 
-EAPI int add_to_home_dynamicbox(const char *appid, const char *name, int type, const char *content, const char *icon, double period, int allow_duplicate, result_cb_t result_cb, void *data)
+EAPI int add_to_home_dynamicbox(const char *appid, const char *name, int type, const char *content, const char *icon, double period, int allow_duplicate, result_internal_cb_t result_cb, void *data)
 {
        struct packet *packet;
        struct result_cb_item *item;
index 01c8bd9..465cd43 100755 (executable)
@@ -75,6 +75,8 @@ touch %{buildroot}/opt/dbspace/.shortcut_service.db-journal
 %defattr(-,root,root,-)
 %{_includedir}/shortcut/shortcut.h
 %{_includedir}/shortcut/shortcut_product.h
+%{_includedir}/shortcut/shortcut_private.h
+%{_includedir}/shortcut/shortcut_manager.h
 %{_libdir}/pkgconfig/shortcut.pc
 
 # End of a file