Separates files related shorcut error from shortcut internal 40/91640/5 accepted/tizen/3.0/ivi/20161028.123115 accepted/tizen/3.0/mobile/20161028.122434 accepted/tizen/3.0/tv/20161028.122647 accepted/tizen/3.0/wearable/20161028.122912 accepted/tizen/common/20161011.154241 accepted/tizen/ivi/20161012.065009 accepted/tizen/mobile/20161012.064920 accepted/tizen/tv/20161012.064932 accepted/tizen/wearable/20161012.064951 submit/tizen/20161011.051336 submit/tizen_3.0/20161028.062323 submit/tizen_3.0/20161028.082323 submit/tizen_3.0_common/20161104.104000
authorseungha.son <seungha.son@samsung.com>
Mon, 10 Oct 2016 12:34:23 +0000 (21:34 +0900)
committerseungha.son <seungha.son@samsung.com>
Tue, 11 Oct 2016 04:09:32 +0000 (13:09 +0900)
Signed-off-by: seungha.son <seungha.son@samsung.com>
Change-Id: I82c5d2eae86d4821fdd35d685ecdfc06e3ad249b

lib/CMakeLists.txt
lib/include/shortcut.h
lib/include/shortcut_error.h [new file with mode: 0755]
lib/include/shortcut_internal.h
lib/include/shortcut_manager.h
lib/src/shortcut_db.c
lib/src/shortcut_error.c [new file with mode: 0755]
lib/src/shortcut_internal.c
lib/src/shortcut_manager.c
packaging/libshortcut.spec

index 43399c1..6b0e301 100755 (executable)
@@ -33,10 +33,11 @@ ADD_DEFINITIONS("-DLOG_TAG=\"SHORTCUT\"")
 ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET")
 ADD_DEFINITIONS("-DDB_PATH=\"${DB_PATH}\"")
 
-ADD_LIBRARY(${PROJECT_NAME} SHARED 
+ADD_LIBRARY(${PROJECT_NAME} SHARED
        src/shortcut_manager.c
        src/shortcut_db.c
        src/shortcut_internal.c
+       src/shortcut_error.c
 )
 
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${svc_pkgs_LDFLAGS})
@@ -50,6 +51,7 @@ INSTALL(FILES ${CMAKE_SOURCE_DIR}/lib/include/shortcut_private.h DESTINATION inc
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/lib/include/shortcut_db.h DESTINATION include/${PROJECT_NAME})
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/lib/include/shortcut_manager.h DESTINATION include/${PROJECT_NAME})
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/lib/include/shortcut_internal.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/lib/include/shortcut_error.h DESTINATION include/${PROJECT_NAME})
 INSTALL(FILES ${CMAKE_BINARY_DIR}/lib/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/lib/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}")
 
index 538579b..5f66db1 100755 (executable)
@@ -19,8 +19,9 @@
 #define __SHORTCUT_H__
 
 #include <tizen.h>
-#include <shortcut_manager.h>
 #include <glib.h>
+#include "shortcut_manager.h"
+#include "shortcut_error.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/lib/include/shortcut_error.h b/lib/include/shortcut_error.h
new file mode 100755 (executable)
index 0000000..185078d
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2011 - 2015 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_ERROR_H__
+#define __SHORTCUT_ERROR_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file shortcut_error.h
+ */
+
+/**
+ * @addtogroup SHORTCUT_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for values of shortcut response types.
+ * @since_tizen 2.3
+ */
+enum shortcut_error_e {
+       SHORTCUT_ERROR_NONE = TIZEN_ERROR_NONE,                         /**< Successful */
+       SHORTCUT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,       /**< Invalid function parameter */
+       SHORTCUT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,       /**< Out of memory */
+       SHORTCUT_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR,         /**< I/O Error */
+       SHORTCUT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,       /**< Permission denied */
+       SHORTCUT_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED,       /**< Not supported */
+       SHORTCUT_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY,               /**< Device or resource busy */
+       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,           /**< Unrecoverable error */
+       SHORTCUT_ERROR_COMM = TIZEN_ERROR_SHORTCUT | 0x0040             /**< Connection not established or communication problem */
+};
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index e2c7796..923fe66 100755 (executable)
@@ -23,6 +23,7 @@
 #include <glib.h>
 #include "shortcut.h"
 #include "shortcut_manager.h"
+#include "shortcut_error.h"
 
 #ifndef EXPORT_API
 #define EXPORT_API __attribute__ ((visibility("default")))
