4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7 * Jaeho Lee <jaeho81.lee@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
24 #include <sys/types.h>
28 #include <dbus/dbus.h>
31 #include "syspopup_core.h"
32 #include "syspopup_db.h"
33 #include "syspopup_api.h"
34 #include "simple_util.h"
36 API int syspopup_launch(char *popup_name, bundle *b)
38 syspopup_info_t *info = NULL;
42 if (popup_name == NULL) {
43 _E("popup_name is NULL");
47 info = _syspopup_info_get(popup_name);
48 if (info == NULL || info->pkgname == NULL) {
49 _E("info or info->pkgname is NULL");
51 _syspopup_info_free(info);
60 if (_syspopup_set_name_to_bundle(b, popup_name) < 0) {
61 _E("bundle set error\n");
62 _syspopup_info_free(info);
70 ret = aul_launch_app(info->pkgname, b);
72 _E("aul launch error - %d", ret);
79 _syspopup_info_free(info);
84 API int syspopup_destroy_all()
88 DBusConnection *bus = NULL;
90 dbus_error_init(&error);
91 bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
93 _E("Failed to connect to the D-BUS daemon: %s", error.message);
94 dbus_error_free(&error);
98 message = dbus_message_new_signal(SYSPOPUP_DBUS_PATH,
99 SYSPOPUP_DBUS_SIGNAL_INTERFACE,
100 SYSPOPUP_DBUS_SP_TERM_SIGNAL);
102 if (dbus_connection_send(bus, message, NULL) == FALSE) {
103 _E("dbus send error");
107 dbus_connection_flush(bus);
108 dbus_message_unref(message);
110 dbus_connection_close(bus);
112 _D("send signal done\n");