From bc2fb69c89c2046e58a1cd47a4b59acb43405bfa Mon Sep 17 00:00:00 2001 From: =?utf8?q?K=C3=A9vin=20THIERRY?= Date: Fri, 7 Feb 2014 10:16:29 +0100 Subject: [PATCH] Add multi-user support MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Also: + set a valid license tag + improve description Bug-Tizen: PTREL-336 Change-Id: I46630b44e7b8ba5e0098d42cad70c2dd2c553ef9 Signed-off-by: Kévin THIERRY --- CMakeLists.txt | 2 +- heynoti.c | 12 +++++++----- heynotitool.c | 7 ++++--- packaging/heynoti.spec | 20 +++++++++++--------- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b248b9..c3c5f4d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) INCLUDE(FindPkgConfig) pkg_check_modules(glib_pkg REQUIRED gobject-2.0) -pkg_check_modules(pkgs REQUIRED glib-2.0 dlog) +pkg_check_modules(pkgs REQUIRED glib-2.0 dlog libtzplatform-config) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) diff --git a/heynoti.c b/heynoti.c index 7f92c9c..2d4b8cc 100755 --- a/heynoti.c +++ b/heynoti.c @@ -37,12 +37,15 @@ #include #include +/* For multi-user support */ +#include + #include "heynoti-internal.h" #define AU_PREFIX_SYSNOTI "SYS" #ifndef NOTI_ROOT -# define NOTI_ROOT "/opt/share/noti" +#define NOTI_ROOT tzplatform_mkpath(TZ_SYS_SHARE, "noti") #endif @@ -106,7 +109,6 @@ struct noti_cont { }; typedef struct noti_cont ncont; -static const char *noti_root = NOTI_ROOT; static GList *g_nc; static int __make_noti_root(const char *p) @@ -135,7 +137,7 @@ static int __make_noti_file(const char *p) static inline int __make_noti_path(char *path, int size, const char *name) { - return snprintf(path, size, "%s/%s", noti_root, name); + return snprintf(path, size, "%s/%s", NOTI_ROOT, name); } static int __read_proc(const char *path, char *buf, int size) @@ -543,9 +545,9 @@ API int heynoti_init() r = fcntl(fd, F_SETFL, O_NONBLOCK); util_retvm_if(r < 0, -1, "fcntl error : %s", strerror(errno)); - r = __make_noti_root(noti_root); + r = __make_noti_root(NOTI_ROOT); if (r == -1) { - UTIL_ERR("make noti root: %s : %s", noti_root, strerror(errno)); + UTIL_ERR("make noti root: %s : %s", NOTI_ROOT, strerror(errno)); close(fd); return -1; } diff --git a/heynotitool.c b/heynotitool.c index dc492c3..4e83102 100755 --- a/heynotitool.c +++ b/heynotitool.c @@ -34,17 +34,18 @@ #include #include +/* For multi-user support */ +#include + +#define HEYNOTI_PREFIX tzplatform_mkpath(TZ_SYS_SHARE, "noti") #define BUFSIZE 1024 const int SHARED_PERM = 0666; const int USER_PERM = 0644; -const char *HEYNOTI_PREFIX = "/opt/share/noti"; - static int is_app = FALSE; static int perm = 0; -static int user_id = 5000; static GOptionEntry entries[] = { diff --git a/packaging/heynoti.spec b/packaging/heynoti.spec index 9ae21d2..a3a2ceb 100644 --- a/packaging/heynoti.spec +++ b/packaging/heynoti.spec @@ -1,21 +1,21 @@ -# - Name: heynoti Version: 0.0.2 -Release: 39 -License: Apache License, Version 2.0 +Release: 0 +License: Apache-2.0 Summary: HEY (ligHt Easy speedy) notification library Group: System/Libraries Source0: %{name}-%{version}.tar.gz -Source1001: heynoti.manifest +Source1001: heynoti.manifest BuildRequires: cmake BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(libtzplatform-config) %description -lightweight notification library, service APIs +HEY (ligHt Easy speedy) notification library is a lightweight +notification library with service APIs. %package devel Summary: Notification library @@ -24,7 +24,9 @@ Requires: %{name} = %{version} Requires: heynoti %description devel -heynoti API (devel) +Development files for HEY (ligHt Easy speedy) notification library. HEY +is a lightweight notification library with service APIs. + %prep %setup -q @@ -40,7 +42,7 @@ make %{?_smp_mflags} %install %make_install -mkdir -p %{buildroot}/opt/share/noti +mkdir -p %{buildroot}%{TZ_SYS_SHARE}/noti %post -p /sbin/ldconfig @@ -53,7 +55,7 @@ mkdir -p %{buildroot}/opt/share/noti %{_libdir}/libheynoti.so.0 %{_libdir}/libheynoti.so.0.0.2 %{_bindir}/heynotitool -%attr(1755,root,root) /opt/share/noti +%attr(1755,root,root) %{TZ_SYS_SHARE}/noti %files devel -- 2.7.4