index 0b8b153..fe44516 100755 (executable)
@@ -19,6 +19,7 @@
 #define __SHORTCUT_MANAGER_H__
 
 #include <tizen.h>
+#include "shortcut_error.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -50,24 +51,6 @@ typedef enum _shortcut_type {
 } shortcut_type;
 
 /**
- * @brief Enumeration for values of shortcut response types.
- * @since_tizen 2.3
- */
-enum shortcut_error_e {
-       SHORTCUT_ERROR_NONE = TIZEN_ERROR_NONE,                         /**< Successful */
-       SHORTCUT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,       /**< Invalid function parameter */
-       SHORTCUT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,       /**< Out of memory */
-       SHORTCUT_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR,         /**< I/O Error */
-       SHORTCUT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,       /**< Permission denied */
-       SHORTCUT_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED,       /**< Not supported */
-       SHORTCUT_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY,               /**< Device or resource busy */
-       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,           /**< Unrecoverable error */
-       SHORTCUT_ERROR_COMM = TIZEN_ERROR_SHORTCUT | 0x0040             /**< Connection not established or communication problem */
-};
-
-/**
  * @brief Enumeration for sizes of shortcut widget.
  * @since_tizen 2.4
  */
index a5bf617..aacfd97 100755 (executable)
@@ -6,7 +6,7 @@
 #include <vconf.h>
 #include <vconf-keys.h>
 
