2 * Copyright (c) 2011 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef __SHORTCUT_H__
19 #define __SHORTCUT_H__
22 #include <shortcut_manager.h>
31 * @brief This file declares the API of the libshortcut library.
35 * @addtogroup SHORTCUT_MODULE
40 * @brief Called to receive the result of add_to_home_shortcut().
42 * @param[in] ret The result value, it could be @c 0 if it succeeds to add a shortcut,
43 * otherwise it returns an errno
44 * @param[in] pid The process ID of who handle this add_to_home request
45 * @param[in] data The callback data
46 * @return int @c 0 if there is no error,
48 * @see add_to_home_shortcut()
50 typedef int (*result_internal_cb_t)(int ret, int pid, void *data);
53 * @brief Enumeration for shortcut types.
54 * @details Basically, three types of shortcuts are defined.
55 * Every homescreen developer should support these types of shortcuts.
56 * Or return a proper errno to figure out why the application failed to add a shortcut.
57 * #LAUNCH_BY_PACKAGE is used for adding a package itself as a shortcut.
58 * #LAUNCH_BY_URI is used for adding a shortcut for "uri" data.
61 enum shortcut_internal_type {
62 /**< Deprecated type */
63 SHORTCUT_PACKAGE = 0x00000000, /**< Launch the package using the given package name */
64 SHORTCUT_DATA = 0x00000001, /**< Launch the related package with the given data(content_info) */
65 SHORTCUT_FILE = 0x00000002, /**< Launch the related package with the given filename(content_info) */
67 LAUNCH_BY_PACKAGE = 0x00000000,
69 SHORTCUT_REMOVE = 0x40000000, /**< Remove a shortcut */
70 DYNAMICBOX_REMOVE = 0x80000000, /**< Remove a widget */
72 DYNAMICBOX_TYPE_DEFAULT = 0x10000000, /**< Type mask for the default widget */
73 DYNAMICBOX_TYPE_EASY_DEFAULT = 0x30000000, /**< Type mask for the easy mode widget */
74 DYNAMICBOX_TYPE_1x1 = 0x10010000, /**< 1x1 */
75 DYNAMICBOX_TYPE_2x1 = 0x10020000, /**< 2x1 */
76 DYNAMICBOX_TYPE_2x2 = 0x10040000, /**< 2x2 */
77 DYNAMICBOX_TYPE_4x1 = 0x10080000, /**< 4x1 */
78 DYNAMICBOX_TYPE_4x2 = 0x10100000, /**< 4x2 */
79 DYNAMICBOX_TYPE_4x3 = 0x10200000, /**< 4x3 */
80 DYNAMICBOX_TYPE_4x4 = 0x10400000, /**< 4x4 */
81 DYNAMICBOX_TYPE_4x5 = 0x11000000, /**< 4x5 */
82 DYNAMICBOX_TYPE_4x6 = 0x12000000, /**< 4x6 */
83 DYNAMICBOX_TYPE_EASY_1x1 = 0x30010000, /**< Easy mode 1x1 */
84 DYNAMICBOX_TYPE_EASY_3x1 = 0x30020000, /**< Easy mode 3x2 */
85 DYNAMICBOX_TYPE_EASY_3x3 = 0x30040000, /**< Easy mode 3x3 */
86 DYNAMICBOX_TYPE_UNKNOWN = 0x1FFF0000, /**< Error */
89 #define SHORTCUT_ERROR (shortcut_error_quark ())
90 GQuark shortcut_error_quark(void);
94 * @brief Definition for a macro to check type.
96 * @param[in] type The type of box
98 * @retval true(1) If it is a dynamicbox
99 * @retval false(0) If it is not a dynamicbox
102 #define ADD_TO_HOME_IS_DYNAMICBOX(type) (!!((type) & 0x10000000))
105 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) __attribute__((deprecated));
106 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) __attribute__((deprecated));