summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2014-05-30 09:10:14 +0900
committerSung-jae Park <nicesj.park@samsung.com>2014-05-30 09:10:14 +0900
commit0b949c2fa223d27426ec230b6675f06a2eb354b2 (patch)
tree0593ad8b30e459becd8730ec8eb967f437e04998
parent4ab61479f3dc26cd5c575745cfac3cfca059bc4e (diff)
parent8e2366fa29a42a37ad1b58d8a1ffb512c4fa8b90 (diff)
downloadshortcut-0b949c2fa223d27426ec230b6675f06a2eb354b2.tar.gz
shortcut-0b949c2fa223d27426ec230b6675f06a2eb354b2.tar.bz2
shortcut-0b949c2fa223d27426ec230b6675f06a2eb354b2.zip
Merge branch 'devel/home/master'
-rw-r--r--lib/include/shortcut.h135
-rw-r--r--lib/src/main.c14
-rw-r--r--packaging/libshortcut.spec2
3 files changed, 144 insertions, 7 deletions
diff --git a/lib/include/shortcut.h b/lib/include/shortcut.h
index 14241d3..d96d256 100644
--- a/lib/include/shortcut.h
+++ b/lib/include/shortcut.h
@@ -458,8 +458,143 @@ extern int shortcut_get_list(const char *appid, int (*cb)(const char *appid, con
*/
extern int add_to_home_livebox(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);
+/*!
+ * @fn add_to_home_remove_shortcut(const char *appid, const char *name, const char *content_info, result_cb_t result_cb, void *data);
+ *
+ * @brief The application, which supporting the add_to_home feature, should invoke this.
+ *
+ * @par Sync (or) Async:
+ * This is an asynchronous API.
+ *
+ * @par Important Notes:
+ * - Application must check the return value of this function.
+ * - Application must check the return status from the callback function
+ * - Application should set the callback function to get the result of this request.
+ *
+ * @param[in] appid Package name of owner of this shortcut.
+ * @param[in] name Name for created shortcut icon.
+ * @param[in] content_info Specific information for delivering to the viewer for creating a shortcut.
+ * @param[in] result_cb Address of callback function which will be called when the result comes back from the viewer.
+ * @param[in] data Callback data which will be used in callback function
+ *
+ * @return Return Type (int)
+ * \retval 0 Succeed to send the request
+ * \retval SHORTCUT_ERROR_FAULT Unrecoverable error
+ * \retval SHORTCUT_ERROR_INVALID Shortcut request is not valid, invalid parameter or invalid argument value
+ * \retval SHORTCUT_ERROR_COMM Connection is not estabilished. or there is a problem of communication
+ * \retval SHORTCUT_ERROR_MEMORY Memory is not enough to handle new request
+ * \retval SHORTCUT_ERROR_IO Unable to access file or DB. Check your resource files
+ * \retval SHORTCUT_ERROR_PERMISSION Has no permission to add a shortcut
+ *
+ * @see result_cb_t
+ *
+ * @pre You have to prepare the callback function
+ *
+ * @post You have to check the return status from callback function which is passed by argument.
+ *
+ * @remarks - If a homescreen does not support this feature, you will get proper error code.
+ *
+ * @par Prospective Clients:
+ * Inhouse Apps.
+ *
+ * @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)
+ * {
+ * add_to_home_remove_shortcut("com.samsung.gallery.livebox", "With friends",
+ * "gallery:0000-0000",
+ * result_cb, NULL);
+ * return 0;
+ * }
+ *
+ * int main(int argc, char *argv[])
+ * {
+ * appcore....
+ * }
+ *
+ * @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);
+/*!
+ * @fn add_to_home_remove_livebox(const char *appid, const char *name, result_cb_t result_cb, void *data);
+ *
+ * @brief The application, which supporting the add_to_home feature, should invoke this.
+ *
+ * @par Sync (or) Async:
+ * This is an asynchronous API.
+ *
+ * @par Important Notes:
+ * - Application must check the return value of this function.
+ * - Application must check the return status from the callback function
+ * - Application should set the callback function to get the result of this request.
+ *
+ * @param[in] appid Package name of owner of this shortcut.
+ * @param[in] name Name for created shortcut icon.
+ * @param[in] result_cb Address of callback function which will be called when the result comes back from the viewer.
+ * @param[in] data Callback data which will be used in callback function
+ *
+ * @return Return Type (int)
+ * \retval 0 Succeed to send the request
+ * \retval SHORTCUT_ERROR_FAULT Unrecoverable error
+ * \retval SHORTCUT_ERROR_INVALID Shortcut request is not valid, invalid parameter or invalid argument value
+ * \retval SHORTCUT_ERROR_COMM Connection is not estabilished. or there is a problem of communication
+ * \retval SHORTCUT_ERROR_MEMORY Memory is not enough to handle new request
+ * \retval SHORTCUT_ERROR_IO Unable to access file or DB. Check your resource files
+ * \retval SHORTCUT_ERROR_PERMISSION Has no permission to add a shortcut
+ *
+ * @see result_cb_t
+ *
+ * @pre You have to prepare the callback function
+ *
+ * @post You have to check the return status from callback function which is passed by argument.
+ *
+ * @remarks - If a homescreen does not support this feature, you will get proper error code.
+ *
+ * @par Prospective Clients:
+ * Inhouse Apps.
+ *
+ * @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)
+ * {
+ * add_to_home_remove_livebox("com.samsung.gallery.livebox", "With friends", result_cb, NULL);
+ * return 0;
+ * }
+ *
+ * int main(int argc, char *argv[])
+ * {
+ * appcore....
+ * }
+ *
+ * @endcode
+ */
extern int add_to_home_remove_livebox(const char *appid, const char *name, result_cb_t result_cb, void *data);
diff --git a/lib/src/main.c b/lib/src/main.c
index 4261a39..9664a10 100644
--- a/lib/src/main.c
+++ b/lib/src/main.c
@@ -496,8 +496,9 @@ EAPI int add_to_home_shortcut(const char *appid, const char *name, int type, con
struct result_cb_item *item;
int ret;
- if (ADD_TO_HOME_IS_LIVEBOX(type)) {
+ if (!appid || ADD_TO_HOME_IS_LIVEBOX(type)) {
ErrPrint("Invalid type used for adding a shortcut\n");
+ return SHORTCUT_ERROR_INVALID;
}
if (!s_info.initialized) {
@@ -529,10 +530,6 @@ EAPI int add_to_home_shortcut(const char *appid, const char *name, int type, con
item->result_cb = result_cb;
item->data = data;
- if (!appid) {
- appid = "";
- }
-
if (!name) {
name = "";
}
@@ -572,8 +569,9 @@ EAPI int add_to_home_livebox(const char *appid, const char *name, int type, cons
struct result_cb_item *item;
int ret;
- if (!ADD_TO_HOME_IS_LIVEBOX(type)) {
+ if (!appid || !ADD_TO_HOME_IS_LIVEBOX(type)) {
ErrPrint("Invalid type is used for adding a livebox\n");
+ return SHORTCUT_ERROR_INVALID;
}
if (!s_info.initialized) {
@@ -768,6 +766,10 @@ EAPI int shortcut_get_list(const char *appid, int (*cb)(const char *appid, const
int cnt;
char *language;
+ if (cb == NULL) {
+ return SHORTCUT_ERROR_INVALID;
+ }
+
if (!s_info.db_opened) {
s_info.db_opened = (open_db() == 0);
}
diff --git a/packaging/libshortcut.spec b/packaging/libshortcut.spec
index 29dad07..195b30b 100644
--- a/packaging/libshortcut.spec
+++ b/packaging/libshortcut.spec
@@ -1,6 +1,6 @@
Name: libshortcut
Summary: Shortcut add feature supporting library
-Version: 0.6.12
+Version: 0.6.13
Release: 0
Group: HomeTF/Framework
License: Apache