-
+#include "shortcut_error.h"
 
 static sqlite3 *_open_db(void)
 {
diff --git a/lib/src/shortcut_error.c b/lib/src/shortcut_error.c
new file mode 100755 (executable)
index 0000000..00c2b17
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2011 - 2016 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 <string.h>
+#include <gio/gio.h>
+#include "shortcut_error.h"
+
+static const GDBusErrorEntry dbus_error_entries[] = {
+       {SHORTCUT_ERROR_INVALID_PARAMETER, "org.freedesktop.Shortcut.Error.INVALID_PARAMETER"},
+       {SHORTCUT_ERROR_OUT_OF_MEMORY,     "org.freedesktop.Shortcut.Error.OUT_OF_MEMORY"},
+       {SHORTCUT_ERROR_IO_ERROR,          "org.freedesktop.Shortcut.Error.IO_ERROR"},
+       {SHORTCUT_ERROR_PERMISSION_DENIED, "org.freedesktop.Shortcut.Error.PERMISSION_DENIED"},
+       {SHORTCUT_ERROR_NOT_SUPPORTED,           "org.freedesktop.Shortcut.Error.NOT_SUPPORTED"},
+       {SHORTCUT_ERROR_RESOURCE_BUSY,  "org.freedesktop.Shortcut.Error.RESOURCE_BUSY"},
+       {SHORTCUT_ERROR_NO_SPACE,         "org.freedesktop.Shortcut.Error.NO_SPACE"},
+       {SHORTCUT_ERROR_EXIST,      "org.freedesktop.Shortcut.Error.EXIST"},
+       {SHORTCUT_ERROR_FAULT, "org.freedesktop.Shortcut.Error.FAULT"},
+       {SHORTCUT_ERROR_COMM, "org.freedesktop.Shortcut.Error.COMM"},
+};
+
+#define SHORTCUT_ERROR_QUARK "shortcut-error-quark"
+
+EXPORT_API GQuark shortcut_error_quark(void)
+{
+       static volatile gsize quark_volatile = 0;
+       static char *domain_name = NULL;
+
+       /* This is for preventing crash when notification api is used in ui-gadget     */
+       /* ui-gadget libraries can be unloaded when it is needed and the static string */
+       /* parameter to g_dbus_error_register_error_domain may cause crash.             */
+       GQuark quark = g_quark_try_string(SHORTCUT_ERROR_QUARK);
+
+       if (quark == 0) {
+               if (domain_name == NULL)
+                       domain_name = strdup(SHORTCUT_ERROR_QUARK);
+       } else {
+               domain_name = SHORTCUT_ERROR_QUARK;
+       }
+
+       g_dbus_error_register_error_domain(domain_name,
+                       &quark_volatile,
+                       dbus_error_entries,
+                       G_N_ELEMENTS(dbus_error_entries));
+       return (GQuark) quark_volatile;
+}
index 776d2f7..ece3e52 100755 (executable)
@@ -44,19 +44,6 @@ static GDBusConnection *_gdbus_conn = NULL;
 static int monitor_id = 0;
 static int provider_monitor_id = 0;
 
-static const GDBusErrorEntry dbus_error_entries[] = {
-       {SHORTCUT_ERROR_INVALID_PARAMETER, "org.freedesktop.Shortcut.Error.INVALID_PARAMETER"},
-       {SHORTCUT_ERROR_OUT_OF_MEMORY,     "org.freedesktop.Shortcut.Error.OUT_OF_MEMORY"},
-       {SHORTCUT_ERROR_IO_ERROR,          "org.freedesktop.Shortcut.Error.IO_ERROR"},
-       {SHORTCUT_ERROR_PERMISSION_DENIED, "org.freedesktop.Shortcut.Error.PERMISSION_DENIED"},
-       {SHORTCUT_ERROR_NOT_SUPPORTED,           "org.freedesktop.Shortcut.Error.NOT_SUPPORTED"},
-       {SHORTCUT_ERROR_RESOURCE_BUSY,  "org.freedesktop.Shortcut.Error.RESOURCE_BUSY"},
-       {SHORTCUT_ERROR_NO_SPACE,         "org.freedesktop.Shortcut.Error.NO_SPACE"},
-       {SHORTCUT_ERROR_EXIST,      "org.freedesktop.Shortcut.Error.EXIST"},
-       {SHORTCUT_ERROR_FAULT, "org.freedesktop.Shortcut.Error.FAULT"},
-       {SHORTCUT_ERROR_COMM, "org.freedesktop.Shortcut.Error.COMM"},
-};
-
 typedef struct _shortcut_request_cb_info {
        int (*request_cb)(const char *appid, const char *name, int type, const char *content, const char *icon, pid_t pid, double period, int allow_duplicate, void *data);
        void *data;
@@ -70,33 +57,6 @@ typedef struct _shortcut_remove_cb_info {
 static shortcut_request_cb_info _request_callback_info;
 static shortcut_remove_cb_info _remove_callback_info;
 
-
-#define SHORTCUT_ERROR_QUARK "shortcut-error-quark"
-
-EXPORT_API GQuark shortcut_error_quark(void)
-{
-       static volatile gsize quark_volatile = 0;
-       static char *domain_name = NULL;
-
-       /* This is for preventing crash when notification api is used in ui-gadget     */
-       /* ui-gadget libraries can be unloaded when it is needed and the static string */
-       /* parameter to g_dbus_error_register_error_domain may cause crash.             */
-       GQuark quark = g_quark_try_string(SHORTCUT_ERROR_QUARK);
-
-       if (quark == 0) {
-               if (domain_name == NULL)
-                       domain_name = strdup(SHORTCUT_ERROR_QUARK);
-       } else {
-               domain_name = SHORTCUT_ERROR_QUARK;
-       }
-
-       g_dbus_error_register_error_domain(domain_name,
-                       &quark_volatile,
-                       dbus_error_entries,
-                       G_N_ELEMENTS(dbus_error_entries));
-       return (GQuark) quark_volatile;
-}
-
 /* LCOV_EXCL_START */
 static void _add_shortcut_notify(GVariant *parameters)
 {
@@ -504,7 +464,7 @@ EXPORT_API int shortcut_set_remove_cb(shortcut_remove_cb remove_cb, void *user_d
 {
        int ret;
 
-       if(remove_cb == NULL)
+       if (remove_cb == NULL)
                return SHORTCUT_ERROR_INVALID_PARAMETER;
 
        ret = _dbus_init();
@@ -552,7 +512,7 @@ EXPORT_API int shortcut_remove_from_home(const char *name, result_cb_t result_cb
        int ret;
        GVariant *body;
 
-       if(name == NULL) {
+       if (name == NULL) {
                ErrPrint("name is NULL.");
                return SHORTCUT_ERROR_INVALID_PARAMETER;
        }
index 21081be..214707b 100755 (executable)
@@ -32,7 +32,6 @@
 #include "shortcut_manager.h"
 #include "shortcut_internal.h"
 
-
 #define SHORTCUT_IS_WIDGET_SIZE(size)           (!!((size) & WIDGET_SIZE_DEFAULT))
 
 EAPI int shortcut_set_request_cb(shortcut_request_cb request_cb, void *data)
index 0d0e948..f8baec2 100755 (executable)
@@ -104,6 +104,7 @@ chsmack -a User::Home %{TZ_SYS_DB}/.shortcut_service.db-journal
 %{_includedir}/shortcut/shortcut_manager.h
 %{_includedir}/shortcut/shortcut_db.h
 %{_includedir}/shortcut/shortcut_internal.h
+%{_includedir}/shortcut/shortcut_error.h
 
 %{_libdir}/pkgconfig/shortcut.pc