# Set required packages
INCLUDE(FindPkgConfig)
-pkg_check_modules(libpkgs REQUIRED aul dlog bundle sqlite3 glib-2.0 dbus-glib-1)
+pkg_check_modules(libpkgs REQUIRED aul dlog bundle sqlite3 glib-2.0 gio-2.0 capi-system-info)
FOREACH(flag ${libpkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+++ /dev/null
-#!/bin/sh
-
-export TET_INSTALL_PATH=/scratchbox/tetware # local tetware path
-export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
-export PATH=$TET_TARGET_PATH/bin:$PATH
-export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
-export TET_ROOT=$TET_TARGET_PATH
-
-export TET_SUITE_ROOT=`pwd`
-FILE_NAME_EXTENSION=`date +%s`
-
-RESULT_DIR=results
-HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
-JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
-
-mkdir -p $RESULT_DIR
-
-tcc -c -p ./
-tcc -b -j $JOURNAL_RESULT -p ./
-grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
+++ /dev/null
-#!/bin/sh
-export TET_INSTALL_PATH=/mnt/nfs/tetware
-export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
-export PATH=$TET_TARGET_PATH/bin:$PATH
-export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
-
-export TET_ROOT=$TET_TARGET_PATH
-
-export TET_SUITE_ROOT=`pwd`
-FILE_NAME_EXTENSION=`date +%s`
-
-RESULT_DIR=results
-HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
-JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
-
-mkdir -p $RESULT_DIR
-
-tcc -e -j $JOURNAL_RESULT -p ./
-grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
+++ /dev/null
-# TET reserved codes
-0 "PASS"
-1 "FAIL"
-2 "UNRESOLVED"
-3 "NOTINUSE"
-4 "UNSUPPORTED"
-5 "UNTESTED"
-6 "UNINITIATED"
-7 "NORESULT"
-
-# Test suite additional codes
-33 "INSPECT"
+++ /dev/null
-all
- ^TEST
-##### Scenarios for TEST #####
-
-# Test scenario
-TEST
- :include:/unit/tslist
+++ /dev/null
-TET_OUTPUT_CAPTURE=False
-TET_BUILD_TOOL=make
-TET_PASS_TC_NAME=True
+++ /dev/null
-TET_OUTPUT_CAPTURE=False
-TET_CLEAN_TOOL=make clean
+++ /dev/null
-TET_OUTPUT_CAPTURE=False
+++ /dev/null
-CC ?= gcc
-
-TARGETS =
-PKGS = syspopup
-
-LDFLAGS = `pkg-config --libs $(PKGS)`
-LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
-LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
-LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
-
-CFLAGS = -I. `pkg-config --cflags $(PKGS)`
-CFLAGS += -I$(TET_ROOT)/inc/tet3
-CFLAGS += -Wall
-
-all: $(TARGETS)
-
-$(TARGET): %: %.c
- $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
-
-clean:
- rm -f $(TARGETS)
+++ /dev/null
-#!/bin/sh
-
-TMPSTR=$0
-SCRIPT=${TMPSTR##*/}
-
-if [ $# -lt 2 ]; then
- echo "Usage) $SCRIPT module_name api_name"
- exit 1
-fi
-
-MODULE=$1
-API=$2
-TEMPLATE=utc_MODULE_API_func.c.in
-TESTCASE=utc_${MODULE}_${API}_func
-
-sed -e '
- s^@API@^'"$API"'^g
- s^@MODULE@^'"$MODULE"'^g
- ' $TEMPLATE > $TESTCASE.c
-
-if [ ! -e "$TESTCASE.c" ]; then
- echo "Failed"
- exit 1
-fi
-echo "Testcase file is $TESTCASE.c"
-echo "Done"
-echo "please put \"$TESTCASE\" as Target in Makefile"
-echo "please put \"/unit/$TESTCASE\" in tslist"
+++ /dev/null
-#include <tet_api.h>
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_@MODULE@_@API@_func_01(void);
-static void utc_@MODULE@_@API@_func_02(void);
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-struct tet_testlist tet_testlist[] = {
- { utc_@MODULE@_@API@_func_01, POSITIVE_TC_IDX },
- { utc_@MODULE@_@API@_func_02, NEGATIVE_TC_IDX },
-};
-
-static void startup(void)
-{
-}
-
-static void cleanup(void)
-{
-}
-
-/**
- * @brief Positive test case of @API@()
- */
-static void utc_@MODULE@_@API@_func_01(void)
-{
- int r = 0;
- char buf[MAX_LOCAL_BUFSZ];
-
- r = @API@(...);
-
- if (r<0) {
- tet_infoline("@API@() failed in positive test case");
- tet_result(TET_FAIL);
- return;
- }
- tet_result(TET_PASS);
-}
-
-/**
- * @brief Negative test case of ug_init @API@()
- */
-static void utc_@MODULE@_@API@_func_02(void)
-{
- int r = 0;
- char buf[MAX_LOCAL_BUFSZ];
-
- r = @API@(...);
-
- if (r>=0) {
- tet_infoline("@API@() failed in negative test case");
- tet_result(TET_FAIL);
- return;
- }
- tet_result(TET_PASS);
-}
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"lowmem-syspopup", 0,0,5,0,0,"org.tizen.lowmem-syspopup");
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"lowbat-syspopup", 1,0,5,0,0,"org.tizen.lowbat-syspopup");
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"net-popup", 0,0,-1,0,0,"net.netpopup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"usb-syspopup", 1,0,-1,2,2,"org.tizen.usb-syspopup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"usbotg-syspopup", 0,1,-1,0,0,"org.tizen.usbotg-syspopup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"mmc-syspopup", 0,0,-1,0,0,"org.tizen.mmc-syspopup");
+INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"usb-syspopup", 1,0,-1,2,2,"org.tizen.usb-syspopup");
+INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"usbotg-syspopup", 0,1,-1,0,0,"org.tizen.usbotg-syspopup");
+INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"mmc-syspopup", 0,0,-1,0,0,"org.tizen.mmc-syspopup");
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"mobileap-syspopup", 0,0,-1,0,0,"org.tizen.mobileap-syspopup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"telephony-syspopup", 1,1,5,0,0,"org.tizen.telephony-syspopup");
+INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"telephony-syspopup", 1,1,5,0,0,"org.tizen.telephony-syspopup");
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"system-syspopup", 2,0,-1,0,0,"org.tizen.system-syspopup");
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"safetyvolume-syspopup", 1,0,-1,0,0,"org.tizen.safetyvolume-syspopup");
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"datausage-syspopup", 1,0,-1,0,0,"org.tizen.datausage-syspopup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"crash-popup", 1,0,-1,0,0,"org.tizen.crash-popup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"gps-syspopup", 0,0,-1,0,0,"org.tizen.gps-syspopup");
-INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"mode-syspopup", 1,0,-1,0,0,"org.tizen.mode-syspopup");
+INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"crash-popup", 1,0,-1,0,0,"org.tizen.crash-popup");
+INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"gps-syspopup", 0,0,-1,0,0,"org.tizen.gps-syspopup");
+INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"mode-syspopup", 1,0,-1,0,0,"org.tizen.mode-syspopup");
/*
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"drm", 0,0,5,0,0,"com.samsung.drm-popup");
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"incoming_call", 2,0,-1,2,2,"com.samsung.incoming_call");
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"safetyvolume-syspopup", 2,1,-1,0,0,"org.tizen.safetyvolume-syspopup");
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"crash-popup", 1,0,-1,0,0,"org.tizen.crash-popup");
INSERT OR REPLACE INTO "syspopup_info" VALUES(NULL,"wc-syspopup", 0,0,-1,0,0,"net.wc-syspopup");
-
Name: syspopup
Summary: syspopup package
-Version: 0.0.134
+Version: 0.0.135
Release: 1
Group: System/Libraries
License: Apache-2.0
BuildRequires: pkgconfig(bundle)
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(utilX)
-BuildRequires: pkgconfig(dbus-glib-1)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(evas)
BuildRequires: pkgconfig(appcore-efl)
-BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(vasum)
+BuildRequires: pkgconfig(appsvc)
+BuildRequires: pkgconfig(capi-system-info)
%description
syspopup package for popup
%if "%{?tizen_profile_name}" == "wearable"
export CFLAGS="$CFLAGS –D_WEARABLE"
%else
+%if "%{?tizen_profile_name}" == "mobile"
export CFLAGS="$CFLAGS -D_MOBILE"
+%else
+%if "%{?tizen_profile_name}" == "tv"
+export CFLAGS="$CFLAGS -D_TV"
+%endif
+%endif
%endif
%if 0%{?sec_build_binary_debug_enable}
%endif
export CFLAGS="$CFLAGS -Wall -Werror -Wno-unused-function"
CFLAGS=${_cflags} cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DEXTRA_CFLAGS=-fPIC \
- -D_WEARABLE:BOOL=${_WEARABLE} -D_MOBILE:BOOL=${_MOBILE} \
+ -D_WEARABLE:BOOL=${_WEARABLE} -D_MOBILE:BOOL=${_MOBILE} -D_TV:BOOL=${_TV} \
.
make %{?jobs:-j%jobs}
#include <glib.h>
#include <stdlib.h>
#include <string.h>
-#include <dbus/dbus.h>
-#include <dbus/dbus-glib-lowlevel.h>
#include "syspopup_core.h"
#include "simple_util.h"
+#include <gio/gio.h>
+#include <bundle_internal.h>
#define SYSPOPUP_NAME "_INTERNAL_SYSPOPUP_NAME_"
static syspopup *syspopup_head = NULL;
static int initialized = 0;
-static DBusConnection *bus;
static int noti_fd = -1;
static int sp_id = 0;
}
}
-
-static DBusHandlerResult
-__sys_popup_dbus_signal_filter(DBusConnection *conn, DBusMessage *message,
- void *user_data)
+void __sys_popup_dbus_signal_filter(GDBusConnection *conn,
+ const gchar *sender_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ gpointer user_data)
{
const char *sender;
const char *interface;
int dead_pid;
-
- DBusError error;
- dbus_error_init(&error);
-
- interface = dbus_message_get_interface(message);
- if (interface == NULL) {
- _E("reject by security issue - no interface\n");
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-
- if (dbus_message_is_signal(message, interface,
- SYSPOPUP_DBUS_SP_TERM_SIGNAL)) {
+ if(!strcmp(signal_name, SYSPOPUP_DBUS_SP_TERM_SIGNAL)) {
if (_term_handler)
_term_handler(NULL);
_D("term handler has been called");
}
-
- return DBUS_HANDLER_RESULT_HANDLED;
}
-
-
int _syspopup_init(void (*term_handler) (void *),
gboolean(*timeout_handler) (void *))
{
- DBusError error;
char rule[MAX_LOCAL_BUFSZ];
if (initialized)
_term_handler = term_handler;
_timeout_handler = timeout_handler;
- dbus_error_init(&error);
- bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
- if (!bus) {
- _E("Failed to connect to the D-BUS daemon: %s", error.message);
- dbus_error_free(&error);
+ GDBusConnection *conn = NULL;
+ GError *err = NULL;
+ g_type_init();
+
+ conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM,NULL,&err);
+
+ if (err) {
+ _E("gdbus connection error (%s)", err->message);
+ g_error_free(err);
return -1;
}
- dbus_connection_setup_with_g_main(bus, NULL);
-
- snprintf(rule, MAX_LOCAL_BUFSZ,
- "path='%s',type='signal',interface='%s'", SYSPOPUP_DBUS_PATH,
- SYSPOPUP_DBUS_SIGNAL_INTERFACE);
- /* listening to messages */
- dbus_bus_add_match(bus, rule, &error);
- if (dbus_error_is_set(&error)) {
- _E("Fail to rule set: %s", error.message);
- dbus_error_free(&error);
+ if (NULL == conn) {
+ _E("gdbus connection is not set, even gdbus error isn't raised");
return -1;
}
- if (dbus_connection_add_filter(bus,
- __sys_popup_dbus_signal_filter, NULL, NULL) == FALSE)
- return -1;
+ /* Add a filter for signal */
+ guint conn_subsc_id = g_dbus_connection_signal_subscribe(conn,
+ NULL, SYSPOPUP_DBUS_SIGNAL_INTERFACE,
+ NULL, NULL, NULL, G_DBUS_SIGNAL_FLAGS_NONE,
+ __sys_popup_dbus_signal_filter, NULL, NULL);
+ if (conn_subsc_id == 0) {
+ _E("Error in subscribing to the signal");
+ }
_D("syspopup signal initialized");
initialized = 1;
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/syspopup)
INCLUDE(FindPkgConfig)
-pkg_check_modules(syspopup_app_pkgs REQUIRED appcore-efl capi-appfw-application)
+pkg_check_modules(syspopup_app_pkgs REQUIRED appcore-efl)
FOREACH(flag ${syspopup_app_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
*
*/
-#include <tizen.h>
-#include <dlog.h>
+
+#include <stdio.h>
+#include <appcore-efl.h>
+#include <Ecore_X.h>
+#include <bundle_internal.h>
+
#include "syspopup.h"
#include "syspopup-app.h"
-typedef struct appdata {
- Evas_Object *win;
- Evas_Object *conform;
- Evas_Object *label;
- Evas_Object *popup;
- bundle *b;
- char title[TITLE_BUF_LEN];
- char content[CONTENT_BUF_LEN];
-} appdata_s;
+#include <time.h>
+
+#include <dlog.h>
+
+#undef LOG_TAG
+#define LOG_TAG "SYSPOPUP-APP"
+
+#define _E(fmt, arg...) LOGE(fmt,##arg)
+#define _D(fmt, arg...) LOGD(fmt,##arg)
int myterm(bundle *b, void *data)
{
- dlog_print(DLOG_DEBUG, LOG_TAG, "myterm called");
+ _D("myterm called");
return 0;
}
int mytimeout(bundle *b, void* data)
{
- dlog_print(DLOG_DEBUG, LOG_TAG, "mytimeout called");
+ _D("mytimeout called");
return 0;
}
.def_timeout_fn = mytimeout
};
-static bool _app_control_extra_data_cb(app_control_h app_control, const char *key, void *user_data)
+static void __win_del(void *data, Evas_Object * obj, void *event)
{
- int ret;
- char *value;
- appdata_s *ad = user_data;
-
- ret = app_control_get_extra_data(app_control, key, &value);
- if (ret != APP_CONTROL_ERROR_NONE)
- {
- dlog_print(DLOG_ERROR, LOG_TAG, "app_control_get_extra_data() is failed. err = %d", ret);
- }
+ _D("__win_del called");
+ elm_exit();
+}
- if (bundle_add(ad->b, key, value) != BUNDLE_ERROR_NONE) {
- free(value);
- return APP_CONTROL_ERROR_INVALID_PARAMETER;
- }
+static Evas_Object *__create_win(const char *name)
+{
+ Evas_Object *eo;
+ int w;
+ int h;
- free(value);
+ eo = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
+ if (eo) {
+ elm_win_title_set(eo, name);
+ elm_win_borderless_set(eo, EINA_TRUE);
- return true;
-}
+ elm_win_alpha_set(eo, EINA_TRUE);
-static void win_delete_request_cb(void *data , Evas_Object *obj , void *event_info)
-{
- ui_app_exit();
+ evas_object_smart_callback_add(eo, "delete,request",
+ __win_del, NULL);
+ ecore_x_window_size_get(ecore_x_window_root_first_get(),
+ &w, &h);
+ evas_object_resize(eo, w, h);
+ }
+
+ return eo;
}
-static void win_back_cb(void *data, Evas_Object *obj, void *event_info)
+static int __app_create(void *data)
{
- appdata_s *ad = data;
- /* Let window go to hide state. */
- elm_win_lower(ad->win);
+ struct appdata *ad = data;
+ Evas_Object *win;
+ int r;
+
+ _D("__app_create called");
+
+ /* create window */
+ win = __create_win(PACKAGE);
+ if (win == NULL)
+ return -1;
+ ad->win = win;
+ /* evas_object_show(win);*/
+
+ /* init internationalization */
+ r = appcore_set_i18n(PACKAGE, LOCALEDIR);
+ if(r)
+ return -1;
+
+ /* appcore_set_rotation_cb(rotate, ad);*/
+
+ appcore_measure_start();
+ return 0;
}
-static void response_cb(void *data, Evas_Object * obj, void *event_info)
+static int __app_terminate(void *data)
{
- dlog_print(DLOG_DEBUG, LOG_TAG, "response_cb called");
+ struct appdata *ad = data;
- if ((int)event_info != 5)
- evas_object_del(obj);
- elm_exit();
+ _D("__app_terminate called");
+
+ if (ad->win)
+ evas_object_del(ad->win);
+
+ return 0;
}
-static void block_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+static int __app_pause(void *data)
{
- dlog_print(DLOG_DEBUG, LOG_TAG, "block_clicked_cb called");
- evas_object_del(obj);
-}
+ struct appdata *ad = data;
-static void create_base_gui(appdata_s *ad) {
+ _D("__app_pause called");
- int w;
- int h;
+ return 0;
+}
- ad->win = elm_win_add(NULL, PACKAGE, ELM_WIN_DIALOG_BASIC);
- if (ad->win) {
- elm_win_title_set(ad->win, PACKAGE);
- elm_win_borderless_set(ad->win, EINA_TRUE);
- elm_win_alpha_set(ad->win, EINA_TRUE);
- ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
- evas_object_resize(ad->win, w, h);
- }
+static int __app_resume(void *data)
+{
+ struct appdata *ad = data;
- elm_win_autodel_set(ad->win, EINA_TRUE);
- evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
+ _D("__app_resume called");
+ return 0;
}
-static bool app_create(void *data)
+static void __prt_recvd_bundle(const char *key, const char *value, void *d)
{
- appdata_s *ad = data;
+ _D("recvd - key: %s, value: %s\n", key, value);
+}
- create_base_gui(ad);
+static void __response_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ _D("__response_cb called");
- return true;
+ if ((int)event_info != 5)
+ evas_object_del(obj);
+ elm_exit();
}
-static void app_control(app_control_h app_control, void *data)
+static void _block_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
- /* Handle the launch request. */
- appdata_s *ad = data;
+ _D("_block_clicked_cb called");
+ evas_object_del(obj);
+}
+static int __app_reset(bundle *b, void *data)
+{
+ struct appdata *ad = data;
Evas_Object *popup;
const char *val;
int ret = 0;
- if(ad->b == NULL)
- ad->b = bundle_create();
+ _D("__app_reset called");
+
+ ad->b = bundle_dup(b);
- ret = app_control_foreach_extra_data(app_control, _app_control_extra_data_cb, data);
- if (ret != APP_CONTROL_ERROR_NONE)
- dlog_print(DLOG_ERROR, LOG_TAG, "app_control_foreach_extra_data() is failed. err = %d", ret);
+ bundle_iterate(b, __prt_recvd_bundle, NULL);
- if (syspopup_has_popup(ad->b)) {
- syspopup_reset(ad->b);
+ if (syspopup_has_popup(b)) {
+ syspopup_reset(b);
} else {
popup = elm_popup_add(ad->win);
if (popup != NULL) {
- ret = syspopup_create(ad->b, &handler, ad->win, ad);
+ ret = syspopup_create(b, &handler, ad->win, ad);
evas_object_show(ad->win);
if (ret == 0) {
- val = bundle_get_val(ad->b, "_SYSPOPUP_TITLE_");
+ val = bundle_get_val(b, "_SYSPOPUP_TITLE_");
if (val) {
snprintf(ad->title, TITLE_BUF_LEN, "%s",
- val);
+ val);
} else {
snprintf(ad->title, TITLE_BUF_LEN, "%s",
- "Unknown Title");
+ "Unknown Title");
}
- val = bundle_get_val(ad->b, "_SYSPOPUP_CONTENT_");
+ val = bundle_get_val(b, "_SYSPOPUP_CONTENT_");
if (val) {
snprintf(ad->content, CONTENT_BUF_LEN,
- "%s", val);
+ "%s", val);
} else {
snprintf(ad->content, CONTENT_BUF_LEN,
- "%s", "Unknown Content");
+ "%s", "Unknown Content");
}
elm_object_style_set(popup, "char_wrap_style");
evas_object_size_hint_weight_set(popup,
- EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- evas_object_smart_callback_add(popup, "block,clicked", block_clicked_cb, NULL);
+ EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_smart_callback_add(popup, "block,clicked", _block_clicked_cb, NULL);
elm_object_part_text_set(popup, "title,text", ad->title);
elm_object_text_set(popup, ad->content);
evas_object_smart_callback_add(popup,
- "response",
- response_cb,
- NULL);
+ "response",
+ __response_cb,
+ NULL);
evas_object_show(popup);
}
}
}
- bundle_free(ad->b);
-}
-
-static void app_pause(void *data)
-{
- /* Take necessary actions when application becomes invisible. */
-}
-static void app_resume(void *data)
-{
- /* Take necessary actions when application becomes visible. */
-}
-
-static void app_terminate(void *data)
-{
- /* Release all resources. */
-}
-
-static void ui_app_lang_changed(app_event_info_h event_info, void *user_data)
-{
- /* APP_EVENT_LANGUAGE_CHANGED*/
- return;
-}
-
-static void ui_app_orient_changed(app_event_info_h event_info, void *user_data)
-{
- /* APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
- return;
-}
-
-static void ui_app_region_changed(app_event_info_h event_info, void *user_data)
-{
- /* APP_EVENT_REGION_FORMAT_CHANGED*/
-}
-
-static void ui_app_low_battery(app_event_info_h event_info, void *user_data)
-{
- /* APP_EVENT_LOW_BATTERY*/
-}
-
-static void ui_app_low_memory(app_event_info_h event_info, void *user_data)
-{
- /* APP_EVENT_LOW_MEMORY*/
+ return 0;
}
int main(int argc, char *argv[])
{
- appdata_s ad = {0,};
- int ret = 0;
+ struct appdata ad;
+ struct appcore_ops ops = {
+ .create = __app_create,
+ .terminate = __app_terminate,
+ .pause = __app_pause,
+ .resume = __app_resume,
+ .reset = __app_reset,
+ };
- ui_app_lifecycle_callback_s event_callback = {0,};
- app_event_handler_h handlers[5] = {NULL, };
+ //unsetenv("ELM_SCALE");
- event_callback.create = app_create;
- event_callback.terminate = app_terminate;
- event_callback.pause = app_pause;
- event_callback.resume = app_resume;
- event_callback.app_control = app_control;
+ /* appcore measure time example */
+ _D("from AUL to %s(): %d msec\n", __func__,
+ appcore_measure_time_from("APP_START_TIME"));
- ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
- ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
- ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
- ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
- ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
-
- ret = ui_app_main(argc, argv, &event_callback, &ad);
- if (ret != APP_ERROR_NONE) {
- dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
- }
+ memset(&ad, 0x0, sizeof(struct appdata));
+ ops.data = &ad;
- return ret;
+ return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
}
#ifndef __SYSPOPUP_APP_H__
#define __SYSPOPUP_APP_H__
-#include <app.h>
#include <Elementary.h>
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "syspopup-app"
-
#if !defined(PACKAGE)
-#define PACKAGE "syspopup-app"
+# define PACKAGE "syspopup-app"
#endif
+#define NAME_BUF_LEN 256
#define TITLE_BUF_LEN 256
#define CONTENT_BUF_LEN 256
+#define QP_BUF_LEN 10
+#define QP_PRIVID 1
+#define QP_TERM 1
+#define QP_TIMEOUT 1
+
+struct appdata {
+ Evas_Object *win;
+ Evas_Object *popup;
+ bundle *b;
+ char title[TITLE_BUF_LEN];
+ char content[CONTENT_BUF_LEN];
+ /* add more variables here */
+};
+
#endif /* __SYSPOPUP_APP_H__ */
# Set required packages
INCLUDE(FindPkgConfig)
-pkg_check_modules(spcpkgs REQUIRED dlog bundle sqlite3 glib-2.0 aul dbus-glib-1)
+pkg_check_modules(spcpkgs REQUIRED dlog bundle sqlite3 glib-2.0 aul gio-2.0 vasum appsvc capi-system-info)
FOREACH(flag ${spcpkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
#include <sys/stat.h>
#include <fcntl.h>
#include <glib.h>
-#include <dbus/dbus.h>
+#include <gio/gio.h>
#include <aul.h>
+#include <vasum.h>
+#include <appsvc.h>
+#include <system_info.h>
#include "syspopup_core.h"
#include "syspopup_db.h"
#include "syspopup_api.h"
#include "simple_util.h"
+static int __initialized = 0;
+static bool __zone_armed = 0;
+
+#define TIZEN_ZONE_CONFIG_KEY "tizen.org/feature/container"
+
API int syspopup_launch(char *popup_name, bundle *b)
{
syspopup_info_t *info = NULL;
int ret;
int is_bundle = 0;
+ vsm_context_h vsm_ctx = NULL;
+ vsm_zone_h fg_zone = NULL;
+ const char *fg_zone_name = NULL;
if (popup_name == NULL) {
_E("popup_name is NULL");
return -1;
}
+ if (!__initialized) {
+ ret = system_info_get_platform_bool(TIZEN_ZONE_CONFIG_KEY, &__zone_armed);
+ if (ret != SYSTEM_INFO_ERROR_NONE) {
+ _E("failed to get zone status, set zone status to disarmed");
+ __zone_armed = 0;
+ }
+ __initialized = 1;
+ }
+
info = _syspopup_info_get(popup_name);
if (info == NULL || info->pkgname == NULL) {
_E("info or info->pkgname is NULL");
}
if (_syspopup_set_name_to_bundle(b, popup_name) < 0) {
- _E("bundle set error\n");
+ _E("bundle set error");
_syspopup_info_free(info);
if (is_bundle == 1) {
return -1;
}
- ret = aul_launch_app(info->pkgname, b);
- if (ret < 0) {
- _E("aul launch error - %d", ret);
+ if (__zone_armed) {
+ if (vsm_is_virtualized()) {
+ ret = aul_launch_app(info->pkgname, b);
+ if (ret < 0)
+ _E("aul launch error - %d", ret);
+
+ goto out;
+ }
+#if !GLIB_CHECK_VERSION(2, 35, 0)
+ g_type_init();
+#endif
+ vsm_ctx = vsm_create_context();
+ if (vsm_ctx) {
+ fg_zone = vsm_get_foreground(vsm_ctx);
+ if (fg_zone == NULL) {
+ _E("failed to get foreground zone");
+ ret = -1;
+ goto out;
+ }
+
+ if (vsm_is_host_zone(fg_zone) == 1) {
+ _E("can not launch syspopup. foreground zone is host");
+ ret = -1;
+ goto out;
+ }
+
+ fg_zone_name = vsm_get_zone_name(fg_zone);
+ _D("foreground zone: %s", fg_zone_name);
+ } else {
+ _E("failed to create vsm_context");
+ ret = -1;
+ goto out;
+ }
+
+ if (fg_zone_name) {
+ appsvc_set_operation(b, APP_SVC_OPERATION_JUMP);
+ appsvc_add_data(b, APP_SVC_K_JUMP_ORIGIN_OPERATION, APPSVC_OPERATION_DEFAULT);
+ appsvc_add_data(b, APP_SVC_K_JUMP_ZONE_NAME, fg_zone_name);
+ appsvc_set_appid(b, info->pkgname);
+ ret = appsvc_run_service(b, 0, NULL, NULL);
+ if (ret < 0) {
+ _E("syspopup launch error - %d", ret);
+ }
+ } else {
+ _E("failed to get foreground zone name");
+ ret = -1;
+ goto out;
+ }
+
+ }
+ else {
+ ret = aul_launch_app(info->pkgname, b);
+ if (ret < 0)
+ _E("aul launch error - %d", ret);
+
+ goto out;
+ }
+
+out:
+ if (vsm_ctx) {
+ vsm_cleanup_context(vsm_ctx);
}
if (is_bundle == 1) {
API int syspopup_destroy_all()
{
- DBusMessage *message;
- DBusError error;
- DBusConnection *bus = NULL;
-
- dbus_error_init(&error);
- bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
- if (bus == NULL) {
- _E("Failed to connect to the D-BUS daemon: %s", error.message);
- dbus_error_free(&error);
- return -1;
- }
+ GDBusConnection *conn = NULL;
+ GError *err = NULL;
+ int ret = 0;
- message = dbus_message_new_signal(SYSPOPUP_DBUS_PATH,
- SYSPOPUP_DBUS_SIGNAL_INTERFACE,
- SYSPOPUP_DBUS_SP_TERM_SIGNAL);
+ g_type_init();
- if (dbus_connection_send(bus, message, NULL) == FALSE) {
- _E("dbus send error");
- return -1;
- }
+ conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM,NULL,&err);
- dbus_connection_flush(bus);
- dbus_message_unref(message);
+ if (err) {
+ _E("gdbus connection error (%s)", err->message);
+ ret = -1;
+ goto out;
+ }
+ if (NULL == conn) {
+ _E("gdbus connection is not set, even gdbus error isn't raised");
+ ret = -1;
+ goto out;
+ }
- dbus_connection_close(bus);
+ if(!g_dbus_connection_emit_signal(conn,NULL,
+ SYSPOPUP_DBUS_PATH,
+ SYSPOPUP_DBUS_SIGNAL_INTERFACE,
+ SYSPOPUP_DBUS_SP_TERM_SIGNAL,
+ NULL,
+ &err)) {
+ _E("Error emitting the signal: %s",err->message);
+ ret = -1;
+ goto out;
+ }
+out :
_D("send signal done\n");
+ if (err) {
+ g_error_free(err);
+ err = NULL;
+ }
- return 0;
+ if (conn) {
+ g_object_unref(conn);
+ conn = NULL;
+ }
+
+ return ret;
}
# Set required packages
INCLUDE(FindPkgConfig)
-pkg_check_modules(sppkgs REQUIRED dlog bundle sqlite3 glib-2.0 evas elementary utilX ecore-x x11 ecore ecore-input dbus-glib-1)
+pkg_check_modules(sppkgs REQUIRED dlog bundle sqlite3 glib-2.0 evas elementary utilX ecore-x x11 ecore ecore-input gio-2.0)
FOREACH(flag ${sppkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
int rotation = -1;
int ret;
- int angles[2];
-
Atom atom_active_win;
Atom atom_win_rotate_angle;
ecore_x_icccm_name_class_set(xwin, WIN_PROP_NAME, WIN_PROP_NAME);
if (elm_win_wm_rotation_supported_get(win)) {
int rots[4] = { 0, 90, 180, 270 };
- elm_win_wm_rotation_available_rotations_set(win, &rots, 4);
+ elm_win_wm_rotation_available_rotations_set(win, (const int*)(&rots), 4);
} else {
_E("win rotation no supported");
}
includedir=@INCLUDEDIR@
Name: libsyspopup
-Description: system popup library for ui
+Description: system popup library for ui
Version: @VERSION@
-Requires: dlog bundle sqlite3 glib-2.0 elementary utilX ecore-x dbus-glib-1
+Requires: dlog bundle sqlite3 glib-2.0 elementary utilX ecore-x
Libs: -L${libdir} -lsyspopup
Cflags: -I${includedir}
syspopup *sp = NULL;
int id;
XWindowAttributes attr;
- int is_unviewable = 0;
popup_name = _syspopup_get_name_from_bundle(b);
if (popup_name == NULL || handler == NULL) {
#include <stdlib.h>
#include <string.h>
#include "syspopup_caller.h"
+#include <bundle_internal.h>
void usage()
{