summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>2014-02-07 14:45:02 +0100
committerJean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>2014-04-08 09:56:39 +0200
commit38111fc05f2895d4bdaa7f2bcc5e495564cb0095 (patch)
tree9a327bb6e8fa3254fec64f05cea17f3bd0ea3ee2
parent38b527ff42613fc0c17e3c70e542c931b2d63687 (diff)
downloadnotification-accepted/tizen_3.0.2014.q3_common.tar.gz
notification-accepted/tizen_3.0.2014.q3_common.tar.bz2
notification-accepted/tizen_3.0.2014.q3_common.zip
Bug-Tizen: PTREL-295 Change-Id: Ia834e7aefdad357cac3e1d8092afd730d4faa4aa Signed-off-by: Jean-Benoit MARTIN <jean-benoit.martin@open.eurogiciel.org>
-rwxr-xr-xCMakeLists.txt6
-rwxr-xr-xinclude/notification_db.h7
-rw-r--r--notification_DB_init.sh100
-rwxr-xr-xpackaging/notification.spec99
-rwxr-xr-xsrc/notification_setting.c3
5 files changed, 111 insertions, 104 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe012ea..4c230df 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,6 @@ SET(EXEC_PREFIX "\${prefix}")
SET(LIBDIR ${LIB_INSTALL_DIR})
SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
SET(ICONDIR "${PREFIX}/share/${PROJECT_NAME}")
-SET(DBDIR "/opt/dbspace")
SET(DBFILE ".notification.db")
SET(MAJOR_VER 0)
SET(VERSION ${MAJOR_VER}.1.0)
@@ -51,6 +50,7 @@ pkg_check_modules(pkgs REQUIRED
com-core
ecore
eina
+ libtzplatform-config
)
FOREACH(flag ${pkgs_CFLAGS})
@@ -64,7 +64,6 @@ SET(CMAKE_SKIP_BUILD_RPATH TRUE)
ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
ADD_DEFINITIONS("-DICONDIR=\"${ICONDIR}\"")
-ADD_DEFINITIONS("-DDBDIR=\"${DBDIR}\"")
ADD_DEFINITIONS("-DDBFILE=\"${DBFILE}\"")
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
@@ -81,8 +80,9 @@ FOREACH(hfile ${HEADERS-DEVEL})
ENDFOREACH(hfile)
CONFIGURE_FILE(${PROJECT_NAME}-service.pc.in ${PROJECT_NAME}-service.pc @ONLY)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-service.pc DESTINATION lib/pkgconfig)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-service.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
FOREACH(hfile ${HEADERS-SERVICE-DEVEL})
INSTALL(FILES ${CMAKE_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME}/service)
ENDFOREACH(hfile)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/notification_DB_init.sh DESTINATION ${SHARE_INSTALL_PREFIX}/${PROJECT_NAME})
diff --git a/include/notification_db.h b/include/notification_db.h
index c9e3f79..fb9b2d5 100755
--- a/include/notification_db.h
+++ b/include/notification_db.h
@@ -24,16 +24,13 @@
#include <bundle.h>
#include <sqlite3.h>
-
-#ifndef DBDIR
-#error "DBDIR not defined"
-#endif
+#include <tzplatform_config.h>
#ifndef DBFILE
#error "DBFILE not defined"
#endif
-#define DBPATH DBDIR"/"DBFILE
+#define DBPATH tzplatform_mkpath(TZ_SYS_DB,DBFILE)
#define NOTIFICATION_QUERY_MAX 4096
diff --git a/notification_DB_init.sh b/notification_DB_init.sh
new file mode 100644
index 0000000..d815f61
--- /dev/null
+++ b/notification_DB_init.sh
@@ -0,0 +1,100 @@
+#!/bin/sh
+
+source /etc/tizen-platform.conf
+
+if [ ! -d $TZ_SYS_DB ]
+then
+ mkdir $TZ_SYS_DB
+fi
+
+if [ ! -f $TZ_SYS_DB/.notification.db ]
+then
+ sqlite3 $TZ_SYS_DB/.notification.db 'PRAGMA journal_mode = PERSIST;
+ create table if not exists noti_list (
+ type INTEGER NOT NULL,
+ layout INTEGER NOT NULL default 0,
+ caller_pkgname TEXT NOT NULL,
+ launch_pkgname TEXT,
+ image_path TEXT,
+ group_id INTEGER default 0,
+ internal_group_id INTEGER default 0,
+ priv_id INTERGER NOT NULL,
+ title_key TEXT,
+ b_text TEXT,
+ b_key TEXT,
+ b_format_args TEXT,
+ num_format_args INTEGER default 0,
+ text_domain TEXT,
+ text_dir TEXT,
+ time INTEGER default 0,
+ insert_time INTEGER default 0,
+ args TEXT,
+ group_args TEXT,
+ b_execute_option TEXT,
+ b_service_responding TEXT,
+ b_service_single_launch TEXT,
+ b_service_multi_launch TEXT,
+ sound_type INTEGER default 0,
+ sound_path TEXT,
+ vibration_type INTEGER default 0,
+ vibration_path TEXT,
+ led_operation INTEGER default 0,
+ led_argb INTEGER default 0,
+ led_on_ms INTEGER default -1,
+ led_off_ms INTEGER default -1,
+ flags_for_property INTEGER default 0,
+ flag_simmode INTEGER default 0,
+ display_applist INTEGER,
+ progress_size DOUBLE default 0,
+ progress_percentage DOUBLE default 0,
+ rowid INTEGER PRIMARY KEY AUTOINCREMENT,
+ UNIQUE (caller_pkgname, priv_id)
+ );
+ create table if not exists noti_group_data (
+ caller_pkgname TEXT NOT NULL,
+ group_id INTEGER default 0,
+ badge INTEGER default 0,
+ title TEXT,
+ content TEXT,
+ loc_title TEXT,
+ loc_content TEXT,
+ count_display_title INTEGER,
+ count_display_content INTEGER,
+ rowid INTEGER PRIMARY KEY AUTOINCREMENT,
+ UNIQUE (caller_pkgname, group_id)
+ );
+ create table if not exists ongoing_list (
+ caller_pkgname TEXT NOT NULL,
+ launch_pkgname TEXT,
+ icon_path TEXT,
+ group_id INTEGER default 0,
+ internal_group_id INTEGER default 0,
+ priv_id INTERGER NOT NULL,
+ title TEXT,
+ content TEXT,
+ default_content TEXT,
+ loc_title TEXT,
+ loc_content TEXT,
+ loc_default_content TEXT,
+ text_domain TEXT,
+ text_dir TEXT,
+ args TEXT,
+ group_args TEXT,
+ flag INTEGER default 0,
+ progress_size DOUBLE default 0,
+ progress_percentage DOUBLE default 0,
+ rowid INTEGER PRIMARY KEY AUTOINCREMENT,
+ UNIQUE (caller_pkgname, priv_id)
+ );
+ '
+fi
+
+users_gid=$(getent group $TZ_SYS_USER_GROUP | cut -f3 -d':')
+
+chown :$TZ_SYS_USER_GROUP $TZ_SYS_DB/.notification.db
+chown :$TZ_SYS_USER_GROUP $TZ_SYS_DB/.notification.db-journal
+chmod 640 $TZ_SYS_DB/.notification.db
+chmod 640 $TZ_SYS_DB/.notification.db-journal
+chsmack -a 'notification::db' $TZ_SYS_DB/.notification.db*
+SMACK_OPTION="-s system::vconf_misc"
+vconftool set -t string memory/private/libstatus/message "" -i -g $users_gid -f $SMACK_OPTION
diff --git a/packaging/notification.spec b/packaging/notification.spec
index 24a8523..a84edd5 100755
--- a/packaging/notification.spec
+++ b/packaging/notification.spec
@@ -20,6 +20,8 @@ BuildRequires: pkgconfig(dbus-glib-1)
BuildRequires: pkgconfig(com-core)
BuildRequires: pkgconfig(ecore)
BuildRequires: pkgconfig(eina)
+BuildRequires: pkgconfig(libtzplatform-config)
+Requires: libtzplatform-config
BuildRequires: cmake
Requires(post): /sbin/ldconfig
@@ -65,101 +67,7 @@ rm -rf %{buildroot}
%post
/sbin/ldconfig
-
-if [ ! -d /opt/dbspace ]
-then
- mkdir /opt/dbspace
-fi
-
-if [ ! -f /opt/dbspace/.notification.db ]
-then
- sqlite3 /opt/dbspace/.notification.db 'PRAGMA journal_mode = PERSIST;
- create table if not exists noti_list (
- type INTEGER NOT NULL,
- layout INTEGER NOT NULL default 0,
- caller_pkgname TEXT NOT NULL,
- launch_pkgname TEXT,
- image_path TEXT,
- group_id INTEGER default 0,
- internal_group_id INTEGER default 0,
- priv_id INTERGER NOT NULL,
- title_key TEXT,
- b_text TEXT,
- b_key TEXT,
- b_format_args TEXT,
- num_format_args INTEGER default 0,
- text_domain TEXT,
- text_dir TEXT,
- time INTEGER default 0,
- insert_time INTEGER default 0,
- args TEXT,
- group_args TEXT,
- b_execute_option TEXT,
- b_service_responding TEXT,
- b_service_single_launch TEXT,
- b_service_multi_launch TEXT,
- sound_type INTEGER default 0,
- sound_path TEXT,
- vibration_type INTEGER default 0,
- vibration_path TEXT,
- led_operation INTEGER default 0,
- led_argb INTEGER default 0,
- led_on_ms INTEGER default -1,
- led_off_ms INTEGER default -1,
- flags_for_property INTEGER default 0,
- flag_simmode INTEGER default 0,
- display_applist INTEGER,
- progress_size DOUBLE default 0,
- progress_percentage DOUBLE default 0,
- rowid INTEGER PRIMARY KEY AUTOINCREMENT,
- UNIQUE (caller_pkgname, priv_id)
- );
- create table if not exists noti_group_data (
- caller_pkgname TEXT NOT NULL,
- group_id INTEGER default 0,
- badge INTEGER default 0,
- title TEXT,
- content TEXT,
- loc_title TEXT,
- loc_content TEXT,
- count_display_title INTEGER,
- count_display_content INTEGER,
- rowid INTEGER PRIMARY KEY AUTOINCREMENT,
- UNIQUE (caller_pkgname, group_id)
- );
- create table if not exists ongoing_list (
- caller_pkgname TEXT NOT NULL,
- launch_pkgname TEXT,
- icon_path TEXT,
- group_id INTEGER default 0,
- internal_group_id INTEGER default 0,
- priv_id INTERGER NOT NULL,
- title TEXT,
- content TEXT,
- default_content TEXT,
- loc_title TEXT,
- loc_content TEXT,
- loc_default_content TEXT,
- text_domain TEXT,
- text_dir TEXT,
- args TEXT,
- group_args TEXT,
- flag INTEGER default 0,
- progress_size DOUBLE default 0,
- progress_percentage DOUBLE default 0,
- rowid INTEGER PRIMARY KEY AUTOINCREMENT,
- UNIQUE (caller_pkgname, priv_id)
- );
- '
-fi
-
-chown :5000 /opt/dbspace/.notification.db
-chown :5000 /opt/dbspace/.notification.db-journal
-chmod 640 /opt/dbspace/.notification.db
-chmod 640 /opt/dbspace/.notification.db-journal
-chsmack -a 'notification::db' /opt/dbspace/.notification.db*
-SMACK_OPTION="-s system::vconf_misc"
-vconftool set -t string memory/private/libstatus/message "" -i -g 5000 -f $SMACK_OPTION
+%{_datadir}/%{name}/notification_DB_init.sh
%postun -p /sbin/ldconfig
@@ -167,6 +75,7 @@ vconftool set -t string memory/private/libstatus/message "" -i -g 5000 -f $SMAC
%manifest notification.manifest
%defattr(-,root,root,-)
%{_libdir}/libnotification.so*
+%attr(0755,root,root) %{_datadir}/%{name}/notification_DB_init.sh
/usr/share/license/%{name}
%files devel
diff --git a/src/notification_setting.c b/src/notification_setting.c
index 6fac097..69aca51 100755
--- a/src/notification_setting.c
+++ b/src/notification_setting.c
@@ -31,9 +31,10 @@
#include <notification_ipc.h>
#include <notification_setting.h>
#include <notification_internal.h>
+#include <tzplatform_config.h>
#define NOTIFICATION_SETTING_DB "notification_setting"
-#define NOTIFICATION_SETTING_DB_PATH "/opt/usr/dbspace/.notification_parser.db"
+#define NOTIFICATION_SETTING_DB_PATH tzplatform_mkpath(TZ_USER_DB,".notification_parser.db")
struct _notification_setting_h {
char *appid;