Add multi-user support 58/16458/1
authorKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Fri, 7 Feb 2014 09:16:29 +0000 (10:16 +0100)
committerKévin THIERRY <kevin.thierry@open.eurogiciel.org>
Mon, 17 Feb 2014 14:18:48 +0000 (15:18 +0100)
Also:
+ set a valid license tag
+ improve description

Bug-Tizen: PTREL-336
Change-Id: I46630b44e7b8ba5e0098d42cad70c2dd2c553ef9
Signed-off-by: Kévin THIERRY <kevin.thierry@open.eurogiciel.org>
CMakeLists.txt
heynoti.c
heynotitool.c
packaging/heynoti.spec

index 5b248b9..c3c5f4d 100755 (executable)
@@ -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)
index 7f92c9c..2d4b8cc 100755 (executable)
--- a/heynoti.c
+++ b/heynoti.c
 #include <glib.h>
 #include <sys/utsname.h>
 
+/* For multi-user support */
+#include <tzplatform_config.h>
+
 #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;
        }
index dc492c3..4e83102 100755 (executable)
 #include <sys/types.h>
 #include <fcntl.h>
 
+/* For multi-user support */
+#include <tzplatform_config.h>
+
+#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[] = {
index 9ae21d2..a3a2ceb 100644 (file)
@@ -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