From: Kim Kibum Date: Sun, 29 Apr 2012 08:01:23 +0000 (+0900) Subject: upload tizen1.0 source X-Git-Tag: 2.0_alpha~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=59487c9c03d416466045bc9605b76db302ca1534;p=framework%2Fappfw%2Flibrua.git upload tizen1.0 source --- diff --git a/.gitignore b/.gitignore deleted file mode 100644 index cb37e3a..0000000 --- a/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -build_log -*.log -*.pyc -usr -opt -*.o -*.os -*.exe -packages -binaries -*.ipk -*~ -.build/ -build-stamp -configure-stamp -debian/files -debian/*.install -debian/*.debhelper -debian/*.substvars -CMakeCache.txt -CMakeFiles/ -Makefile -cmake_install.cmake -debian/librua-0.postinst -debian/librua-0/ -debian/librua-dbg/ -debian/librua-dev/ -install_manifest.txt -librua.so -librua.so.0 -librua.so.0.1.0 -rua.pc diff --git a/LICENSE b/LICENSE index 9c13a9b..bae7f54 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. Apache License Version 2.0, January 2004 diff --git a/NOTICE b/NOTICE index ded3804..4c49449 100644 --- a/NOTICE +++ b/NOTICE @@ -1 +1 @@ -Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. \ No newline at end of file +Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. diff --git a/debian/changelog b/debian/changelog index 66c631d..3c7bc9e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,7 @@ -librua (0.1.0-26) unstable; urgency=low +librua (0.1.0-33) unstable; urgency=low * Initial Release. * Git: pkgs/l/librua - * Tag: librua_0.1.0-26 + * Tag: librua_0.1.0-33 - -- Jinwoo Nam Wed, 07 Dec 2011 12:56:46 +0900 + -- Jinwoo Nam Sat, 17 Mar 2012 16:52:46 +0900 diff --git a/include/db-schema.h b/include/db-schema.h index f936009..f405aea 100644 --- a/include/db-schema.h +++ b/include/db-schema.h @@ -1,7 +1,7 @@ /* * RUA * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: Jayoun Lee * diff --git a/include/rua.h b/include/rua.h index 3448784..642e617 100644 --- a/include/rua.h +++ b/include/rua.h @@ -1,7 +1,7 @@ /* * RUA * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: Jayoun Lee * @@ -19,6 +19,14 @@ * */ +/** + * @file rua.h + * @brief RUA API declaration header file. + * @author Jinwoo Nam (jwoo.nam@samsung.com) + * @version 0.1 + * @history 0.1: RUA API Declarations, structure declaration + */ + #ifndef __RUA_H__ #define __RUA_H__ @@ -33,83 +41,123 @@ extern "C" { #endif +/** + * @defgroup RUA rua + * @{ + */ + +/** + * @} + */ + +/** + * @addtogroup RUA + * @{ + */ + +/** + * @struct rua_rec + * @brief RUA record info structure + */ struct rua_rec { - int id; - char *pkg_name; - char *app_path; - char *arg; - time_t launch_time; + int id; /**< primary key */ + char *pkg_name; /**< package name */ + char *app_path; /**< application path */ + char *arg; /**< application launching argument */ + time_t launch_time; /**< application launching time */ }; -/* API */ /** - * Clear history - * return This method returns 0 (SUCCESS) or -1 (FAIL) + * @brief Clear history + * @return 0 on success, otherwise a nagative error value + * @retval 0 on successful + * @retval -1 on failed */ API int rua_clear_history(void); -/* API */ /** - * Delete history with pkg_name - * return This method returns 0 (SUCCESS) or -1 (FAIL) + * @brief Delete history with pkg_name + * @param[in] pkg_name package name to delete history + * @return 0 on success, otherwise a nagative error value + * @retval 0 on successful + * @retval -1 on failed */ API int rua_delete_history_with_pkgname(char *pkg_name); -/* API */ /** - * Delete history with app_path - * return This method returns 0 (SUCCESS) or -1 (FAIL) + * @brief Delete history with app_path + * @param[in] app_path package name to delete history + * @return 0 on success, otherwise a nagative error value + * @retval 0 on successful + * @retval -1 on failed */ API int rua_delete_history_with_apppath(char *app_path); -/* API */ -/** - * Delete history with app_path (Will be deprecated!) - * return This method returns 0 (SUCCESS) or -1 (FAIL) - */ -API int rua_delete_history(char *app_path); - -/* API */ /** - * Add application to recently used application list - * return This method returns 0 (SUCCESS) or -1 (FAIL) + * @brief Add application to recently used application list + * @param[in] rec record to add history + * @return 0 on success, otherwise a nagative error value + * @retval 0 on successful + * @retval -1 on failed */ API int rua_add_history(struct rua_rec *rec); /** - * Load recently used application history db. - * return This method returns 0 (SUCCESS) or -1 (FAIL) + * @brief Load recently used application history db. + * @param[out] table db table pointer + * @param[out] nrows the number of record + * @param[out] ncols the number of field + * @return 0 on success, otherwise a nagative error value + * @retval 0 on successful + * @retval -1 on failed */ API int rua_history_load_db(char ***table, int *nrows, int *ncols); /** - * Unload recently used application history db. - * return This method returns 0 (SUCCESS) or -1 (FAIL) + * @brief Unload recently used application history db. + * @param[in] table db table pointer to unload + * @return 0 on success, otherwise a nagative error value + * @retval 0 on successful + * @retval -1 on failed */ API int rua_history_unload_db(char ***table); /** - * Load recently used application record. - * return This method returns 0 (SUCCESS) or -1 (FAIL) + * @brief Load recently used application record. + * @param[out] rec record to load + * @param[in] table db table pointer + * @param[in] nrows the number of record + * @param[in] ncols the number of field + * @param[in] row record index to load + * @return 0 on success, otherwise a nagative error value + * @retval 0 on successful + * @retval -1 on failed */ API int rua_history_get_rec(struct rua_rec *rec, char **table, int nrows, int ncols, int row); /** - * Check some package is latest or not with package name - * return This method returns 0 (true) or -1 (false) + * @brief Check some package is latest or not with package name + * @param[in] pkg_name package name + * @return 0 on success, otherwise a nagative error value + * @retval 0 if given pkg_name is lastest application + * @retval -1 if not lastest applicaton or on failed */ API int rua_is_latest_app(const char *pkg_name); /** - * initialize rua - * return This method returns 0 (SUCCESS) or -1 (FAIL) + * @brief Initialize rua + * @return 0 on success, otherwise a nagative error value + * @retval 0 on successful + * @retval -1 on failed */ API int rua_init(void); /** - * finalize rua - * return This method returns 0 (SUCCESS) or -1 (FAIL) + * @brief Finalize rua + * @return 0 on success, otherwise a nagative error value + * @retval 0 on successful + * @retval -1 on failed */ API int rua_fini(void); diff --git a/packaging/librua.spec b/packaging/librua.spec index 4376125..261d068 100644 --- a/packaging/librua.spec +++ b/packaging/librua.spec @@ -1,12 +1,12 @@ Name: librua Summary: Recently used application -Version: 0.1.0 -Release: 1 -Group: TO BE/FILLED IN -License: TO BE FILLED IN +Version: 0.1.0 +Release: 33 +Group: System/Libraries +License: Apache License, Version 2.0 Source0: librua-%{version}.tar.gz -Requires(post): /sbin/ldconfig, /bin/chown, /bin/mkdir +Requires(post): /sbin/ldconfig Requires(post): /usr/bin/sqlite3 Requires(postun): /sbin/ldconfig BuildRequires: cmake @@ -34,9 +34,12 @@ Recently used application library (devel) %build cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} + + make %{?jobs:-j%jobs} %install +rm -rf %{buildroot} %make_install %post @@ -44,8 +47,8 @@ make %{?jobs:-j%jobs} mkdir -p /opt/dbspace/ sqlite3 /opt/dbspace/.rua.db < /opt/share/rua_db.sql rm -rf /opt/share/rua_db.sql -chown root:5000 /opt/dbspace/.rua.db -chown root:5000 /opt/dbspace/.rua.db-journal +chown 0:5000 /opt/dbspace/.rua.db +chown 0:5000 /opt/dbspace/.rua.db-journal chmod 660 /opt/dbspace/.rua.db chmod 660 /opt/dbspace/.rua.db-journal @@ -54,12 +57,14 @@ chmod 660 /opt/dbspace/.rua.db-journal %files +%defattr(-,root,root,-) %config(missingok) /opt/share/rua_db.sql /usr/lib/librua.so.* %files devel +%defattr(-,root,root,-) /usr/include/rua/*.h /usr/lib/librua.so /usr/lib/pkgconfig/rua.pc diff --git a/rua.c b/rua.c index 9b9e842..67a9245 100644 --- a/rua.c +++ b/rua.c @@ -1,7 +1,7 @@ /* * RUA * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: Jayoun Lee * @@ -101,25 +101,6 @@ int rua_delete_history_with_apppath(char *app_path) return r; } -int rua_delete_history(char *app_path) -{ - int r; - char query[QUERY_MAXLEN]; - - if (_db == NULL) - return -1; - - if (app_path == NULL) - return -1; - - snprintf(query, QUERY_MAXLEN, "delete from %s where app_path = '%s';", - RUA_HISTORY, app_path); - - r = __exec(_db, query); - - return r; -} - int rua_add_history(struct rua_rec *rec) { int r; @@ -148,7 +129,7 @@ int rua_add_history(struct rua_rec *rec) } sqlite3_finalize(stmt); - if (cnt == 0) { + if (cnt == 0) /* insert */ snprintf(query, QUERY_MAXLEN, "insert into %s ( pkg_name, app_path, arg, launch_time ) " @@ -157,19 +138,12 @@ int rua_add_history(struct rua_rec *rec) rec->pkg_name ? rec->pkg_name : "", rec->app_path ? rec->app_path : "", rec->arg ? rec->arg : "", time(NULL)); - } else { + else /* update */ - if (rec->arg) { - snprintf(query, QUERY_MAXLEN, - "update %s set arg='%s', launch_time='%d' where pkg_name = '%s';", - RUA_HISTORY, - rec->arg, time(NULL), rec->pkg_name); - } else { - snprintf(query, QUERY_MAXLEN, - "update %s set launch_time='%d' where pkg_name = '%s';", - RUA_HISTORY, time(NULL), rec->pkg_name); - } - } + snprintf(query, QUERY_MAXLEN, + "update %s set arg='%s', launch_time='%d' where pkg_name = '%s';", + RUA_HISTORY, + rec->arg ? rec->arg : "", time(NULL), rec->pkg_name); r = __exec(_db, query); if (r == -1) { @@ -212,8 +186,9 @@ int rua_history_unload_db(char ***table) if (*table) { sqlite3_free_table(*table); *table = NULL; + return 0; } - return 0; + return -1; } int rua_history_get_rec(struct rua_rec *rec, char **table, int nrows, int ncols,