Update the project to the newest version.
[framework/appfw/shortcut.git] / lib / include / shortcut.h
similarity index 64%
rename from include/shortcut.h
rename to lib/include/shortcut.h
index b488faf..8053640 100644 (file)
@@ -39,7 +39,7 @@ extern "C" {
  * @brief This function prototype is used to define a callback function for the add_to_home reqeust.
  *        The homescreen should define a callback as this type and implementing the service code
  *        for adding a new application shortcut.
- * @param[in] pkgname Shortcut is added for this package.
+ * @param[in] appid Shortcut is added for this package.
  * @param[in] name Name for created shortcut icon.
  * @param[in] type 3 kinds of types are defined.
  * @param[in] content_info Specific information for creating a new shortcut.
@@ -53,7 +53,7 @@ extern "C" {
  * @post None
  * @remarks None
  */
-typedef int (*request_cb_t)(const char *pkgname, const char *name, int type, const char *content_info, const char *icon, int pid, void *data);
+typedef int (*request_cb_t)(const char *appid, const char *name, int type, const char *content_info, const char *icon, int pid, double period, void *data);
 
 /**
  * @brief This function prototype is used to define for receiving the result of add_to_home.
@@ -61,7 +61,7 @@ typedef int (*request_cb_t)(const char *pkgname, const char *name, int type, con
  * @param[in] pid Process ID of who handles this add_to_home request.
  * @param[in] data Callback data.
  * @return int Returns 0, if there is no error or returns errno.
- * @see shortcut_add_to_home()
+ * @see add_to_home_shortcut()
  * @pre None
  * @post None
  * @remarks None
@@ -72,16 +72,32 @@ typedef int (*result_cb_t)(int ret, int pid, void *data);
  * @brief Basically, three types of shortcut is defined.
  *        Every homescreen developer should support these types of shortcut.
  *        Or returns proper errno to figure out why the application failed to add a shortcut.
- *        SHORTCUT_PACKAGE is used for adding a package itself as a shortcut
- *        SHORTCUT_DATA is used for adding a shortcut for "content" data.
- *        SHORTCUT_FILE is used for adding a shortcut for "file".
+ *        LAUNCH_BY_PACKAGE is used for adding a package itself as a shortcut
+ *        LAUNCH_BY_URI is used for adding a shortcut for "uri" data.
  */
-enum {
-       SHORTCUT_PACKAGE = 0x0, /**< Launch the package using given pakcage name. */
-       SHORTCUT_DATA = 0x01, /**< Launch the related package with given data(content_info). */
-       SHORTCUT_FILE = 0x02, /** < Launch the related package with given filename(content_info). */
+enum shortcut_type {
+       /*!< Deprecated type */
+       SHORTCUT_PACKAGE        = 0x00000000, /**< Launch the package using given pakcage name. */
+       SHORTCUT_DATA           = 0x00000001, /**< Launch the related package with given data(content_info). */
+       SHORTCUT_FILE           = 0x00000002, /**< Launch the related package with given filename(content_info). */
+
+       /*!< Use these */
+       LAUNCH_BY_PACKAGE       = 0x00000000, /*!< Launch the package using given pakcage name. */
+       LAUNCH_BY_URI           = 0x00000001, /*!< Launch the related package with given data(URI). */
+
+       LIVEBOX_TYPE_DEFAULT    = 0x10000000,
+       LIVEBOX_TYPE_1x1        = 0x10010000,
+       LIVEBOX_TYPE_2x1        = 0x10020000,
+       LIVEBOX_TYPE_2x2        = 0x10040000,
+       LIVEBOX_TYPE_4x1        = 0x10080000,
+       LIVEBOX_TYPE_4x2        = 0x10100000,
+       LIVEBOX_TYPE_4x3        = 0x10200000,
+       LIVEBOX_TYPE_4x4        = 0x10400000,
+       LIVEBOX_TYPE_UNKNOWN    = 0x1FFF0000,
 };
 
+#define ADD_TO_HOME_IS_LIVEBOX(type)   (!!((type) & 0x10000000))
+
 /**
  * @fn int shortcut_set_request_cb(request_cb_t request_cb, void *data)
  *
@@ -116,9 +132,9 @@ enum {
  * @code
  * #include <shortcut.h>
  *
- * static int request_cb(const char *pkgname, const char *name, int type, const char *content_info, const char *icon, int pid, void *data)
+ * static int request_cb(const char *appid, const char *name, int type, const char *content_info, const char *icon, int pid, void *data)
  * {
- *     printf("Package name: %s\n", pkgname);
+ *     printf("Package name: %s\n", appid);
  *     printf("Name: %s\n", name);
  *     printf("Type: %d\n", type);
  *     printf("Content: %s\n", content_info);
@@ -144,7 +160,7 @@ enum {
 extern int shortcut_set_request_cb(request_cb_t request_cb, void *data);
 
 /**
- * @fn int shortcut_add_to_home(const char *pkgname, const char *name, int type, const char *content_info, const char *icon, result_cb_t result_cb, void *data)
+ * @fn int add_to_home_shortcut(const char *appid, const char *name, int type, const char *content_info, const char *icon, result_cb_t result_cb, void *data)
  *
  * @brief The application, which supporting the add_to_home feature, should invoke this.
  *
@@ -156,7 +172,7 @@ extern int shortcut_set_request_cb(request_cb_t request_cb, void *data);
  * - Application should check the return status from the callback function
  * - Application should set the callback function to get the result of this request.
  *
- * @param[in] pkgname Package name of owner of this shortcut.
+ * @param[in] appid Package name of owner of this shortcut.
  * @param[in] name Name for created shortcut icon.
  * @param[in] type 3 kinds of types are defined.
  * @param[in] content_info Specific information for delivering to the creating shortcut.
@@ -196,7 +212,7 @@ extern int shortcut_set_request_cb(request_cb_t request_cb, void *data);
  *
  * static int app_create(void *data)
  * {
- *     shortcut_add_to_home("com.samsung.gallery", "With friends",
+ *     add_to_home_shortcut("org.tizen.gallery", "With friends",
  *                                     SHORTCUT_DATA, "gallery:0000-0000",
  *                                     "/opt/media/Pictures/Friends.jpg", result_cb, NULL);
  *     return 0;
@@ -209,9 +225,37 @@ extern int shortcut_set_request_cb(request_cb_t request_cb, void *data);
  *
  * @endcode
  */
-extern int shortcut_add_to_home(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_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);
+
+extern int add_to_home_shortcut(const char *appid, const char *name, int type, const char *content_info, const char *icon, result_cb_t result_cb, void *data);
+
+extern int add_to_home_livebox(const char *appid, const char *name, int type, const char *content, const char *icon, double period, result_cb_t result_cb, void *data);
+
+
+/*!
+ * \brief Number of preview images for homescreen
+ */
+extern int homescreen_get_image_count(const char *appid);
+/*!
+ * \return string allocated in the heap - Path of image
+ */
+extern char *homescreen_get_image(const char *appid, int idx);
+
+/*!
+ * \brief Description of the homescreen (based on i18n)
+ */
+extern int homescreen_get_description(const char *appid, void (*cb)(const char *appid, const char *icon, const char *name, const char *desc, void *data), void *data);
+
+/*!
+ * \note
+ * These two functions are deprecated now.
+ *
+ * Please replace the "shortcut_add_to_home" with "add_to_home_shortcut"
+ * Please replace the "shortcut_add_to_home_with_period" with "add_to_home_livebox"
+ */
+extern int shortcut_add_to_home(const char *appid, const char *name, int type, const char *content, const char *icon, result_cb_t result_cb, void *data) __attribute__ ((deprecated));
 
-extern int add_to_home_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_to_home_with_period(const char *appid, const char *name, int type, const char *content, const char *icon, double period, result_cb_t result_cb, void *data) __attribute__ ((deprecated));
 
 #ifdef __cplusplus
 }