Remove product feature
authorhyun lee <hyunn.lee@samsung.com>
Mon, 12 Jan 2015 06:18:09 +0000 (15:18 +0900)
committerhyun lee <hyunn.lee@samsung.com>
Mon, 12 Jan 2015 06:18:09 +0000 (15:18 +0900)
Change-Id: I637347986db4cc9f377c44642e51c36226abb3b7
Signed-off-by: hyun lee <hyunn.lee@samsung.com>
doc_prod/shortcut_doc.h [deleted file]
lib/CMakeLists.txt
lib/include/shortcut_product.h [deleted file]
lib/src/icon.c [deleted file]
lib/src/main.c
packaging/libshortcut.spec

diff --git a/doc_prod/shortcut_doc.h b/doc_prod/shortcut_doc.h
deleted file mode 100755 (executable)
index 9343f16..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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_DOC_H__
-#define __SHORTCUT_DOC_H__
-
-/**
- * @defgroup SHORTCUT_MODULE Shortcut
- * @brief To enhance the Add to home feature. Two types of API sets are supported.
- *   - One for the homescreen developers.
- *   - The other for the application developers who should implement the Add to home feature.
- * @ingroup CAPI_APPLICATION_FRAMEWORK
- * @section SHORTCUT_MODULE_HEADER Required Header
- *   \#include <shortcut.h>
- * @section SHORTCUT_MODULE_OVERVIEW Overview
-<H1>1. Shortcut</H1>
-Tizen is supporting the "add shortcut or add to home" for various applications.
-Developers may use the shortcut library (libshortcut) to implement features like sending (applications) and receiving (possibly home screen) shortcuts.
-If home screen implements the shortcut service using the library, the applications are good to go for adding their shortcuts to the home screen(, and vice versa.)
-
-<H1>2. How to add a new shortcut to the home screen</H1>
-<H2>2.1 Add to home (From the app to home)</H2>
-
-The following are two separate APIs to support the "add to home" feature.
-
-\code
-typedef int (*result_cb_t)(int ret, 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).
-
-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>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_APP or LAUNCH_BY_URI</TD></TR>
-<TR><TD>content</TD><TD>
-Application data used for creating a pure shortcut
-
-    Shortcut
-
-1. If the type is Launch by app: None
-
-2. If the type is Launch by URI: Put the URI in the content
-
-<H3>2.1.1 Supported types</H3>
-shortcut.h Enumeration values for type of shortcuts
-
-<H2>2.2 Add shortcut (Home screen retrieves shortcuts from the app)</H2>
-"Add shortcut " service enables home screen to retrieve all shortcuts that applications promised to support and request an app to send their shortcuts to home directly, as opposed to "add to home".
-
-It is initiated by the home screen as opposed to "add to home" which is initiated by an application.The "Add shortcut" service enables the home screen to retrieve all shortcuts that applications promised to support and request an app to send their shortcuts to home directly, as opposed to "add to home".
-
-It is initiated by the home screen as opposed to "add to home" which is initiated by an application.
-
-<H3>2.2.1 Build the shortcut list DB</H3>
-\image html BuildShortcutList.png
-
-To recognize how many and what kinds of shortcuts have been registered, each application who wants to support the "add shortcut" service needs to install the XML file that defines "shortcut" information.
-The following table describes the format and information necessary to define the shortcuts application can support.
-Then, the information will be shown and used in home screen when a user selects "add shortcut" service.
-
-<TABLE>
-<caption>Syntax of the shortcut manifest file</caption>
-<TR><TD>
-\code
-<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.APP_PKGNAME">
-...
-    <shortcut-list>
-        <shortcut appid="org.tizen.myapp" extra_key="key_string" extra_data="data_string_for_key">
-           <icon>org.tizen.myapp-shortcut.png</icon>
-           <label>Default name</label>
-           <label xml:lang="en-us">Name en</label>
-           <label xml:lang="nl-nl">Name nl</label>
-           <label xml:lang="de-de">Name de</label>
-           <label xml:lang="zh-hk">Name hk</label>
-           <label xml:lang="zh-cn">Name cn</label>
-           <label xml:lang="ru-ru">Name ru</label>
-           <label xml:lang="zh-tw">Name tw</label>
-           <label xml:lang="ja-jp">Name jp</label>
-           <label xml:lang="es-es">Name es</label>
-           <label xml:lang="el-gr">Name gr</label>
-           <label xml:lang="it-it">Name it</label>
-           <label xml:lang="tr-tr">Name tr</label>
-           <label xml:lang="pt-pt">Name pt</label>
-           <label xml:lang="fr-fr">Name fr</label>
-           <label xml:lang="ko-kr">Name kr</label>
-        </shortcut>
-        <shortcut appid="org.tizen.myapp" extra_key="key_string" extra_data="data_string_for_key">
-           <label>Default name</label>
-        </shortcut>
-        ...
-        <shortcut appid="org.tizen.myapp" extra_key="key_string" extra_data="data_string_for_key">
-           <label>Default name</label>
-           <icon>org.tizen.myapp2.png</icon>
-        </shortcut>
-    </shortcut-list>
-...
-</manifest>
-\endcode
-</TD></TR>
-</TABLE>
-
-Install this XML file to /opt/share/packages/YOUR_PKGNAME.xml (Note: After manifest has been applied to the binary, simply copy the content to your manifest file.)
-The shortcut listing application will list up these items on its screen and each item will be displayed using the string in the label field.
-When selected, it will launch the selected app using app service with "appid" and a bundle holding data in the pair of extra_key and extra-data fields.
-Obviously, icon will be used to display visual information for given shortcut type.(that said the icon could be other than the application's default icon)
-
-<H3>2.2.2 Jump to the APP</H3>
-\image html JumpToApp.png
-
-The shortcut listing application will launch your application using app-svc with package name and param attributes.
-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 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.
-
-Who is going to handle the shortcut
-
-<UL>
-<LI>Handled by App
-       <LI>App should prepare a shortcut-add view as guided</LI>
-</LI>
-<LI>Handeld by UG
-       <LI>UG should be launched as an app and provide the shortcut-add view</LI>
-</LI>
-</UL>
-
-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
-When your application is launched by the shortcut list application (displayed on the left most of above figure).
-Your application should go back to the normal view when you receive the PAUSE event.
-If you didn't change the view of your application, the user will see this shortcut list view again even if the user
-launches your application from the app-tray(or homescreen).
-So you have to change the view from the shortcut list to the normal(or previous) view when you get the PAUSE event.
-
-<H4>2.2.3.2 Handled by UG</H4>
-\image html ShortcutUG.png
-In this case, the Shortcut List application will launch your UG as a process.
-When you receive PAUSE event, or need to change to other view (not in the same UG), you should destroy current UG.
-If you didn't destroy it, it will be reside on the process list. and it will not be destroyed automatically.
-
-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).
- *
- */
-
-#endif /* __SHORTCUT_DOC_H__ */
index c4abdaf..e277e96 100755 (executable)
@@ -35,7 +35,6 @@ ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET")
 
 ADD_LIBRARY(${PROJECT_NAME} SHARED 
        src/main.c
-       src/icon.c
        src/dlist.c
 )
 
