summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorjinwoo.shin <jw0227.shin@samsung.com>2015-11-17 19:18:27 +0900
committerjinwoo.shin <jw0227.shin@samsung.com>2015-11-17 19:19:34 +0900
commit200587ed1894e51e1e35d2f2ca96c93d6ed74c17 (patch)
tree37c3cd71d72b9ae66b30676c4d32ce1ac333521b /daemon
parent7f0dc6086e839d93e8f192332b73033a32421d09 (diff)
downloadair_infosquare-200587ed1894e51e1e35d2f2ca96c93d6ed74c17.tar.gz
air_infosquare-200587ed1894e51e1e35d2f2ca96c93d6ed74c17.tar.bz2
air_infosquare-200587ed1894e51e1e35d2f2ca96c93d6ed74c17.zip
Change-Id: I7cc17e3294543fa6469a017294d4421af6917cb3 Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
Diffstat (limited to 'daemon')
-rw-r--r--daemon/CMakeLists.txt41
-rw-r--r--daemon/notification-display.path5
-rw-r--r--daemon/notification-display.service11
-rw-r--r--daemon/notification_display_service.c161
4 files changed, 0 insertions, 218 deletions
diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt
deleted file mode 100644
index 7d8c765..0000000
--- a/daemon/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# 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})
diff --git a/daemon/notification-display.path b/daemon/notification-display.path
deleted file mode 100644
index 6adbaaa..0000000
--- a/daemon/notification-display.path
+++ /dev/null
@@ -1,5 +0,0 @@
-[Unit]
-Description=This path will tell you that service is ready to launch
-
-[Path]
-PathExists=/run/.wm_ready
diff --git a/daemon/notification-display.service b/daemon/notification-display.service
deleted file mode 100644
index 07cfdc6..0000000
--- a/daemon/notification-display.service
+++ /dev/null
@@ -1,11 +0,0 @@
-[Unit]
-Description=Notifications Display daemon
-
-[Service]
-Type=simple
-EnvironmentFile=/run/tizen-system-env
-ExecStart=/usr/bin/notification-display
-Restart=always
-
-[Install]
-WantedBy=default.target
diff --git a/daemon/notification_display_service.c b/daemon/notification_display_service.c
deleted file mode 100644
index ebc890b..0000000
--- a/daemon/notification_display_service.c
+++ /dev/null
@@ -1,161 +0,0 @@
-#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"
-#define HIDE_TIME 3.0
-
-SET_TAG(SERVICE_NAME)
-
-struct _priv {
- Evas_Object *win;
- Evas_Object *popup;
-
- time_t last_time;
-};
-
-static void _hide(void *data, Evas_Object *obj, void *event_info)
-{
- evas_object_hide(data);
-}
-
-void _show_notification(struct _priv *priv, notification_h noti)
-{
- char *title = NULL;
- char *content = NULL;
-
- notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &title);
- notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, &content);
-
- elm_object_text_set(priv->popup, content);
- elm_object_part_text_set(priv->popup, "title,text", title);
- evas_object_show(priv->popup);
- evas_object_show(priv->win);
-}
-
-void _notification_changed_cb(void *data, notification_type_e notif_type)
-{
- struct _priv *priv;
- time_t latest_time;
- notification_h noti = NULL;
- notification_list_h noti_list = NULL;
-
- if (notif_type != NOTIFICATION_TYPE_NOTI)
- return;
-
- if (!data) {
- _ERR("failed to get data");
- return;
- }
- priv = data;
-
- notification_get_list(NOTIFICATION_TYPE_NOTI, -1, &noti_list);
- if (noti_list) {
- noti = notification_list_get_data(noti_list);
- if (noti) {
- notification_get_insert_time(noti, &latest_time);
-
- if (latest_time > priv->last_time) {
- _show_notification(priv, noti);
- priv->last_time = latest_time;
- }
- }
- }
-
- notification_free_list(noti_list);
-}
-
-time_t _get_last_time(void)
-{
- time_t last_time = 0;
- notification_h noti = NULL;
- notification_list_h noti_list = NULL;
-
- notification_get_list(NOTIFICATION_TYPE_NOTI, -1, &noti_list);
- if (noti_list) {
- noti = notification_list_get_data(noti_list);
- if (noti)
- notification_get_insert_time(noti, &last_time);
- }
-
- notification_free_list(noti_list);
-
- return last_time;
-}
-
-int _create_popup(struct _priv *priv)
-{
- Evas_Object *btn;
-
- priv->win = elm_win_add(NULL, "popup", ELM_WIN_BASIC);
- if (!priv->win) {
- _ERR("elm_win_add failed");
- return -1;
- }
- elm_win_autodel_set(priv->win, EINA_TRUE);
- elm_win_alpha_set(priv->win, EINA_TRUE);
-
- priv->popup = elm_popup_add(priv->win);
- if (!priv->popup) {
- evas_object_del(priv->win);
- _ERR("elm_win_add failed");
- return -1;
- }
- elm_popup_orient_set(priv->popup, ELM_POPUP_ORIENT_BOTTOM_LEFT);
-
- btn = elm_button_add(priv->popup);
- elm_object_text_set(btn, "OK");
- elm_object_part_content_set(priv->popup, "button1", btn);
- evas_object_smart_callback_add(btn, "clicked", _hide, priv->win);
-
- return 0;
-}
-
-void _destroy_popup(struct _priv *priv)
-{
- evas_object_del(priv->popup);
- evas_object_del(priv->win);
-}
-
-int main(int argc, char **argv)
-{
- struct _priv *priv;
- notification_error_e error_n;
-
- elm_init(0, NULL);
-
- priv = calloc(1, sizeof(*priv));
- if (!priv) {
- _ERR("failed to allocate priv");
- return 0;
- }
-
- if (_create_popup(priv) < 0) {
- _ERR("failed to create popup");
- free(priv);
- return 0;
- }
-
- priv->last_time = _get_last_time();
-
- error_n = NOTIFICATION_ERROR_SERVICE_NOT_READY;
- while (error_n != NOTIFICATION_ERROR_NONE) {
- error_n = notification_resister_changed_cb(
- _notification_changed_cb, priv);
- _DBG("Could not register with notifications server");
- sleep(5);
- }
-
- elm_run();
-
- _destroy_popup(priv);
- free(priv);
-
- elm_shutdown();
-
- return 0;
-}