INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/images DESTINATION ${RESDIR})
ADD_SUBDIRECTORY(data)
+ADD_SUBDIRECTORY(daemon)
--- /dev/null
+# Copyright (c) 2014 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.
+#
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT("notification-display" C)
+
+MESSAGE(STATUS "PREFIX: " ${CMAKE_INSTALL_PREFIX})
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(SERVICE_PKGS REQUIRED
+ glib-2.0
+ notification
+ app-utils)
+
+SET(SERVICE_SRCS
+ notification_display_service.c)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include)
+
+FOREACH(flag ${SERVICE_PKGS_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${SERVICE_SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SERVICE_PKGS_LDFLAGS})
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${SERVICEDIR})
--- /dev/null
+[Unit]
+Description=Notifications Display daemon
+Requires=notifications.service display-manager-run.service
+After=notifications.service display-manager-run.service
+
+[Service]
+Type=simple
+EnvironmentFile=/run/tizen-system-env
+ExecStart=/usr/bin/notification-display
+Restart=always
+
+[Install]
+WantedBy=default.target
+
--- /dev/null
+#include <stdio.h>
+#include <unistd.h>
+#include <glib.h>
+#include <Elementary.h>
+#include <app_debug.h>
+#include <notification.h>
+#include <notification_internal.h>
+
+#define SERVICE_NAME "notification-display"
+
+SET_TAG(SERVICE_NAME)
+
+void _dbg_notification(notification_h noti)
+{
+ char *pkgname = NULL;
+ char *title = NULL;
+ char *content = NULL;
+ char *image_path = NULL;
+
+ notification_get_pkgname(noti, &pkgname);
+ notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &title);
+ notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, &content);
+ notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, &image_path);
+
+ _DBG("\nNew Notification : %s", title);
+ _DBG("Icon : %s", image_path);
+ _DBG("Message : %s", content);
+}
+
+void _notification_changed_cb(void *data, notification_type_e notif_type)
+{
+ notification_h noti = NULL;
+ notification_list_h noti_list = NULL, get_list;
+
+ notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬i_list);
+ get_list = notification_list_get_tail(noti_list);
+ if (get_list) {
+ noti = notification_list_get_data(get_list);
+ _dbg_notification(noti);
+ }
+
+ notification_free_list(noti_list);
+}
+
+int main(int argc, char **argv)
+{
+ notification_error_e error_n;
+ Evas_Object *win;
+
+ elm_init(0, NULL);
+
+ win = elm_win_add(NULL, SERVICE_NAME, ELM_WIN_NOTIFICATION);
+ elm_win_alpha_set(win, EINA_TRUE);
+ evas_object_show(win);
+
+ error_n = NOTIFICATION_ERROR_SERVICE_NOT_READY;
+ while (error_n != NOTIFICATION_ERROR_NONE) {
+ error_n = notification_resister_changed_cb(
+ _notification_changed_cb, NULL);
+ _DBG("Could not register with notifications server");
+ sleep(5);
+ }
+
+ elm_run();
+
+ elm_shutdown();
+
+ return 0;
+}
%define _resdir %{_pkgdir}/res
%define _datadir %{_pkgdir}/data
%define _edjedir %{_resdir}/edje
+%define _servicedir %{_prefix}/bin
%define _manifestdir %{_datarootdir}/packages
%description
-DBINDIR=%{_bindir} \
-DEDJEDIR=%{_edjedir} \
-DMANIFESTDIR=%{_manifestdir} \
+ -DSERVICEDIR=%{_servicedir} \
-DVERSION=%{version}
make %{?jobs:-j%jobs}
%install
%make_install
install --directory %{buildroot}/%{_datadir}
+mkdir -p %{buildroot}/%{_unitdir_user}/default.target.wants
+install -m 0644 daemon/notification-display.service %{buildroot}/%{_unitdir_user}/notification-display.service
+ln -sf ../notification-display.service %{buildroot}/%{_unitdir_user}/default.target.wants/notification-display.service
%clean
rm -rf %{buildroot}
%defattr(-,root,root,-)
%{_bindir}/*
%{_resdir}/*
+%{_servicedir}/*
%{_datadir}
%{_manifestdir}/%{name}.xml
+%{_unitdir_user}/default.target.wants/notification-display.service
+%{_unitdir_user}/notification-display.service