@@ -46,7 +45,6 @@ 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)
diff --git a/lib/include/shortcut_product.h b/lib/include/shortcut_product.h
deleted file mode 100755 (executable)
index 927e214..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * 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.
- *
-*/
-
-#if !defined(__SHORTCUT_PRODUCT_H__)
-#define __SHORTCUT_PRODUCT_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file shortcut_product.h
- * @brief This file declares API of libshortcut library (platform only)
- */
-
-/**
- * @addtogroup SHORTCUT_ICON_MODULE
- * @{
- */
-
-/**
- * \note
- * Example)
- *
- * \code
- * static int init_cb(int status, void *data)
- * {
- *    printf("Initializer returns: %d\n", status);
- *    if (status == 0) {
- *        printf("Succeed to initialize\n");
- *    } else {
- *        printf("Failed to initialize: %d\n", status);
- *    }
- * }
- *
- * int main(int argc, char *argv[])
- * {
- *     // Initialize the service request
- *     int ret;
- *
- *     // After the init_cb is called, you can use below functions.
- *     struct shortcut_icon *handle;
- *
- *     ret = shortcut_icon_init(init_cb, NULL);
- *     if (ret < 0) {
- *        ...
- *
- *     // Create request for creating shortcut icon.
- *     handle = shortcut_icon_create();
- *     if (!handle) {
- *         ...
- *     }
- *
- *     // Send the request to the shortcut service
- *     ret = shortcut_icon_request_set_info(handle, NULL, SHORTCUT_ICON_TYPE_IMAGE, "icon, "/usr/share/.../icon.png", NULL, NULL);
- *     if (ret < 0) {
- *        ...
- *     }
- *
- *     ret = shortcut_icon_request_set_info(handle, NULL, SHORTCUT_ICON_TYPE_TEXT, "text, "app icon", NULL, NULL);
- *     if (ret < 0) {
- *        ...
- *     }
- *
- *     ret = shortcut_icon_request_send(handle, LB_SIZE_TYPE_1x1, NULL, NULL, "/opt/usr/apps/org.tizen.cluster-home/data/out.png", result_cb, NULL);
- *     if (ret < 0) {
- *        ...
- *     }
- *
- *     ret = shortcut_icon_request_destroy(handle);
- *     if (ret < 0) {
- *        ...
- *     }
- *
- *     // Don't finalize the icon service if you don't get result callbacks of all requests
- *     ret = shortcut_icon_fini();
- *     if (ret < 0) {
- *        ...
- *     }
- *
- *     return 0;
- * }
- * \endcode
- */
-
-struct shortcut_icon;
-
-/**
- * @brief Called when send a request to create a icon snapshot image.
- * @details This callback will be called with its result.
- * @param[in] handle Handle of requestor
- * @param[in] ret status of request
- * @param[in] data Callback data
- * @return int result state of callback call
- * @retval 0 If it is successfully completed
- * @see shortcut_icon_request_send()
- */
-typedef int (*icon_request_cb_t)(struct shortcut_icon *handle, int ret, void *data);
-
-#define DEFAULT_ICON_PART              "icon"
-#define DEFAULT_NAME_PART              "name"
-#define SHORTCUT_ICON_TYPE_IMAGE       "image"
-#define SHORTCUT_ICON_TYPE_TEXT                "text"
-#define SHORTCUT_ICON_TYPE_SCRIPT      "script"
-
-/**
- * @brief Initializes the icon creation service.
- * @param[in] init_cb Initialized result will be delievered via this callback
- * @param[in] data Callback data
- * @return int value
- * @retval #SHORTCUT_ERROR_INVALID_PARAMETER Already initialized
- * @retval #SHORTCUT_ERROR_NONE Successfully initialized
- * @see shortcut_icon_service_fini()
- */
-extern int shortcut_icon_service_init(int (*init_cb)(int status, void *data), void *data);
-
-/**
- * @brief Finalizes the icon creation service.
- * @return int value
- * @retval #SHORTCUT_ERROR_NONE Successfully initialized
- * @retval #SHORTCUT_ERROR_INVALID_PARAMETER icon service is not initialized
- * @see shortcut_icon_service_init()
- */
-extern int shortcut_icon_service_fini(void);
-
-/**
- * @brief Creates a request object to create a new icon image.
- * @return struct shortcut_icon * value
- * @retval @c NULL If it fails to create a new handle
- * @retval pointer Handle address
- * @see shortcut_icon_request_destroy()
- */
-extern struct shortcut_icon *shortcut_icon_request_create(void);
-
-/**
- * @brief Sets information for creating icon image.
- * @param[in] handle Request handle
- * @param[in] id Target ID to be affected by this data
- * @param[in] type SHORTCUT_ICON_TYPE_IMAGE, SHORTCUT_ICON_TYPE_TEXT, SHORTCUT_ICON_TYPE_SCRIPT can be used
- * @param[in] part Target part to be affect by this data
- * @param[in] data type == IMAGE ? Image file path : type == TEXT ? text string : type == SCRIPT ? script file path : N/A
- * @param[in] option Image load option or group name of script file to be loaded
- * @param[in] subid ID for script. this ID will be used as "id"
- * @return int value
- * @retval index Index of data set
- * @retval #SHORTCUT_ERROR_INVALID_PARAMETER Invalid handle
- * @retval #SHORTCUT_ERROR_OUT_OF_MEMORY Out of memory
- * @see shortcut_icon_request_create()
- */
-extern int shortcut_icon_request_set_info(struct shortcut_icon *handle, const char *id, const char *type, const char *part, const char *data, const char *option, const char *subid);
-
-/**
- * @brief Sends requests to create an icon image.
- * @param[in] handle Icon request handle
- * @param[in] size_type Size type to be created
- * @param[in] layout Layout filename (edje filename)
- * @param[in] group Group name
- * @param[in] outfile Output image filename
- * @param[in] result_cb Result callback
- * @param[in] data Callback data
- * @return int value
- * @retval #SHORTCUT_ERROR_INVALID_PARAMETER Invalid parameters
- * @retval #SHORTCUT_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #SHORTCUT_ERROR_FAULT Failed to send a request
- * @retval #SHORTCUT_ERROR_NONE Successfully sent
- * @see shortcut_icon_service_fini()
- */
-extern int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type, const char *layout, const char *group, const char *outfile, icon_request_cb_t result_cb, void *data);
-
-/**
- * @brief Destroys handle of creating shortcut icon request.
- * @param[in] handle Shortcut request handle
- * @return int value
- * @retval #SHORTCUT_ERROR_INVALID_PARAMETER Invalid handle
- * @retval #SHORTCUT_ERROR_NONE Successfully destroyed
- * @see shortcut_icon_service_fini()
- */
-extern int shortcut_icon_request_destroy(struct shortcut_icon *handle);
-
-
-/**
- * @brief Sets private data to the handle to carry it with a handle.
- * @param[in] handle Handle to be used for carrying a data
- * @param[in] data Private data
- * @return int value
- * @retval #SHORTCUT_ERROR_INVALID_PARAMETER Invalid handle
- * @retval #SHORTCUT_ERROR_NONE Successfully done
- * @see shortcut_icon_service_fini()
- */
-extern int shortcut_icon_request_set_data(struct shortcut_icon *handle, void *data);
-
-/**
- * @brief Gets the private data from handle.
- * @param[in] handle
- * @return int value
- * @retval @c NULL If there is no data
- * @retval pointer data pointer
- * @see shortcut_icon_request_set_data()
- */
-extern void *shortcut_icon_request_data(struct shortcut_icon *handle);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
\ No newline at end of file
diff --git a/lib/src/icon.c b/lib/src/icon.c
deleted file mode 100755 (executable)
index 1825df5..0000000
+++ /dev/null
@@ -1,816 +0,0 @@
-/*
- * 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.
- *
-*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <libgen.h>
-#include <sys/time.h>
-#include <time.h>
-
-#include <dlog.h>
-#include <glib.h>
-#include <db-util.h>
-#include <vconf.h>
-#include <vconf-keys.h>
-
-#include <packet.h>
-#include <com-core.h>
-#include <com-core_packet.h>
-
-#include "shortcut_product.h"
-#include "shortcut.h"
-#include "dlist.h"
-#include "shortcut_private.h"
-
-
-
-#define CREATED        0x00BEEF00
-#define DESTROYED 0x00DEAD00
-
-static struct info {
-       int fd;
-       int (*init_cb)(int status, void *data);
-       void *cbdata;
-       int initialized;
-
-       const char *utility_socket;
-
-       struct dlist *pending_list;
-#if defined(_USE_ECORE_TIME_GET)
-       clockid_t type;
-#endif
-} s_info = {
-       .fd = -1,
-       .init_cb = NULL,
-       .cbdata = NULL,
-       .initialized = 0,
-
-       .utility_socket = "/tmp/.utility.service",
-       .pending_list = NULL,
-#if defined(_USE_ECORE_TIME_GET)
-       .type = CLOCK_MONOTONIC,
-#endif
-};
-
-
-
-struct request_item {
-       struct shortcut_icon *handle;
-       icon_request_cb_t result_cb;
-       void *data;
-};
-
-
-
-struct pending_item {
-       struct request_item *item;
-       struct packet *packet;
-};
-
-
-
-struct block {
-       unsigned int idx;
-
-       char *type;
-       char *part;
-       char *data;
-       char *option;
-       char *id;
-       char *target_id;
-};
-
-
-
-struct shortcut_icon {
-       unsigned int state;
-       struct shortcut_desc *desc;
-       int refcnt;
-       void *data;
-};
-
-
-
-struct shortcut_desc {
-       int for_pd;
-
-       unsigned int last_idx;
-
-       struct dlist *block_list;
-};
-
-
-
-static inline void delete_block(struct block *block)
-{
-       DbgPrint("Release block: %p\n", block);
-       free(block->type);
-       free(block->part);
-       free(block->data);
-       free(block->option);
-       free(block->id);
-       free(block->target_id);
-       free(block);
-}
-
-
-
-static inline int shortcut_icon_desc_close(struct shortcut_desc *handle)
-{
-       struct dlist *l;
-       struct dlist *n;
-       struct block *block;
-
-       dlist_foreach_safe(handle->block_list, l, n, block) {
-               handle->block_list = dlist_remove(handle->block_list, l);
-               delete_block(block);
-       }
-
-       free(handle);
-       return 0;
-}
-
-
-
-static inline struct shortcut_icon *shortcut_icon_request_unref(struct shortcut_icon *handle)
-{
-       handle->refcnt--;
-       DbgPrint("Handle: refcnt[%d]\n", handle->refcnt);
-
-       if (handle->refcnt == 0) {
-               handle->state = DESTROYED;
-               shortcut_icon_desc_close(handle->desc);
-               free(handle);
-               handle = NULL;
-       }
-
-       return handle;
-}
-
-
-
-static inline struct shortcut_icon *shortcut_icon_request_ref(struct shortcut_icon *handle)
-{
-       handle->refcnt++;
-       DbgPrint("Handle: refcnt[%d]\n", handle->refcnt);
-       return handle;
-}
-
-
-
-static int disconnected_cb(int handle, void *data)
-{
-       if (s_info.fd != handle) {
-               return 0;
-       }
-
-       ErrPrint("Disconnected\n");
-       s_info.fd = -1;
-       s_info.init_cb = NULL;
-       s_info.cbdata = NULL;
-       s_info.initialized = 0;
-       return 0;
-}
-
-
-
-static inline struct shortcut_desc *shortcut_icon_desc_open(void)
-{
-       struct shortcut_desc *handle;
-
-       handle = calloc(1, sizeof(*handle));
-       if (!handle) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               return NULL;
-       }
-
-       return handle;
-}
-
-
-
-static inline int shortcut_icon_desc_save(struct shortcut_desc *handle, const char *filename)
-{
-       struct dlist *l;
-       struct dlist *n;
-       struct block *block;
-       FILE *fp;
-
-       if (!handle) {
-               return SHORTCUT_ERROR_INVALID_PARAMETER;
-       }
-
-       fp = fopen(filename, "w+t");
-       if (!fp) {
-               ErrPrint("Error: %s\n", strerror(errno));
-               return SHORTCUT_ERROR_IO_ERROR;
-       }
-
-       DbgPrint("Close and flush\n");
-       dlist_foreach_safe(handle->block_list, l, n, block) {
-               DbgPrint("{\n");
-               fprintf(fp, "{\n");
-               if (block->type) {
-                       fprintf(fp, "type=%s\n", block->type);
-                       DbgPrint("type=%s\n", block->type);
-               }
-
-               if (block->part) {
-                       fprintf(fp, "part=%s\n", block->part);
-                       DbgPrint("part=%s\n", block->part);
-               }
-
-               if (block->data) {
-                       fprintf(fp, "data=%s\n", block->data);
-                       DbgPrint("data=%s\n", block->data);
-               }
-
-               if (block->option) {
-                       fprintf(fp, "option=%s\n", block->option);
-                       DbgPrint("option=%s\n", block->option);
-               }
-
-               if (block->id) {
-                       fprintf(fp, "id=%s\n", block->id);
-                       DbgPrint("id=%s\n", block->id);
-               }
-
-               if (block->target_id) {
-                       fprintf(fp, "target=%s\n", block->target_id);
-                       DbgPrint("target=%s\n", block->target_id);
-               }
-
-               fprintf(fp, "}\n");
-               DbgPrint("}\n");
-       }
-
-       if (fclose(fp) != 0) {
-               ErrPrint("fclose: %s\n", strerror(errno));
-       }
-       return SHORTCUT_ERROR_NONE;
-}
-
-
-
-static inline struct block *find_block(struct shortcut_desc *handle, const char *id, const char *part)
-{
-       struct block *block;
-       struct dlist *l;
-
-       dlist_foreach(handle->block_list, l, block) {
-               if (!strcmp(block->part, part) && (!id || !strcmp(block->id, id))) {
-                       return block;
-               }
-       }
-
-       return NULL;
-}
-
-
-
-static inline int update_block(struct block *block, const char *data, const char *option)
-{
-       char *_data = NULL;
-       char *_option = NULL;
-
-       if (data) {
-               _data = strdup(data);
-               if (!_data) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       return SHORTCUT_ERROR_OUT_OF_MEMORY;
-               }
-       }
-
-       if (option) {
-               _option = strdup(option);
-               if (!_option) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       free(_data);
-                       return SHORTCUT_ERROR_OUT_OF_MEMORY;
-               }
-       }
-
-       free(block->data);
-       free(block->option);
-
-       block->data = _data;
-       block->option = _option;
-       return 0;
-}
-
-
-
-/*!
- * \return idx
- */
-
-
-
-static inline int shortcut_icon_desc_add_block(struct shortcut_desc *handle, const char *id, const char *type, const char *part, const char *data, const char *option, const char *target_id)
-{
-       struct block *block;
-
-       if (!handle || !type) {
-               return SHORTCUT_ERROR_INVALID_PARAMETER;
-       }
-
-       if (!part) {
-               part = "";
-       }
-
-       if (!data) {
-               data = "";
-       }
-
-       if (target_id) {
-               if (strcmp(type, SHORTCUT_ICON_TYPE_SCRIPT)) {
-                       ErrPrint("target id only can be used for script type\n");
-                       return SHORTCUT_ERROR_INVALID_PARAMETER;
-               }
-       }
-
-       block = find_block(handle, id, part);
-       if (!block) {
-               block = calloc(1, sizeof(*block));
-               if (!block) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       return SHORTCUT_ERROR_OUT_OF_MEMORY;
-               }
-
-               block->type = strdup(type);
-               if (!block->type) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       free(block);
-                       return SHORTCUT_ERROR_OUT_OF_MEMORY;
-               }
-
-               block->part = strdup(part);
-               if (!block->part) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       free(block->type);
-                       free(block);
-                       return SHORTCUT_ERROR_OUT_OF_MEMORY;
-               }
-
-               block->data = strdup(data);
-               if (!block->data) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       free(block->type);
-                       free(block->part);
-                       free(block);
-                       return SHORTCUT_ERROR_OUT_OF_MEMORY;
-               }
-
-               if (option) {
-                       block->option = strdup(option);
-                       if (!block->option) {
-                               ErrPrint("Heap: %s\n", strerror(errno));
-                               free(block->data);
-                               free(block->type);
-                               free(block->part);
-                               free(block);
-                               return SHORTCUT_ERROR_OUT_OF_MEMORY;
-                       }
-               }
-
-               if (id) {
-                       block->id = strdup(id);
-                       if (!block->id) {
-                               ErrPrint("Heap: %s\n", strerror(errno));
-                               free(block->option);
-                               free(block->data);
-                               free(block->type);
-                               free(block->part);
-                               free(block);
-                               return SHORTCUT_ERROR_OUT_OF_MEMORY;
-                       }
-               }
-
-               if (target_id) {
-                       block->target_id = strdup(target_id);
-                       if (!block->target_id) {
-                               ErrPrint("Heap: %s\n", strerror(errno));
-                               free(block->id);
-                               free(block->option);
-                               free(block->data);
-                               free(block->type);
-                               free(block->part);
-                               free(block);
-                               return SHORTCUT_ERROR_OUT_OF_MEMORY;
-                       }
-               }
-
-               block->idx = handle->last_idx++;
-               handle->block_list = dlist_append(handle->block_list, block);
-       } else {
-               if (strcmp(block->type, type)) {
-                       ErrPrint("type is not valid (%s, %s)\n", block->type, type);
-                       return SHORTCUT_ERROR_INVALID_PARAMETER;
-               }
-
-               if ((block->target_id && !target_id) || (!block->target_id && target_id)) {
-                       ErrPrint("type is not valid (%s, %s)\n", block->type, type);
-                       return SHORTCUT_ERROR_INVALID_PARAMETER;
-               }
-
-               if (block->target_id && target_id && strcmp(block->target_id, target_id)) {
-                       ErrPrint("type is not valid (%s, %s)\n", block->type, type);
-                       return SHORTCUT_ERROR_INVALID_PARAMETER;
-               }
-
-               update_block(block, data, option);
-       }
-
-       return block->idx;
-}
-
-
-
-static int icon_request_cb(pid_t pid, int handle, const struct packet *packet, void *data)
-{
-       struct request_item *item = data;
-       int ret;
-
-       if (!packet) {
-               ret = -EFAULT;
-               DbgPrint("Disconnected?\n");
-       } else {
-               if (packet_get(packet, "i", &ret) != 1) {
-                       DbgPrint("Invalid packet\n");
-                       ret = -EINVAL;
-               }
-       }
-
-       if (item->result_cb) {
-               item->result_cb(item->handle, ret, item->data);
-       }
-
-       (void)shortcut_icon_request_unref(item->handle);
-       free(item);
-       return 0;
-}
-
-
-
-static inline int make_connection(void)
-{
-       int ret;
-       static struct method service_table[] = {
-               {
-                       .cmd = NULL,
-                       .handler = NULL,
-               },
-       };
-
-       s_info.fd = com_core_packet_client_init(s_info.utility_socket, 0, service_table);
-       if (s_info.fd < 0) {
-               ret = SHORTCUT_ERROR_COMM;
-
-               if (s_info.init_cb) {
-                       s_info.init_cb(ret, s_info.cbdata);
-               }
-       } else {
-               struct dlist *l;
-               struct dlist *n;
-               struct pending_item *pend;
-
-               if (s_info.init_cb) {
-                       s_info.init_cb(SHORTCUT_ERROR_NONE, s_info.cbdata);
-               }
-
-               dlist_foreach_safe(s_info.pending_list, l, n, pend) {
-                       s_info.pending_list = dlist_remove(s_info.pending_list, l);
-
-                       ret = com_core_packet_async_send(s_info.fd, pend->packet, 0.0f, icon_request_cb, pend->item);
-                       packet_destroy(pend->packet);
-                       if (ret < 0) {
-                               ErrPrint("ret: %d\n", ret);
-                               if (pend->item->result_cb) {
-                                       pend->item->result_cb(pend->item->handle, ret, pend->item->data);
-                               }
-                               free(pend->item);
-                       }
-
-                       free(pend);
-               }
-
-               ret = SHORTCUT_ERROR_NONE;
-       }
-
-       return ret;
-}
-
-
-
-static void master_started_cb(keynode_t *node, void *user_data)
-{
-       int state = 0;
-
-       if (vconf_get_bool(VCONFKEY_MASTER_STARTED, &state) < 0) {
-               ErrPrint("Unable to get \"%s\"\n", VCONFKEY_MASTER_STARTED);
-       }
-
-       if (state == 1 && make_connection() == SHORTCUT_ERROR_NONE) {
-               (void)vconf_ignore_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb);
-       }
-}
-
-
-
-EAPI int shortcut_icon_service_init(int (*init_cb)(int status, void *data), void *data)
-{
-       int ret;
-
-       if (s_info.fd >= 0) {
-               return SHORTCUT_ERROR_INVALID_PARAMETER;
-       }
-
-       if (s_info.initialized) {
-               s_info.initialized = 1;
-               com_core_add_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL);
-       }
-
-       s_info.init_cb = init_cb;
-       s_info.cbdata = data;
-
-       ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL);
-       if (ret < 0) {
-               ErrPrint("Failed to add vconf for service state [%d]\n", ret);
-       } else {
-               DbgPrint("vconf is registered\n");
-       }
-
-       master_started_cb(NULL, NULL);
-       return SHORTCUT_ERROR_NONE;
-}
-
-
-
-EAPI int shortcut_icon_service_fini(void)
-{
-       struct dlist *l;
-       struct dlist *n;
-       struct pending_item *pend;
-
-       if (s_info.initialized) {
-               com_core_del_event_callback(CONNECTOR_DISCONNECTED, disconnected_cb, NULL);
-               s_info.initialized = 0;
-       }
-
-       if (s_info.fd < 0) {
-               return SHORTCUT_ERROR_INVALID_PARAMETER;
-       }
-
-       com_core_packet_client_fini(s_info.fd);
-       s_info.init_cb = NULL;
-       s_info.cbdata = NULL;
-       s_info.fd = -1;
-
-       dlist_foreach_safe(s_info.pending_list, l, n, pend) {
-               s_info.pending_list = dlist_remove(s_info.pending_list, l);
-               packet_unref(pend->packet);
-               if (pend->item->result_cb) {
-                       pend->item->result_cb(pend->item->handle, SHORTCUT_ERROR_COMM, pend->item->data);
-               }
-               free(pend->item);
-               free(pend);
-       }
-       return SHORTCUT_ERROR_NONE;
-}
-
-
-
-EAPI struct shortcut_icon *shortcut_icon_request_create(void)
-{
-       struct shortcut_icon *handle;
-
-       handle = malloc(sizeof(*handle));
-       if (!handle) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return NULL;
-       }
-
-       handle->desc = shortcut_icon_desc_open();
-       if (!handle->desc) {
-               ErrPrint("Uanble to open desc\n");
-               free(handle);
-               return NULL;
-       }
-
-       handle->state = CREATED;
-       handle->refcnt = 1;
-       return handle;
-}
-
-
-EAPI int shortcut_icon_request_set_data(struct shortcut_icon *handle, void *data)
-{
-       if (!handle || handle->state != CREATED) {
-               ErrPrint("Handle is not valid\n");
-               return SHORTCUT_ERROR_INVALID_PARAMETER;
-       }
-
-       handle->data = data;
-       return SHORTCUT_ERROR_NONE;
-}
-
-
-
-EAPI void *shortcut_icon_request_data(struct shortcut_icon *handle)
-{
-       if (!handle || handle->state != CREATED) {
-               ErrPrint("Handle is not valid\n");
-               return NULL;
-       }
-
-       return handle->data;
-}
-
-
-
-EAPI int shortcut_icon_request_set_info(struct shortcut_icon *handle, const char *id, const char *type, const char *part, const char *data, const char *option, const char *subid)
-{
-       if (!handle || handle->state != CREATED) {
-               ErrPrint("Handle is not valid\n");
-               return SHORTCUT_ERROR_INVALID_PARAMETER;
-       }
-
-       return shortcut_icon_desc_add_block(handle->desc, id, type, part, data, option, subid);
-}
-
-
-
-EAPI int shortcut_icon_request_destroy(struct shortcut_icon *handle)
-{
-       if (!handle || handle->state != CREATED) {
-               ErrPrint("Handle is not valid\n");
-               return SHORTCUT_ERROR_INVALID_PARAMETER;
-       }
-
-       (void)shortcut_icon_request_unref(handle);
-       return SHORTCUT_ERROR_NONE;
-}
-
-
-
-EAPI int shortcut_icon_request_send(struct shortcut_icon *handle, int size_type, const char *layout, const char *group, const char *outfile, icon_request_cb_t result_cb, void *data)
-{
-       int ret;
-       struct packet *packet;
-       struct request_item *item;
-       char *filename;
-       int len;
-
-       if (!handle || handle->state != CREATED) {
-               ErrPrint("Handle is not valid\n");
-               return SHORTCUT_ERROR_INVALID_PARAMETER;
-       }
-
-       if (!layout) {
-               layout = DEFAULT_ICON_LAYOUT;
-       }
-
-       if (!group) {
-               group = DEFAULT_ICON_GROUP;
-       }
-
-       len = strlen(outfile) + strlen(".desc") + 1 + 30; /* 30 == strlen(tv.tv_sec) + strlen(tv.tv_usec) + 10 (reserved) */
-       filename = malloc(len);
-       if (!filename) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               return SHORTCUT_ERROR_OUT_OF_MEMORY;
-       }
-
-#if defined(_USE_ECORE_TIME_GET)
-       struct timespec ts;
-       double tv;
-       do {
-               if (clock_gettime(s_info.type, &ts) == 0) {
-                       tv = ts.tv_sec + ts.tv_nsec / 1000000000.0f;
-                       break;
-               }
-
-               ErrPrint("%d: %s\n", s_info.type, strerror(errno));
-               if (s_info.type == CLOCK_MONOTONIC) {
-                       s_info.type = CLOCK_REALTIME;
-               } else if (s_info.type == CLOCK_REALTIME) {
-                       struct timeval _tv;
-                       if (gettimeofday(&_tv, NULL) < 0) {
-                               ErrPrint("gettimeofday: %s\n", strerror(errno));
-                               _tv.tv_sec = rand();
-                               _tv.tv_usec = rand();
-                       }
-
-                       tv = (double)_tv.tv_sec + (double)_tv.tv_usec / 1000000.0f;
-                       break;
-               }
-       } while (1);
-       ret = snprintf(filename, len, "%s.%lf.desc", outfile, tv);
-#else
-       struct timeval tv;
-       if (gettimeofday(&tv, NULL) != 0) {
-               ErrPrint("gettimeofday: %s\n", strerror(errno));
-               tv.tv_sec = rand();
-               tv.tv_usec = rand();
-       }
-
-       ret = snprintf(filename, len, "%s.%lu.%lu.desc", outfile, tv.tv_sec, tv.tv_usec);
-#endif
-       if (ret < 0) {
-               ErrPrint("snprintf: %s\n", strerror(errno));
-               goto out;
-       }
-
-       ret = shortcut_icon_desc_save(handle->desc, filename);
-       if (ret < 0) {
-               goto out;
-       }
-
-       item = malloc(sizeof(*item));
-       if (!item) {
-               ErrPrint("Heap: %s\n", strerror(errno));
-               if (unlink(filename) < 0) {
-                       ErrPrint("Unlink: %s\n", strerror(errno));
-               }
-               ret = SHORTCUT_ERROR_OUT_OF_MEMORY;
-               goto out;
-       }
-
-       item->result_cb = result_cb;
-       item->data = data;
-       item->handle = shortcut_icon_request_ref(handle);
-
-       packet = packet_create("icon_create", "sssis", layout, group, filename, size_type, outfile);
-       if (!packet) {
-               ErrPrint("Failed to create a packet\n");
-               if (unlink(filename) < 0) {
-                       ErrPrint("Unlink: %s\n", strerror(errno));
-               }
-               free(item);
-               (void)shortcut_icon_request_unref(handle);
-               ret = SHORTCUT_ERROR_FAULT;
-               goto out;
-       }
-
-       if (s_info.fd >= 0 && !s_info.pending_list) {
-               ret = com_core_packet_async_send(s_info.fd, packet, 0.0f, icon_request_cb, item);
-               packet_destroy(packet);
-               if (ret < 0) {
-                       ErrPrint("ret: %d\n", ret);
-                       if (unlink(filename) < 0) {
-                               ErrPrint("Unlink: %s\n", strerror(errno));
-                       }
-                       free(item);
-                       (void)shortcut_icon_request_unref(handle);
-               }
-               DbgPrint("Request is sent\n");
-       } else {
-               struct pending_item *pend;
-
-               pend = malloc(sizeof(*pend));
-               if (!pend) {
-                       ErrPrint("Heap: %s\n", strerror(errno));
-                       packet_destroy(packet);
-                       free(item);
-                       if (unlink(filename) < 0) {
-                               ErrPrint("Unlink: %s\n", strerror(errno));
-                       }
-                       (void)shortcut_icon_request_unref(handle);
-                       ret = SHORTCUT_ERROR_OUT_OF_MEMORY;
-                       goto out;
-               }
-
-               pend->packet = packet;
-               pend->item = item;
-
-               s_info.pending_list = dlist_append(s_info.pending_list, pend);
-               DbgPrint("Request is pended\n");
-
-               ret = SHORTCUT_ERROR_NONE;
-       }
-
-out:
-       free(filename);
-       return ret;
-}
-
-/* End of a file */
index d21c390..eec57cf 100755 (executable)
@@ -36,7 +36,6 @@
 #include <com-core_packet.h>
 
 #include "shortcut.h"
-#include "shortcut_product.h"
 #include "shortcut_private.h"
 #include "shortcut_manager.h"
 
index a69863f..5f9e8c2 100755 (executable)
@@ -75,7 +75,6 @@ touch %{buildroot}/opt/dbspace/.shortcut_service.db-journal
 %manifest %{name}.manifest
 %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